Still struggling :-( - Script Writing - CHDK Forum supplierdeeply

Still struggling :-(

  • 7 Replies
  • 321 Views
Still struggling :-(
« on: 26 / April / 2022, 12:44:34 »
Advertisements
@reyalp

I'm still confused and/or I've forgotten what you have previosly told me ;-)

Here is a snippet of code I'm trying to sort out:

Code: [Select]

...

function myshoot()
    local prevcnt = hook_shoot.count()
    local rawprevcnt = hook_raw.count()
    press 'shoot_full_only'
    repeat sleep(10) until prevcnt ~= hook_shoot.count()
    release 'shoot_full_only'
    repeat sleep(10) until rawprevcnt ~= hook_raw.count()
end

function snap() -- single image capture
    press("shoot_half")
    repeat sleep(10) until (get_shooting())
        myshoot()
    release("shoot_half")
    repeat sleep(10) until (not get_shooting())
end

if is_key("shoot_full") then -- taking a single image with the Canon shutter button, plus check if a sky bracket requested
        local iso = get_iso_mode()
        local  tv = get_prop(props.TV)
        ecnt = get_exp_count()
        sleep(sleep_time*1000)
        snap()
        repeat sleep(10) until (get_exp_count() ~= ecnt)
        if sky == 6 then -- take an auto ETTR exposure bracket for the sky
            set_iso_mode(100) -- set ISO 100 for the sky
            ecnt = get_exp_count()
            set_ETTR()
            snap()
            repeat sleep(10) until (get_exp_count() ~= ecnt)
            set_iso_mode(iso)
            set_prop(props.TV,tv)
        elseif sky > 0 then -- take a single exposure shot for the sky
            ecnt = get_exp_count()
            set_tv96_direct(s + 96*(sky+1))
            snap()
            repeat sleep(10) until (get_exp_count() ~= ecnt)
            set_iso_mode(iso)
            set_prop(props.TV,tv)
        end
       
        last_image_ndof = ndof
        last_image_fdof = fdof
        last_image_x = x
        last_image_u = u
        image = true
        dirty = true
    elseif etc etc ...


No matter what I do, I can reset ISO to the local iso, but the shutter value will not reset to the local tv value. That is when the code has run the Canon side ISO is reported appropriately, bu the shutter value remains at the last image value.

Is this to be expected? Or is my coding 'wrong'?

Cheers

Garry

*

Offline reyalp

  • ******
  • 13792
Re: Still struggling :-(
« Reply #1 on: 26 / April / 2022, 13:01:58 »
No matter what I do, I can reset ISO to the local iso, but the shutter value will not reset to the local tv value. That is when the code has run the Canon side ISO is reported appropriately, bu the shutter value remains at the last image value.
What shutter value are you referring to that doesn't get reset? Something shown in the Canon UI? The value of the prop? What Canon shooting mode are you using?

In general, the TV prop is updated by the Canon firmware on half press, so setting it outside of half press is not meaningful.
Don't forget what the H stands for.

Re: Still struggling :-(
« Reply #2 on: 26 / April / 2022, 13:05:08 »
I’m in M mode and I’m referring to the script resetting the Canon reported shutter time and hence the exposure.


Do you recommend I need a few more lines to get the Canon side to reset itself? 


If you do, could you suggest a few lines that I’m missing ;-)

*

Offline reyalp

  • ******
  • 13792
Re: Still struggling :-(
« Reply #3 on: 26 / April / 2022, 13:28:12 »
I’m in M mode and I’m referring to the script resetting the Canon reported shutter time and hence the exposure.
FWIW, "Canon reported shutter time" and what is actually used by the camera are not necessarily the same thing once you've started messing with propcases and overrides.

If you are using M mode (or any mode where the Canon UI allows a user-specified Tv), I'd suggest setting the USER_TV propcase, outside of half press. That should be equivalent to setting the shutter in the Canon UI, although the value displayed in the Canon UI itself may not update immediately. When using USER_TV in these modes, you should not need to change the TV prop, or use set_tv* calls.

Similarly, if you want to read the user specified value from the Canon firmware, you should read USER_TV rather than TV.
Don't forget what the H stands for.


Re: Still struggling :-(
« Reply #4 on: 26 / April / 2022, 14:08:18 »
@reyalp


Many thanks I’ll look into that approach.


BTW where do I find the M3 Digic 6 prop values, eg for USER_TV

*

Offline reyalp

  • ******
  • 13792
Re: Still struggling :-(
« Reply #5 on: 26 / April / 2022, 14:13:11 »
BTW where do I find the M3 Digic 6 prop values, eg for USER_TV
If you are using propcase.lua you should just be able to use props.USER_TV like you used props.TV

If for some reason you want the numeric ID, just look at the propsetN.h in the CHDK source or propsetN.lua in CHDK/LUALIB/GEN for the propset of your camera (M3 is propset 9)
Don't forget what the H stands for.

Re: Still struggling :-(
« Reply #6 on: 26 / April / 2022, 14:18:28 »
Cheers

Re: Still struggling :-(
« Reply #7 on: 26 / April / 2022, 14:45:29 »
@reyalp

Many thanks: that did it  :D

I'm embarrased to say, despite being able to write a script with over 1100 lines, I still let myself down with not knowing some CHDK Lua basics  :o

I'm glad you're there  ;)

Cheers

Garry


 

Related Topics