function myshoot() ecnt = get_exp_count() click("shoot_full")end

function myshoot() ecnt = get_exp_count() press("shoot_full_only") repeat sleep(50) until (get_shooting() == true) release("shoot_full_only") repeat sleep(50) until (get_shooting() == false)end

OK, worked it out: I think?That is unless someone tells me I can make it faster Code: [Select]function myshoot() ecnt = get_exp_count() press("shoot_full_only") repeat sleep(50) until (get_shooting() == true) release("shoot_full_only") repeat sleep(50) until (get_shooting() == false)end

local prevcnt=hook_shoot.count()press'shoot_full_only'repeat sleep(10) until prevcnt ~= hook_shoot.count()release'shoot_full_only'

@reyalp Really appreciate your insight and I look into this tomorrow. BTW the function will be used in my published landscape script https://gist.github.com/pigeonhill/10a43f5ba543bc758f1ce21d28981a89Replacing the function at line 130.

--[[@title Fast Landscape Bracketing'Perfect & Fast' focus brackets from near to blur defined 'infinity': overlap defined at a fraction of camera's CoCPlus option of two additional exposure brackets at each focus step, at 1Ev, 2Ev or 3Ev using -/+ or -/-- or +/++ logicMore info at https://chdk.wikia.com/wiki/Landscape_Focus_Bracketing_:_perfect_near_to_far_focus_bracketsCamera should be in manual focus mode and M modeNOT FOR RELEASEApril 2019Tested on a G7X(c) Garry George@chdk_version 1.5# overlap = 3 "Overlap at" {CoC 2CoC/3 CoC/2 diff}# delta = 0 "Exposure bracket delta?" {None 1Ev 2Ev 3Ev 800 1600 ZN}# logic = 0 "Exposure bracket logic?" {0/-/+ 0/-/-- 0/+/++}# delay = 3 "Script Delay (s)" [0 5]# bookends = 1 "Bookends?" {No Yes}# quality = 1 "Infinity focus quality?" {CoC/2 CoC/3 CoC/4}--]]capmode = require("capmode")if (capmode.get_name() ~= "M") then print("Switch to M mode") return -- exit scriptendif get_focus_mode() ~= 1 then print("Switch to MF mode") return -- exit scriptendif (get_focus() == -1) then print("@ Infinity") return -- exit scriptendpress("shoot_half") -- get current exposure & focus distancet = get_tick_count()repeat sleep(50) if get_tick_count() - t > 5000 then print("Unknown Error") release("shoot_half") return enduntil (get_shooting() == true)release("shoot_half")s = get_tv96()av = get_av96()dof = get_dofinfo()x = dof.focusbase_h = dof.hyp_dist -- that is without diffraction accounted forfl = dof.focal_length/100x_start = xlast_x = xtemp = 0temp1 = 0temp2 = 0count = 0ecnt = get_exp_count() -- used in the bookend function-- A few Functionsfunction myshoot() ecnt = get_exp_count() shoot()endfunction bookend() if bookends == 1 then set_tv96(960) set_av96(640) myshoot() set_tv96_direct(s) set_av96_direct(av) repeat sleep(20) until (get_exp_count() ~= ecnt) endendfunction refocus(xx) set_focus(xx) sleep(1000)endfunction X_bracket() set_tv96_direct(s) count = count + 1 if delta == 0 then myshoot() elseif delta < 4 and logic == 0 then myshoot() set_tv96_direct(s-96*delta) myshoot() set_tv96_direct(s+96*delta) myshoot() elseif delta < 4 and logic == 1 then myshoot() set_tv96_direct(s+96*delta) myshoot() set_tv96_direct(s+2*96*delta) myshoot() elseif delta < 4 and logic == 2 then myshoot() set_tv96_direct(s-96*delta) myshoot() set_tv96_direct(s-2*96*delta) myshoot() elseif delta == 4 then local iso = get_sv96() set_sv96(sv96_market_to_real(iso_to_sv96(100))) myshoot() set_sv96(sv96_market_to_real(iso_to_sv96(800))) myshoot() set_sv96(iso) elseif delta == 5 then local iso = get_sv96() set_sv96(sv96_market_to_real(iso_to_sv96(100))) myshoot() set_sv96(sv96_market_to_real(iso_to_sv96(1600))) myshoot() set_sv96(iso) elseif delta == 6 then myshoot() set_tv96_direct(s-96*4) myshoot() end set_tv96_direct(s)endh = base_h -- no overlap case: brackets 'touch' at CHDK CoCif overlap == 1 then -- adjust h to achieve the requested overlap, ie 'touching' at 2*CoC/3 or CoC/2 or at the diffraction aware defocus blur h = (h*3)/2elseif overlap == 2 then h = 2*helseif overlap == 3 then -- use diffraction aware overlap: Assume CHDK CoC is total blur, formed in quadrature from defocus and diffraction blurs temp1 = 1000*dof.coc -- total blur set up for imath temp2 = (1342*dof.aperture)/1000 -- set up for imath. From diff_blur = 2.44*0.55*N (um) if temp1 > temp2 then -- can use diffraction aware overlap temp = imath.sqrt(imath.mul(temp1,temp1) - imath.mul(temp2,temp2)) -- diffraction aware defocus blur temp2 = imath.div(temp1,temp) if temp2 > 3000 then h = 3*h else h = (h*temp2)/1000 end else -- diff blur > total blur h = 3*h endendif (x > base_h or x == -1) then print("@/beyond H") sleep(delay*1000) bookend() X_bracket() bookend() return -- exit scriptendsleep(delay*1000)bookend()while (x <= h/3) do -- capture focus brackets up to h/3 refocus(x) -- move to x X_bracket() dof = get_dofinfo() x = dof.focus -- register actual x moved by cam last_x = x x = (x*(h*10 - 2*fl))/(h*10 - 2*x*10) -- position of next focus bracket if x <= last_x or x <= 0 then print("Unknown Error") refocus(x_start) return end endtemp2 = h*(quality+2)refocus(h) -- take shot at hX_bracket()if temp2 > h then -- take additional infinity focus shot refocus(temp2) X_bracket() endbookend()refocus(x_start)

--[[@title Basic Landscape Bracketing'Perfect' focus brackets from near to blur defined 'infinity': overlap defined at a fraction of camera's CoCPlus option of two additional exposure brackets at each focus step, at 1Ev, 2Ev or 3Ev using -/+ or -/-- or +/++ logicUse Bookends to help differentiate bracket set in postMore info at https://chdk.wikia.com/wiki/Landscape_Focus_Bracketing_:_perfect_near_to_far_focus_bracketsCamera should be in manual focus mode and M modeRev 1.0April 2019Tested on a G7X(c) Garry George@chdk_version 1.5# overlap = 0 "Overlap at" {CoC 2CoC/3 CoC/2 diff}# delta = 0 "Exposure bracket delta?" {None 1Ev 2Ev 3Ev 800 1600 ZN}# logic = 0 "Exposure bracket logic?" {0/-/+ 0/-/-- 0/+/++}# delay = 3 "Script Delay (s)" [0 5]# bookends = 1 "Bookends?" {No Yes}# quality = 1 "Infinity focus quality?" {CoC/2 CoC/3 CoC/4}--]]capmode = require("capmode")if (capmode.get_name() ~= "M") then print("Switch to M mode") return -- exit scriptendif get_focus_mode() ~= 1 then print("Switch to MF mode") return -- exit scriptendif (get_focus() == -1) then print("@ Infinity") return -- exit scriptendpress("shoot_half") -- get current set camera valuest = get_tick_count()repeat sleep(50) if get_tick_count() - t > 5000 then print("Unknown Error") release("shoot_half") return -- exit script enduntil (get_shooting() == true)release("shoot_half") s = get_tv96() av = get_av96() dof = get_dofinfo() x = dof.focus base_h = dof.hyp_dist -- that is without diffraction accounted for fl = dof.focal_length/100x_start = xlast_x = xtemp = 0temp1 = 0temp2 = 0ecnt = get_exp_count()function myshoot() -- so I can change shooting strategies ;-) shoot()endfunction bookend() set_tv96(960) set_av96(640) ecnt = get_exp_count() shoot() set_tv96_direct(s) set_av96_direct(av) repeat sleep(100) until (get_exp_count() ~= ecnt)endfunction refocus(xx) set_focus(xx) sleep(500) -- may need adjusting for some cams?endfunction X_bracket() set_tv96_direct(s) if delta == 0 then myshoot() elseif delta < 4 and logic == 0 then myshoot() set_tv96_direct(s-96*delta) myshoot() set_tv96_direct(s+96*delta) myshoot() elseif delta < 4 and logic == 1 then myshoot() set_tv96_direct(s+96*delta) myshoot() set_tv96_direct(s+2*96*delta) myshoot() elseif delta < 4 and logic == 2 then myshoot() set_tv96_direct(s-96*delta) myshoot() set_tv96_direct(s-2*96*delta) myshoot() elseif delta == 4 then local iso = get_sv96() set_sv96(sv96_market_to_real(iso_to_sv96(100))) myshoot() set_sv96(sv96_market_to_real(iso_to_sv96(800))) myshoot() set_sv96(iso) elseif delta == 5 then local iso = get_sv96() set_sv96(sv96_market_to_real(iso_to_sv96(100))) myshoot() set_sv96(sv96_market_to_real(iso_to_sv96(1600))) myshoot() set_sv96(iso) elseif delta == 6 then myshoot() set_tv96_direct(s-96*4) myshoot() end set_tv96_direct(s)endh = base_h -- no overlap case: brackets 'touch' at CHDK CoCif overlap == 1 then -- adjust h to achieve the requested overlap, ie 'touching' at 2*CoC/3 or CoC/2 or at the diffraction aware defocus blur h = (h*3)/2elseif overlap == 2 then h = 2*helseif overlap == 3 then -- use diffraction aware overlap: Assume CHDK CoC is total blur, formed in quadrature from defocus and diffraction blurs temp1 = 1000*dof.coc -- total blur set up for imath temp2 = (1342*dof.aperture)/1000 -- set up for imath. From diff_blur = 2.44*0.55*N (um) if temp1 > temp2 then -- can use diffraction aware overlap temp = imath.sqrt(imath.mul(temp1,temp1) - imath.mul(temp2,temp2)) -- diffraction aware defocus blur temp2 = imath.div(temp1,temp) if temp2 > 3000 then h = 3*h else h = (h*temp2)/1000 end else -- diff blur > total blur h = 3*h endendif (x > base_h or x == -1) then print("@/beyond H") if bookends == 1 then bookend() else sleep(delay*1000) end X_bracket() if bookends == 1 then bookend() end return -- exit scriptendif bookends == 1 then bookend() else sleep(delay*1000) endwhile (x < h/3) do -- capture focus brackets up to h/3 refocus(x) -- move to x X_bracket() dof = get_dofinfo() x = dof.focus -- register actual x moved by cam last_x = x x = (x*(h*10 - 2*fl))/(h*10 - 2*x*10) -- position of next focus bracket if x <= last_x or x <= 0 then print("Unknown Error") refocus(x_start) return end endrefocus(h/3) -- take shot at h/3X_bracket()temp2 = h*(quality+2)refocus(h) -- take shot at hX_bracket()if temp2 > h then -- take additional infinity focus shot refocus(temp2) X_bracket() endif bookends == 1 then bookend() endrefocus(x_start)

function bookend() sleep(500) set_tv96_direct(960) set_av96_direct(640) ecnt = get_exp_count() myshoot() set_tv96_direct(s) set_av96_direct(av) repeat sleep(100) until (get_exp_count() ~= ecnt)end

Started by SkyWalker9 Script Writing

Started by SkyWalker9 « 1 2 » Completed and Working Scripts

Started by kidtree Completed and Working Scripts

Started by genosmm General Help and Assistance on using CHDK stable releases

Started by pigeonhill « 1 2 3 » Creative Uses of CHDK