However, the camera would not normally expect focus to change at this point.
Most cameras have a continuous mode where they do auto focus…
Only the higher end cameras, but even in that case, they probably don't do it at the same where the hook is.
OTOH, thinking about this more, CHDK has had focus bracketing long time. This is done in the raw hook, so doing the same in a script should be no riskier. I don't know how widely CHDK focus bracketing has been used.
But if I use my IXUS and it works, I can’t be sure that my G1x get damaged…
Of course, you can't be sure. But if it kills a cheap camera, I probably wouldn't try it on an expensive one...
How can I test?
I would go into CHDKPTP:
...
Normally, you should use set_mf or set_aflock before half press (a few cameras may require set_aflock() be inside half press). Since scripted key presses are reset between = calls, you have to do everything with half shoot held in one command, something like (untested off the top of my head)
=set_mf(true) press'shoot_half' repeat sleep(10) until get_shooting() local sd=500 while sd < 100000 do set_focus(sd) click'shoot_full_only' sd=sd*2 sleep(2000) end
Note that this would approximate the "quick" method, for cont mode you'd have to set up the raw hook and do it there.
If I want to change the focus from 0.5m to 100m in 100 steps. How should the focus change?
Not sure off hand. I'd probably just try linear e.g. sd_next = 1.05*sd and see if it look OK.