Skip to content

Instantly share code, notes, and snippets.

@pigeonhill
Last active June 7, 2017 12:38
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/f0875a4298a3bf83b903add20e905b19 to your computer and use it in GitHub Desktop.
Save pigeonhill/f0875a4298a3bf83b903add20e905b19 to your computer and use it in GitHub Desktop.
--[[
Bulb ND Script V1
Release 0.1
Jan 2017
Simply takes an ND image using the currently set shutter value, but assumes an ND filter is fitted.
To use:
1. Compose and set shutter WITHOUT the ND filter fitted
2. Set ND values in menu and delay (in LV delay is automatically 3s)
3. Press SET to intiate script
4. Fit ND filter
5. Run script by doing a half shutter press
Pushing any button, other than the halfshutter, clears the script, ie you will need to renter the menu to rerun
*******************************************************************************************************
* *
* If you reference this script, please consider acknowledging me at http://photography.grayheron.net/ *
* *
*******************************************************************************************************
--]]
temp = 0
ND_shutter = 0
function my_shoot()
if ND_shutter > 30 then
camera.bulb(ND_shutter)
else
camera.shutter.ms = ND_shutter*1000
camera.shoot(false) -- Note may need to change to camera.shoot(64,false) on some Lua builds
end
end
function run_script()
menu.close() -- just in case
local save_current_shutter = camera.shutter.apex
ND_shutter = camera.shutter.apex - scriptmenu.submenu["ND Full Stop Value?"].value - scriptmenu.submenu["ND Fractional value?"].value/10
msleep(scriptmenu.submenu["Delay?"].value * 1000)
ND_shutter = 2^(-ND_shutter) -- convert to seconds
my_shoot()
camera.shutter.apex = save_current_shutter -- reset to non ND shutter value
end
function mytest(key)
if key == KEY.HALFSHUTTER then
run_script()
event.keypress = nil
return false
else
event.keypress = nil
return true
end
end
function start()
menu.close() -- just in case
if scriptmenu.submenu["ND Full Stop Value?"].value ~= 0 then
event.keypress = mytest -- set up keypress handler
end
end
scriptmenu = menu.new
{
parent = "Shoot", -- change this to position the script into other ML menu locations
name = "Bulb ND",
help = "Set shutter without ND fitted",
submenu =
{
{
name = "Run Script",
select = function(this)
if key.last == KEY.SET then task.create(start) end
end,
help = "Runs the main script after pressing SET",
help2 = "Now fit ND and press halfshutter",
},
{
name = "ND Full Stop Value?",
help = "In stops",
min = 0,
max = 16,
value = 0,
warning = function(this)
temp = camera.shutter.apex - scriptmenu.submenu["ND Full Stop Value?"].value - scriptmenu.submenu["ND Fractional value?"].value/10
temp = math.ceil((2^(-temp))*1000)/1000
if temp > 30 then temp = math.ceil(temp) end
return "ND Shutter (s): ".. tostring(temp)
end,
},
{
name = "ND Fractional value?",
help = "In tenths",
min = 0,
max = 9,
value = 0,
warning = function(this)
temp = camera.shutter.apex - scriptmenu.submenu["ND Full Stop Value?"].value - scriptmenu.submenu["ND Fractional value?"].value/10
temp = math.floor((2^(-temp))*1000)/1000
if temp > 30 then temp = math.floor(temp) end
return "ND Shutter (s): ".. tostring(temp)
end,
},
{
name = "Delay?",
help = "In seconds",
min = 0,
max = 5,
value = 0,
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment