Simulate the halfshutter button every 16 seconds

Started by clubsoda, January 11, 2020, 01:00:39 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

clubsoda

Hello :)

I try to write a lua script that will simulate a halfshutter button press every 16 seconds (infinite loop) while the camera (6d) is turned on.
The reason for that is that i want the lightmeter to stay on in video mode. It is turning of after 16 seconds. I want to use it all the time so i tried to write a lua script.

Now comes the problem. I am a scripting noob  :'(

This is my script right now but it is not working as expected because nothing actually happens after the camera has loaded it (at least that works):


-- AutoHalfShutter by clubsoda
-- Simulates the HalfShutter button every 16 seconds

function autohalfshutter()
    while( true )
    do
       key.press(KEY.HALFSHUTTER)
       sleep(16)
    end
end




I hope someone could help me out and tell me what is wrong or even help me writing a working script for my problem.

PS: I know of the sticky shutter feature but it sadly interfers with my workflow

THX in advance :)

Danne

Usually you need to unpress the halfshutter again after it has been pressed or it is always gonna be set:
key.press(KEY.UNPRESS_HALFSHUTTER)

So maybe a msleep between them will help.

I did some lua here, maybe useful in your context. Some are very basic ones:
https://bitbucket.org/Dannephoto/lua_magic/src/default/

Recently working a lot on this:
https://bitbucket.org/Dannephoto/lua_magic/src/default/tlapse.lua

clubsoda

Thank you very much for your answer. I tried to change some things but it still doesn't work.

This is my code right now:



-- AutoHalfShutter by clubsoda
-- Simulates the HalfShutter button every 16 seconds

console.hide()
  menu.close()

-- warnings
while camera.mode == MODE.MOVIE do
  display.notify_box("AutoHalfShutter now")
  key.press(KEY.HALFSHUTTER)
  msleep(1000)
  key.press(KEY.UNPRESS_HALFSHUTTER)
  msleep(15000)
end




Loop cycle works an the message AutoHalfShutter now appears exactly every 16 seconds but half shutter isn't doing anything :( I am on the latest build for the canon 6d

Danne

So you need to take some time and learn more lua imo. Good luck.

clubsoda

Somehow got it working  :D If anyone wants it here you go. Don't forget to enable autostart.



-- AutoHS by clubsoda
-- Simulates the HalfShutter button and enables Light Meter

console.hide()

if lv.enabled == false then
lv.start()
end

while true do
  while camera.mode == MODE.MOVIE do
    while lv.enabled == true do
      while movie.recording == true do
        -- display.notify_box("AutoHalfShutter now")
        key.press(KEY.HALFSHUTTER)
        msleep(100)
        key.press(KEY.UNPRESS_HALFSHUTTER)
        msleep(15900)
      end

      while menu.visible == true do
        -- nothing
      end

      -- display.notify_box("AutoHalfShutter now")
      key.press(KEY.HALFSHUTTER)
      msleep(100)
      key.press(KEY.UNPRESS_HALFSHUTTER)
      msleep(15900)
    end
  end
end




The only thing that bugs me is that it won't work in the third live view mode (press info 2 times) where the image is the biggest :'(. For it to activate there you have to keep halfshutter pressed which will interfer if you try to change anything like whitebalance or iso which is behind a button or menu as the halfshutter button blocks every other input. Tried the whole day to write a workaround for that with a script that deactivates the halfshutter when an other button is pressed but i gave up in the end... whatever it works much better now. So i have to thank this wonderful community that makes these improvements possible in the first place :)