Thus used in Lua as: call_event_proc("MoveFocusPosition_FW", n, m), where I'm guessing n is signed, ie direction, and m is speed?
GetCurrentFocusPosition_FW = 0xfc3b9fa1j = call_func_ptr(GetCurrentFocusPosition_FW)
Find out the step value where I'm focusedMove to the macro end, ie move until the current step value is the same at the last one, and record the valueMove to infinity, ie until the current step value is the same as the last one, and record the value
Thus I know the lens full throw (MFD to infinity) in steps and can move by a specified number of steps using call_event_proc("MoveFocusPosition_FW", n, m), with n as the number of steps, ie 12 or -15, and m = 1, say
One matter that still confuses me with the P&S CHDK world is the use of ‘zoom’.Zoom to me is focal length change, ie not focus position change. Is that what CHDK means? That is zoom means change focal length?
--[[@title Focus Test@chdk_version 1.6#brackets = 1 "#Focus Brackets" [1 8]Jan 2023--]] props=require'propcase'capmode = require("capmode")bi = get_buildinfo()current_focus_mode = get_focus_mode()if current_focus_mode ~= 1 then set_mf(1) endset_config_value(2151,0) -- switching these two off means we are measuring distance 'from the lens': ...set_config_value(2152,0) -- ...this is the 'best' we can do without knowing the position of the front principal plane and pupil magnificationfunction check_buttons_etc() -- only used for manually testing wait_click(50) -- check for a button press do if is_key("up") and get_alt_mode() then print("Just testing") pos=call_event_proc('GetFocusLensCurrentPosition') print("Pos="..pos) elseif is_key("down") and get_alt_mode() then error('Test Ended') elseif is_key("left") and get_alt_mode() then -- move to MFD repeat test = call_event_proc('GetFocusLensCurrentPosition') qq=call_event_proc('MoveFocusLensWithPosition',-100,0,0) sleep(10) until test == call_event_proc('GetFocusLensCurrentPosition') elseif is_key("right") and get_alt_mode() then -- move to infinity repeat test = call_event_proc('GetFocusLensCurrentPosition') qq=call_event_proc('MoveFocusLensWithPosition',100,0,0) sleep(10) until test == call_event_proc('GetFocusLensCurrentPosition') elseif is_key("display") and get_alt_mode() then del = 100 qq=call_event_proc('MoveFocusLensWithPosition',del,0,0) end endendfunction calibrate_focus() -- move to infinity repeat test = call_event_proc('GetFocusLensCurrentPosition') qq=call_event_proc('MoveFocusLensWithPosition',100,0,0) sleep(10) until test == call_event_proc('GetFocusLensCurrentPosition') max = test -- now move to MFD repeat test = call_event_proc('GetFocusLensCurrentPosition') qq=call_event_proc('MoveFocusLensWithPosition',-100,0,0) sleep(10) until test == call_event_proc('GetFocusLensCurrentPosition') min = test dof = get_dofinfo() mfd = dof.focus end-- Main Sectionif call_event_proc('Mecha.Create') == -1 then if call_event_proc('MechaRegisterEventProcedure') == -1 then error('Mecha.Create / MechaRegisterEventProcedure failed') endendcalibrate_focus() -- ending up at MFDprint("infinity position = "..max)print("MFD positon = "..min)print("MFD(mm)="..mfd) -- seems to always be zero! Strange :-(finish = falserepeat throw = max - min -- = total lens throw del = throw/brackets qq=call_event_proc('MoveFocusLensWithPosition',del,0,0) -- move towards infinity qq = call_event_proc('GetFocusLensCurrentPosition') print("Now at position "..qq) -- take a snap here, but pause for now sleep(1000)until call_event_proc('GetFocusLensCurrentPosition') >= max
Started by eltomek Script Writing
Started by lngndvs Creative Uses of CHDK
Started by dvip General Discussion and Assistance
Started by fvfvfv Hello, I'm a NEWBIE - HELP!! (Newbies assistance, User Guides and thank you notes)
Started by reyalp « 1 2 » General Discussion and Assistance