My silly mistake, that gave me false hope, was that I tested the script on my M3
Hmm. That's interesting, actually. I would have expected these functions not to exist at all on M3, or to be dummies that just return, but looking at the M3 firmware MoveFocusLensWithPosition exists, and has similar code to P&S.
As you observed, GetFocusLensMove min/max returns hard-coded -/+ 32000 so does not reflect actual lens limits on M3.
I guess the dofinfo focus being zero you reported was also on M3?
Reading your sagely advice, and doing a quick test on my G5X, has reluncantly led me to stop this development :-(
If you and others do find a safe way to move the lens in steps. ie not mm, on the P&S cams, then I'll restart my development.
Well, for functions that manipulate hardware, "safe" generally can't be determined by casual inspection of firmware code. Other functions likely exist, likely do similar things under the hood, and their safety relative to MoveFocusLensWithPosition is unknown.
Given elph180 seems to have crash issues related to MF, my earlier warning may have been an overreaction, but I'd still definitely be cautious experimenting on a more expensive camera.
As far as MoveFocusLensWithPosition being absolute rather than relative, I'd say that's a positive, since you can trivially generate a relative movement from the current position.
as far as i could determine, the p&s don't have an actual stepper motor. this results in the step not being at the same focus point between (re)boots or when zooming.
IIRC, Canon is fond of
USMs although there's likely variation between models. In any case, there's a lot more going on that just the focus mechanism. A complex zoom lens packed into a small space has lots of room for repeatability to suffer and the "subject distance" values exposed in CHDK add another layer of precision loss.
If you look at the
list of functions I posted earlier, there's several involving "Backlash" "SpeedTable" "AccelerationTable" "SlowdownTable" etc as well as ones referring to "DriveVoltage", "CarrierFrequency" and so on, which suggests that getting the lens quickly to the desired point is quite a complicated affair.