Toggling the back light off/on - Plus Continuous Shooter script - LUA Scripting - CHDK Forum

Toggling the back light off/on - Plus Continuous Shooter script

  • 1 Replies
  • 1649 Views
*

Offline lapser

  • *****
  • 1093
Toggling the back light off/on - Plus Continuous Shooter script
« on: 19 / November / 2012, 00:33:56 »
Advertisements
set_backlight(0) turns off the backlight. Unfortunately, the camera keeps turning it back on with every picture.

My solution is to replace all calls to sleep(time) with calls to sleeper(time). Then, pressing the "set" button will toggle the backlight off and on. Pressing the "menu" key sets a variable "doexit" true, which can be used to exit the main loop.

This script demonstrates the sleeper(time) function. It simply holds the "shoot_full" button down. If you put the camera in continuous drive mode, and set the full manual exposure and manual focus before starting the script, you have the fastest time lapse program possible. It should be useful for taking continuous long exposures at night with dark frame off for capturing meteors. Be sure to turn off "safety manual focus" in the Canon record menu, and set the review time to 0.

You can run the script in auto exposure and focus mode. It will set the exposure/focus on the first picture, and hold these values for the entire sequence. There's also a continuous drive option with focusing for each shot on my sx260.

Code: (lua) [Select]
--[[
@title Continuous Shooter
--]]
function restore()
  set_backlight(1)
  release("shoot_full")
end

-- sleeper starts here
  setd=false --   true=set button down
  bldark=false -- true=backlight off
  doexit=false -- true=pressed menu button
function sleeper(stime)
  etime=get_tick_count()+stime -- end tick time
  repeat
    if(is_pressed("menu"))then doexit=true end-- menu press used to exit script
    if(doexit)then
      sleep(20) -- return with short delay for a quicker script exit
      return
    end
    if(setd~=is_pressed("set"))then -- set button toggled
      setd=not setd
      if(setd) then
        if(bldark)then set_backlight(1) end -- turn on light once
        bldark=not bldark -- true if light on
      end
    end
    if(bldark)then set_backlight(0) end -- turn off light repeatedly
    if(stime>=50)then sleep(20) end
    stime=etime-get_tick_count()
  until(stime<50)
  if(stime>0)then sleep(stime) end
end

press("shoot_full")
repeat
  sleeper(60000)
until doexit
restore()
I saved this file with the name "CShooter.lua" (see below)
« Last Edit: 19 / November / 2012, 12:43:09 by lapser »
EOS-M3_120f / SX50_100b / SX260_101a / G1X_100g / D20_100b
https://www.youtube.com/user/DrLapser/videos

*

Offline lapser

  • *****
  • 1093
Re: Toggling the back light off/on - Plus Continuous Shooter script
« Reply #1 on: 19 / November / 2012, 12:40:16 »
I've attached the CShooter.lua file below for downloading.

I also made a minor correction to the sleeper() function to make the script exit faster after pressing menu. Here's the sleeper function you can use in other scripts:
Code: (lua) [Select]
-- sleeper starts here
  setd=false --   true=set button down
  bldark=false -- true=backlight off
  doexit=false -- true=pressed menu button
function sleeper(stime)
  etime=get_tick_count()+stime -- end tick time
  repeat
    if(is_pressed("menu"))then doexit=true end-- menu press used to exit script
    if(doexit)then
      sleep(20) -- return with short delay for a quicker script exit
      return
    end
    if(setd~=is_pressed("set"))then -- set button toggled
      setd=not setd
      if(setd) then
        if(bldark)then set_backlight(1) end -- turn on light once
        bldark=not bldark -- true if light on
      end
    end
    if(bldark)then set_backlight(0) end -- turn off light repeatedly
    if(stime>=50)then sleep(20) end
    stime=etime-get_tick_count()
  until(stime<50)
  if(stime>0)then sleep(stime) end
end
EOS-M3_120f / SX50_100b / SX260_101a / G1X_100g / D20_100b
https://www.youtube.com/user/DrLapser/videos

 

Related Topics