Some time ago David M wrote a ND_Bulb module, but it never got into the nightlies

Although I have the module, it now seems to interact with the latest builds I am using, ie the toggle runs all over the place. I have thus had to 'give up' David's module...until now.

The attached is a simple script I have written to 'emulate' David's module, at least for taking ND images.
It is pretty self explanatory, ie set the camera up without the filter on, put the filter on and run the script.
Note, because we have several Lua builds out there, you may need to adjust the script, ie to account for camera.shoot formating.
As usual, I value any feedback.
Cheers
Garry
--[[
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,
}
}
}