Skip to content

Instantly share code, notes, and snippets.

@pigeonhill
Last active December 18, 2019 20:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pigeonhill/4efb0fdde3f4cc710dd1f7097ec0f821 to your computer and use it in GitHub Desktop.
Save pigeonhill/4efb0fdde3f4cc710dd1f7097ec0f821 to your computer and use it in GitHub Desktop.
LE Simulator
--[[
LE Sim
SET UP:
Set Canon movie mode to 1920; Set ML FPS overrride to 1 (adjust later); Remember the shutter speed you set
Start in LV mode or not
Set duration of LE simulation in ML Bulb timer (note switched off)
Start in photo mode, ie not video mode
Follow script's LV prompts
Script will provide the option of taking an advanced bracket set after the MLV is captured (ensure Advanced Bracketing is setup to your needs, but set OFF)
See additional notes below in the body of the script and at photography.grayheron.net
Tested on a 5D3
Release 0.851
Dec 2019
Copyleft: Garry George 2019
--]]
require("keys")
function keys:pause4key(keypressed,message,sec)
--[[
Blocks until one or more specific keys are pressed.
Note Full and Half shutters not blocked
Keypressed is a list of keys, eg {KEY.SET, KEY.MENU...} that are hyjacked but remain active
There must be at least one keypressed in the function's call, but message and sec can be left out
All other keys, other than full, half shutter presses, are hyjacked and not active
Message is displayed for sec seconds, or continuously if 0
Adapted from ML Lua Keys Module
]]
local started = keys:start()
--ignore any immediate keys
task.yield(100)
keys:reset()
if message ~= nil then
if sec ~= nil then
display.print(message,10,50,FONT.LARGE,COLOR.WHITE,COLOR.TRANSPARENT_BLACK)
end
end
local key = 0
local finish = false
local time = dryos.ms_clock
sec = sec*1000
while true do
key = keys:getkey()
keys.last_key = key
if ((dryos.ms_clock - time) > sec) and (sec ~= 0) then display.print(message,10,50,FONT.LARGE,COLOR.TRANSPARENT,COLOR.TRANSPARENT) end
if key ~= nil then
for i = 1, #keypressed
do
if key == keypressed[i] then
finish = true
break
end
end
display.print(message,10,50,FONT.LARGE,COLOR.WHITE,COLOR.TRANSPARENT_BLACK)
end
if finish then break end
task.yield(100)
end
display.print(message,10,50,FONT.LARGE,COLOR.TRANSPARENT,COLOR.TRANSPARENT)
if started then keys:stop() end
return key -- key pressed
end
function done(expt)
menu.set("Movie","Crop mode","OFF")
menu.set("Movie","RAW video","OFF")
menu.set("Movie","FPS override","OFF")
while camera.mode == MODE.MOVIE do
display.print("\n\n".."Disable MOVIE mode",10,50,FONT.LARGE,COLOR.WHITE,COLOR.TRANSPARENT_BLACK)
msleep(1000)
end
display.print("\n\n".."Disable MOVIE mode",10,50,FONT.LARGE,COLOR.TRANSPARENT,COLOR.TRANSPARENT)
camera.shutter.value = expt
lv.start()
end
local expt = camera.shutter.value
menu.close()
camera.gui.mode = 0
-- check shutter
if expt > 5 or expt < 0.15 then
display.print("\n\n".."Adjust exposure, then rerun script",10,50,FONT.LARGE,COLOR.WHITE,COLOR.TRANSPARENT_BLACK)
msleep(2000)
display.print("\n\n".."Adjust exposure, then rerun script",10,50,FONT.LARGE,COLOR.TRANSPARENT,COLOR.TRANSPARENT)
return
end
while not lv.running do
display.print("\n\n".."Switch on LV",10,50,FONT.LARGE,COLOR.WHITE,COLOR.TRANSPARENT_BLACK)
msleep(1000)
end
display.print("\n\n".."Switch on LV",10,50,FONT.LARGE,COLOR.TRANSPARENT,COLOR.TRANSPARENT)
while lv.overlays ~= 2 do
display.print("\n\n".."Press INFO to get to ML overlays",10,50,FONT.LARGE,COLOR.WHITE,COLOR.TRANSPARENT_BLACK)
msleep(1000)
end
display.print("\n\n".."Press INFO to get to ML overlays",10,50,FONT.LARGE,COLOR.TRANSPARENT,COLOR.TRANSPARENT)
menu.set("Movie","Crop mode","Full-res LiveView")
menu.set("Movie","RAW video","ON")
local step = 0
while menu.get("RAW video","Resolution"):sub(1,1) ~= "5" do
menu.open()
menu.close()
step = step + 1
if step > 5 then
display.print("\n\n".."Can't run script",10,50,FONT.LARGE,COLOR.WHITE,COLOR.TRANSPARENT_BLACK)
msleep(2000)
display.print("\n\n".."Can't run script",10,50,FONT.LARGE,COLOR.TRANSPARENT,COLOR.TRANSPARENT)
menu.set("Movie","Crop mode","OFF")
menu.set("Movie","RAW video","OFF")
menu.set("Movie","FPS override","OFF")
return end
task.yield(1000)
end
while camera.mode ~= MODE.MOVIE do
display.print("\n\n".."Enable MOVIE mode",10,50,FONT.LARGE,COLOR.WHITE,COLOR.TRANSPARENT_BLACK)
msleep(1000)
end
display.print("\n\n".."Enable MOVIE mode",10,50,FONT.LARGE,COLOR.TRANSPARENT,COLOR.TRANSPARENT)
menu.open()
menu.select("Movie","FPS override")
key.press(KEY.SET)
msleep(1000)
local frames = 0
while menu.visible do
msleep(100)
local step = 0
repeat
step = tonumber(menu.get("FPS override","Actual FPS",""))
msleep(100)
until step ~= nil
step = menu.get("Bulb Timer","Exposure duration",0)*step
frames, step = math.modf(step)
display.print("\n\n\n\n".."Check settings then press TRASH".."\n".."Number of frames = "..frames,10,50,FONT.LARGE,COLOR.WHITE,COLOR.BLACK)
end
display.print("\n\n\n\n".."Check settings then press TRASH".."\n".."Number of frames = "..frames,10,50,FONT.LARGE,COLOR.TRANSPARENT,COLOR.TRANSPARENT)
--***********************************************************************************************************
-- At this point the script will pause and you need to finish the set up manually from the Movie screen
-- Switch on and adjust FPS Override, plus check shutter speed (from ML Expo menu or LV), and check card recording ability under Crop mode ML menu
-- Ideally recording should be continuous, but you may get away with less for a short LE
-- Once you are content with the set up, press the Trash button to exit the ML menu (you can reenter ML Menus if you wish)
-- Wait for the screen to stabilise and show the scene. If it doesn't press the Canon Menu on and off to refresh things
-- Once you are ready, press MENU to take a LE or INFO to exit the script
-- Follow instructions and if you don't see any, do a half shutter press
--***********************************************************************************************************
local text = "\n\n".."Press [MENU] to run or [INFO] to exit"
local test = keys:pause4key({KEY.MENU,KEY.INFO},text,0)
if test == KEY.INFO then done(expt) return end
msleep(1000)
movie.start()
for i = 0, menu.get("Bulb Timer","Exposure duration",0), 1 do task.yield(1000) end
movie.stop()
msleep(1000)
done(expt)
text = "\n\n".."Press [MENU] to continue or [INFO] to exit"
test = keys:pause4key({KEY.MENU,KEY.INFO},text,0)
if test == KEY.INFO then
display.print("\n\n".."Script terminating",10,50,FONT.LARGE,COLOR.WHITE,COLOR.TRANSPARENT_BLACK)
msleep(2000)
display.print("\n\n".."Script terminating",10,50,FONT.LARGE,COLOR.TRANSPARENT,COLOR.TRANSPARENT)
return end
-- If continue selected script will now give you the option of taking any number of Advanced Bracket sets
-- Recommend ABing be in +/- Auto mode
-- Press INFO to end the script
menu.set("Shoot","Advanced Bracket",1) -- but note you need to explicitly set the advanced bracketing up
test = menu.get("Expo","Auto ETTR","") -- remember ETTR state
menu.set("Expo","Auto ETTR","OFF")
text = "\n\n".."Full press to take advanced bracket set".."\n".."Press INFO to end script"
step = keys:pause4key({KEY.INFO},text,0) -- final step, take an advanced bracket set if you wish
display.print("\n\n".."Script terminating",10,50,FONT.LARGE,COLOR.WHITE,COLOR.TRANSPARENT_BLACK)
msleep(2000)
display.print("\n\n".."Script terminating",10,50,FONT.LARGE,COLOR.TRANSPARENT,COLOR.TRANSPARENT)
menu.set("Shoot","Advanced Bracket",0)
menu.set("Expo","Auto ETTR",test)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment