function sd_logzoom(msg)local logzoomname = "A/zoom_step_av_value.csv"logzoom = io.open(logzoomname,"a")logzoom:write("\n",msg,"\n") logzoom:close()end--[[use erase button to select Av adjustment prior to runallow 5 secs for zoom to retract if start is at maximum ]]--if get_nd_present() == 1 thenset_zoom(0)sleep(5000)for i = 0, get_zoom_steps() -1, 1 do sd_logzoom(i + 1) --[[ for each zoom step initialise the aperture at the largest available value. This procedure relies on sufficient sleep value to ensure the Jog Dial movement has activated ]] repeat initial_get_user_av_id = get_user_av_id() post_levent_to_ui("RotateJogDialLeft",1) sleep(300) new_get_user_av_id = get_user_av_id() until new_get_user_av_id == initial_get_user_av_id --[[ for each zoom step use JogDial right to step through and record all available Aperture values. This procedure relies on sufficient sleep value to ensure the Jog Dial movement has activated ]] logavname="A/zoom_step_av_value.csv" logav=io.open(logavname,"a") repeat initial_get_user_av_id = get_user_av_id() logav:write(initial_get_user_av_id,"|") post_levent_to_ui("RotateJogDialRight",1) sleep(300) new_get_user_av_id = get_user_av_id() until new_get_user_av_id == initial_get_user_av_id logav:close() j = i + 1 set_zoom(j) repeat sleep(40) new_set_zoom = get_zoom() until new_set_zoom == jend--end
1347|384|416|448|480|512|544|576|2347|384|416|448|480|512|544|576|3347|384|416|448|480|512|544|576|4347|384|416|448|480|512|544|576|5347|384|416|448|480|512|544|576|6347|384|416|448|480|512|544|576|7347|384|416|448|480|512|544|576|8347|384|416|448|480|512|544|576|9347|384|416|448|480|512|544|576|10347|384|416|448|480|512|544|576|11347|384|416|448|480|512|544|576|12347|384|416|448|480|512|544|576|13384|416|448|480|512|544|576|14384|416|448|480|512|544|576|15384|416|448|480|512|544|576|16384|416|448|480|512|544|576|17384|416|448|480|512|544|576|18384|416|448|480|512|544|576|19384|416|448|480|512|544|576|20384|416|448|480|512|544|576|21384|416|448|480|512|544|576|22384|416|448|480|512|544|576|23384|416|448|480|512|544|576|24384|416|448|480|512|544|576|25384|416|448|480|512|544|576|26384|416|448|480|512|544|576|27384|416|448|480|512|544|576|28384|416|448|480|512|544|576|29384|416|448|480|512|544|576|30384|416|448|480|512|544|576|31384|416|448|480|512|544|576|32416|448|480|512|544|576|33416|448|480|512|544|576|34416|448|480|512|544|576|35416|448|480|512|544|576|36416|448|480|512|544|576|37416|448|480|512|544|576|38416|448|480|512|544|576|39416|448|480|512|544|576|40416|448|480|512|544|576|41416|448|480|512|544|576|42416|448|480|512|544|576|43416|448|480|512|544|576|44416|448|480|512|544|576|45416|448|480|512|544|576|46416|448|480|512|544|576|47416|448|480|512|544|576|48416|448|480|512|544|576|49416|448|480|512|544|576|50416|448|480|512|544|576|51416|448|480|512|544|576|52416|448|480|512|544|576|53448|480|512|544|576|54448|480|512|544|576|55448|480|512|544|576|56448|480|512|544|576|57448|480|512|544|576|58448|480|512|544|576|59448|480|512|544|576|60448|480|512|544|576|61448|480|512|544|576|62448|480|512|544|576|63448|480|512|544|576|64448|480|512|544|576|65448|480|512|544|576|66448|480|512|544|576|67448|480|512|544|576|68448|480|512|544|576|69448|480|512|544|576|70448|480|512|544|576|71448|480|512|544|576|72448|480|512|544|576|73448|480|512|544|576|74448|480|512|544|576|75448|480|512|544|576|76448|480|512|544|576|77448|480|512|544|576|78448|480|512|544|576|79448|480|512|544|576|80448|480|512|544|576|81448|480|512|544|576|82448|480|512|544|576|83448|480|512|544|576|84448|480|512|544|576|85448|480|512|544|576|86448|480|512|544|576|87448|480|512|544|576|88448|480|512|544|576|89448|480|512|544|576|90448|480|512|544|576|91448|480|512|544|576|92448|480|512|544|576|93448|480|512|544|576|94448|480|512|544|576|95448|480|512|544|576|96448|480|512|544|576|97448|480|512|544|576|98448|480|512|544|576|99448|480|512|544|576|100448|480|512|544|576|101448|480|512|544|576|102448|480|512|544|576|103448|480|512|544|576|104448|480|512|544|576|105480|512|544|576|106480|512|544|576|107480|512|544|576|108480|512|544|576|109480|512|544|576|110480|512|544|576|111480|512|544|576|
but the following code seems to consistently create Av values from zoom 0 to zoom 110 but fails to produce up to 127 (i.e 128 if equating 0 to 1) no matter how much sleep is introduced.
I'm missing a trick or more here so would appreciate any comment / script improvement as fix:
Does it wait forever in the last repeat loop?
function sd_logzoom(msg)local logzoomname = "A/zoom_step_av_value.csv"logzoom = io.open(logzoomname,"a")if msg == 0 thenlogzoom:write(msg,"|") elselogzoom:write("\n",msg,"|")endlogzoom:close()end--[[use erase button to select Av adjustment prior to runallow 3 secs for zoom to retract if start is at maximum ]]--if get_nd_present() == 1 thenset_zoom(0)sleep(3000)for i = 0, get_zoom_steps(), 1 do sd_logzoom(i) --[[ for each zoom step initialise the aperture at the largest available value. This procedure relies on sufficient sleep value to ensure the Jog Dial movement has activated ]] repeat initial_get_user_av_id = get_user_av_id() post_levent_to_ui("RotateJogDialLeft",1) sleep(300) new_get_user_av_id = get_user_av_id() until new_get_user_av_id == initial_get_user_av_id --[[ for each zoom step use JogDial right to step through and record all available Aperture values. This procedure relies on sufficient sleep value to ensure the Jog Dial movement has activated ]] logavname="A/zoom_step_av_value.csv" logav=io.open(logavname,"a") count_repeat = 1 repeat initial_get_user_av_id = get_user_av_id() logav:write(initial_get_user_av_id,"|") post_levent_to_ui("RotateJogDialRight",1) sleep(300) new_get_user_av_id = get_user_av_id() count_repeat = count_repeat + 1 until new_get_user_av_id == initial_get_user_av_id --pad out n/a entries if count_repeat == 7 then logav:write("|") end if count_repeat == 6 then logav:write("|","|") end if count_repeat == 5 then logav:write("|","|","|") end if count_repeat == 4 then logav:write("|","|","|","|") end --end padding logav:close() current_zoom_step = get_zoom() print("current_zoom_step = "..current_zoom_step) j = i + 1 set_zoom(j) repeat sleep(40) new_set_zoom = get_zoom() until new_set_zoom == j print("new_zoom_step = "..new_set_zoom) end--end
= <myfile.lua
Yes.Print statements now added at start and end of loop and chdkptp screenshot attached
PS: a new chdkptp win32.zip for download would be really handy at the minute to allow this http://chdk.setepontos.com/index.php?topic=6231.msg119292#msg119292Code: [Select]= <myfile.lua
The correct way to dealing with this will depend on the exact behavior.
function set_the_zoom(msg1)set_zoom(msg1)--allow 3 secs for zoom to retract if start is at maximum if msg1 == 0 thensleep(3000)endlocal cum_timelocal new_set_zoomlocal count_repeat = 1local sleep_time = 40local timeout = 5000 repeat sleep(sleep_time) cum_time = count_repeat * sleep_time print("approx_cum_time_awaiting_zoom_change = "..cum_time) count_repeat = count_repeat + 1 --original testing zoom "stuck" at i=110, this is dirty fix: if cum_time > timeout then set_zoom(0) sleep(3000) set_zoom(msg1) sleep(3000) end new_set_zoom = get_zoom() until new_set_zoom == msg1 print("new_zoom_step = "..new_set_zoom)endfunction sd_logzoom(msg2)local logzoomname = "A/zoom_step_av_value.csv"logzoom = io.open(logzoomname,"a")if msg2 == 0 thenlogzoom:write(msg2,"|") elselogzoom:write("\n",msg2,"|")endlogzoom:close()end--[[before running:use erase button to select Av adjustmentcopy empty file to "A/zoom_step_av_value.csv"]]--if get_nd_present() == 1 then-- since return get_zoom_steps() is 128, subtract 1:for i = 0, get_zoom_steps() - 1, 1 do set_the_zoom(i) sd_logzoom(i) --[[ for each zoom step initialise the aperture at the largest available value. This procedure relies on sufficient sleep value to ensure the Jog Dial movement has activated ]] repeat initial_get_user_av_id = get_user_av_id() post_levent_to_ui("RotateJogDialLeft",1) sleep(300) new_get_user_av_id = get_user_av_id() until new_get_user_av_id == initial_get_user_av_id --[[ for each zoom step use JogDial right to step through and record all available Aperture values. This procedure relies on sufficient sleep value to ensure the Jog Dial movement has activated ]] logavname="A/zoom_step_av_value.csv" logav=io.open(logavname,"a") av_count_repeat = 1 repeat initial_get_user_av_id = get_user_av_id() logav:write(initial_get_user_av_id,"|") post_levent_to_ui("RotateJogDialRight",1) sleep(300) new_get_user_av_id = get_user_av_id() av_count_repeat = av_count_repeat + 1 until new_get_user_av_id == initial_get_user_av_id --pad out n/a entries if av_count_repeat == 7 then logav:write("|") end if av_count_repeat == 6 then logav:write("|","|") end if av_count_repeat == 5 then logav:write("|","|","|") end if av_count_repeat == 4 then logav:write("|","|","|","|") end --end padding logav:close() end--end
0|347|384|416|448|480|512|544|576|1|347|384|416|448|480|512|544|576|2|347|384|416|448|480|512|544|576|3|347|384|416|448|480|512|544|576|4|347|384|416|448|480|512|544|576|5|347|384|416|448|480|512|544|576|6|347|384|416|448|480|512|544|576|7|347|384|416|448|480|512|544|576|8|347|384|416|448|480|512|544|576|9|347|384|416|448|480|512|544|576|10|347|384|416|448|480|512|544|576|11|347|384|416|448|480|512|544|576|12|384|416|448|480|512|544|576|13|384|416|448|480|512|544|576|14|384|416|448|480|512|544|576|15|384|416|448|480|512|544|576|16|384|416|448|480|512|544|576|17|384|416|448|480|512|544|576|18|384|416|448|480|512|544|576|19|384|416|448|480|512|544|576|20|384|416|448|480|512|544|576|21|384|416|448|480|512|544|576|22|384|416|448|480|512|544|576|23|384|416|448|480|512|544|576|24|384|416|448|480|512|544|576|25|384|416|448|480|512|544|576|26|384|416|448|480|512|544|576|27|384|416|448|480|512|544|576|28|384|416|448|480|512|544|576|29|384|416|448|480|512|544|576|30|384|416|448|480|512|544|576|31|416|448|480|512|544|576||32|416|448|480|512|544|576||33|416|448|480|512|544|576||34|416|448|480|512|544|576||35|416|448|480|512|544|576||36|416|448|480|512|544|576||37|416|448|480|512|544|576||38|416|448|480|512|544|576||39|416|448|480|512|544|576||40|416|448|480|512|544|576||41|416|448|480|512|544|576||42|416|448|480|512|544|576||43|416|448|480|512|544|576||44|416|448|480|512|544|576||45|416|448|480|512|544|576||46|416|448|480|512|544|576||47|416|448|480|512|544|576||48|416|448|480|512|544|576||49|416|448|480|512|544|576||50|416|448|480|512|544|576||51|416|448|480|512|544|576||52|448|480|512|544|576|||53|448|480|512|544|576|||54|448|480|512|544|576|||55|448|480|512|544|576|||56|448|480|512|544|576|||57|448|480|512|544|576|||58|448|480|512|544|576|||59|448|480|512|544|576|||60|448|480|512|544|576|||61|448|480|512|544|576|||62|448|480|512|544|576|||63|448|480|512|544|576|||64|448|480|512|544|576|||65|448|480|512|544|576|||66|448|480|512|544|576|||67|448|480|512|544|576|||68|448|480|512|544|576|||69|448|480|512|544|576|||70|448|480|512|544|576|||71|448|480|512|544|576|||72|448|480|512|544|576|||73|448|480|512|544|576|||74|448|480|512|544|576|||75|448|480|512|544|576|||76|448|480|512|544|576|||77|448|480|512|544|576|||78|448|480|512|544|576|||79|448|480|512|544|576|||80|448|480|512|544|576|||81|448|480|512|544|576|||82|448|480|512|544|576|||83|448|480|512|544|576|||84|448|480|512|544|576|||85|448|480|512|544|576|||86|448|480|512|544|576|||87|448|480|512|544|576|||88|448|480|512|544|576|||89|448|480|512|544|576|||90|448|480|512|544|576|||91|448|480|512|544|576|||92|448|480|512|544|576|||93|448|480|512|544|576|||94|448|480|512|544|576|||95|448|480|512|544|576|||96|448|480|512|544|576|||97|448|480|512|544|576|||98|448|480|512|544|576|||99|448|480|512|544|576|||100|448|480|512|544|576|||101|448|480|512|544|576|||102|448|480|512|544|576|||103|448|480|512|544|576|||104|480|512|544|576||||105|480|512|544|576||||106|480|512|544|576||||107|480|512|544|576||||108|480|512|544|576||||109|480|512|544|576||||110|480|512|544|576||||111|480|512|544|576||||112|480|512|544|576||||113|480|512|544|576||||114|480|512|544|576||||115|480|512|544|576||||116|480|512|544|576||||117|480|512|544|576||||118|480|512|544|576||||119|480|512|544|576||||120|480|512|544|576||||121|480|512|544|576||||122|480|512|544|576||||123|480|512|544|576||||124|480|512|544|576||||125|480|512|544|576||||126|480|512|544|576||||127|480|512|544|576||||
I'm pretty sure I've seen get_zoom returning slightly different values than expected. I think in the case I saw it changed after half press, but I may be misremembering.
Started by Mike9rz Script Writing
Started by andyroo Firmware Dumping
Started by Karmaschinken Script Writing
Started by koshy « 1 2 3 4 5 » General Discussion and Assistance