Author Topic: Waiting until canon values have stabilized  (Read 604 times)

Manni88

  • Just arrived
  • *
  • Posts: 1
Waiting until canon values have stabilized
« on: January 19, 2020, 02:13:23 AM »
Hello together,
I'm very new to LUE scripting and I wanted to do some scripting based on the ISO values selected in my camera.

Therefore I wrote the following LUA code:

Code: [Select]
require("config")

function iso_mode_handler(self,value)

    new_ISOvalue = camera.iso.raw

    --- placeholder for further code
    --- camera.iso.raw = setting new iso value
   
    console.show()
    print ("DEBUG"..new_ISOvalue)
end

dostuffoniso_menu = menu.new
{
    parent = "Expo",
    name = "ISO action",
    help = "Do stuff based on ISO values",
    choices = {"OFF","ON"},
    value = "OFF"
}

function dostuffoniso_menu:select(delta)
    if     self.value == "OFF" then self.value = "ON"
    elseif self.value == "ON"  then self.value = "OFF"
    dostuffoniso_update(self.value)
end

function dostuffoniso_update(value)
    if value == "ON" then
        property.ISO.handler = iso_mode_handler
    else
        property.ISO.handler = nil
    end
end

config.create_from_menu(dostuffoniso_menu)
dostuffoniso_update(dostuffoniso_menu.value)

Beside ohter things I want to set new ISO values in the function iso_mode_handler but stumbled over the following problem:
Canon ISO property seem to change erraticly if the ISO is selected via the camera wheel very fast.
Now I would like to wait until the values are settled down, and then call the handler to do some action. Currently the handler is called straight away when ISO changes, but in the meanwhile ISO could have changed again and the function is using the wrong, older value.

Can someone help me with this?
Thanks, Manni