What is strange, after reading your post, is when I use pos=call_event_proc('GetFocusLensMoveMinPosition') or pos=call_event_proc('GetFocusLensMoveMaxPosition'), I get -3200 or 3200 returned and the lens doesn't move. I'm in MF mode.
I was expecting to see the lens move.
I would not expect those functions to move the lens, and in my testing they did not. In general, functions in the firmware that start with "Get" return something rather than doing something (though of course side effects are possible), and from my testing
they return fixed (i.e. unchanging for a given camera) (edit: incorrect see next post) values for the minimum and maximum "move position".
MoveFocusLensWithPosition is the one that moves lens, and again, in general, Canon functions that do something generally start with a verb like Move or Set.
@reyalp
Thanks to your help I've made progress and believe I'm ready to code up a new script for focus and exposure bracketing.
First, I'd like to make sure you are clear that in my judgement there is a
significant chance that using MoveFocusLensWithPosition will result in lens error that is
unrecoverable without disassembly of the lens mechanism. If you are comfortable bricking a $500+ camera, that's you're choice, and any knowledge gained in the process will be appreciated, but I don't want to hear any crying about it.
Again, this isn't just general paranoia, this
because I encountered a lens error playing with this exact function. Just because my camera was eventually recovered by multiple reboots and gently whacking the lens doesn't mean yours will be!
Strangely in this demo script I can't seem to get the get_dofinfo giving me the focus position. It always seems to return 0.
That is odd. It may be a bug in the port. What do get_focus() and get_prop(require'propcase'.SUBJECT_DIST1) return?
Which camera are you testing this on, and what Canon firmware version is it?
From lines like
test = call_event_proc('GetFocusLensCurrentPosition')
qq=call_event_proc('MoveFocusLensWithPosition',100,0,0)
It seems you expect MoveFocusLensWithPosition to do a
relative move, i.e. + or - form the current position.
This is not how it works. It does an
absolute move. To get a relative move, you should add or subtract from the value returned by GetFocusLensCurrentPosition. You should make sure that the resulting value is within the limits provided by GetFocusLensMoveMinPosition and GetFocusLensMoveMaxPosition, as Move is
reported to crash with values outside those limits.
As a general comment, I'd highly recommend starting with a simple test case to understand the actual behavior of the functions rather than trying to implement a full bracketing script from the get go.
I personally find chdkptp invaluable for this kind of thing, because it allows me to interactively test functions and see the results, but YMMV.