Get exposure values: what is the best practice - Script Writing - CHDK Forum

Get exposure values: what is the best practice

  • 2 Replies
  • 668 Views
Get exposure values: what is the best practice
« on: 19 / April / 2021, 04:58:22 »
Advertisements
On a couple of occasions I've noticed Lua scripts I've written not pick up on the in-coming exposure values.

My general approach is to read the shutter and aperture, then switch to manual mode when my script is running; then back to the original mode on exit. For example: Av mode at f/8 and whatever the Av mode chooses as the shutter, say, 1/60.

The question is: what is the best way to initiate the script, ie to ensure it starts with the current exposure values?

Is it just:
Code: [Select]
s = get_tv96()
av = get_av96()

Or is this better:
Code: [Select]
s = get_prop(props.TV)
av = get_prop(props.AV)

Can I use 'just' the above, or should I use a half shutter press sequence somewhere, eg:
Code: [Select]
press("shoot_half")
repeat sleep(10) until get_shooting()
release("shoot_half")
repeat sleep(10) until (not get_shooting())

I would really value a CHDK guru throwing some wisdom my way, eg best practice when registering exposure at the the start of a script, and even when changing exposure when the script is running, eg should I use the half shutter press, and when/where?
« Last Edit: 19 / April / 2021, 05:18:02 by pigeonhill »

*

Offline reyalp

  • ******
  • 13440
Re: Get exposure values: what is the best practice
« Reply #1 on: 19 / April / 2021, 12:51:55 »
On a couple of occasions I've noticed Lua scripts I've written not pick up on the in-coming Is it just:
Code: [Select]
s = get_tv96()
av = get_av96()

Or is this better:
Code: [Select]
s = get_prop(props.TV)
av = get_prop(props.AV)
These should be completely equivalent.

Quote
Can I use 'just' the above, or should I use a half shutter press sequence somewhere, eg:
Code: [Select]
press("shoot_half")
repeat sleep(10) until get_shooting()
release("shoot_half")
repeat sleep(10) until (not get_shooting())
The TV and AV propcase values update when get_shooting becomes true (this is also the point when CHDK overrides are normally applied). They should remain unchanged (assuming you don't change them from CHDK) until the next half press.

So if you want to know the values the camera would use from auto-exposure, you can read them any time after get_shooting becomes true, before or after releasing half press.

Modes that have manual control in the firmware (M, Tv, Av, "Long shutter") have additional propcases: USER_TV and and USER_AV. These reflect the values set in the UI, and update immediately when the UI is changed. Setting them from script is equivalent to setting them in the UI (although the value may not appear in the UI)
In the modes that use these USER_ props, the values are transferred from the USER props to the normal ones in half shoot.
Don't forget what the H stands for.

Re: Get exposure values: what is the best practice
« Reply #2 on: 19 / April / 2021, 14:02:22 »
@reyalp

Many thanks.


 

Related Topics