All Zoom / get_user_av_id table

I'm trying to get the entire zoom step / get_user_av_id table using sx150is-100a-1.4.0-r4153.

The camera only has adjustable aperture I believe (get_nd_present() => 0).

I haven't much converted this to functions yet, 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.

If I restart the script, making other relevant changes, set_zoom = 111 it seems to append the last entries in the log fine.

I'm missing a trick or more here so would appreciate any comment / script improvement as fix:

Print statements now added at start and end of loop and chdkptp screenshot attached

So, after the final set_zoom, the either get_zoom isn't correctly reporting the change, or the zoom doesn't get set to exactly the requested value.

I'd suspect the second case. If this is happening, you need to update your logic to account for it, perhaps by putting a timeout in the loop that waits for the zoom change. The correct way to dealing with this will depend on the exact behavior. For example, when set_zoom(112) is called, does the zoom not change at all, or does it go past the requested value? If it isn't changing at all, what happens if you just continue and call set_zoom(113)

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.

The correct way to dealing with this will depend on the exact behavior.

Ah, of course - silly me.

This is v.inelegant, leaves most/all questions open - but works for now. On timeout I zoomed back to zero then back out to the sticking point. I still need to understand var scope better so that is not pretty either but must suffice for a first lua script:

set_the_zoom(i)sd_logzoom(i)--[[for each zoom step initialise the aperture at the largest available value. This procedurerelies on sufficient sleep value to ensure theJog Dial movement has activated ]]