Skip to content

Instantly share code, notes, and snippets.

@pigeonhill
Last active October 8, 2019 20:07
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/96ac84ea5f1435b056120b4d03884425 to your computer and use it in GitHub Desktop.
Save pigeonhill/96ac84ea5f1435b056120b4d03884425 to your computer and use it in GitHub Desktop.
Hand Held Bracketing Script
--[[
HHBS
Hand Held Bracketing Script for WA lenses
Version 1.365
Garry George Oct 2019
http://photography.grayheron.net/
--]]
CON = "ON"
COFF = "OFF"
run = false
switched_off = false
min_tv = 0
base_tv = camera.shutter.apex
delay = 0
timer = 0
ev_lift = 0
choices0 = {COFF,CON}
choices1 = {"Float","800","1600","3200"}
AB_running = false
end_count = 0
half_press_dalay = 3000
ab_m = {}
last_key = 0
require("config")
function run_script(m)
if AB_running and (not switched_off) then
if dryos.shooting_card.file_number == end_count then -- switch off AB and reset AB settings
AB_running = false
menu.set("Shoot","Advanced Bracket",0)
menu.set("Advanced Bracket","Bracket type",ab_m[1])
menu.set("Advanced Bracket","Frames",ab_m[2])
menu.set("Advanced Bracket","Sequence",ab_m[3])
menu.set("Advanced Bracket","2-second delay",ab_m[4])
menu.set("Advanced Bracket","ISO shifting",ab_m[5])
menu.set("Advanced Bracket","EV increment",ab_m[6])
end
end
if switched_off then return true end
if run then
base_tv = camera.shutter.apex
sleep(delay)
run = false
min_tv = (menu.get("Auto ETTR","Slowest shutter",0) - 56.0)/8.0
-- set up advanced bracketing for HHBS. Note the script switches AB off after bracketing
ab_m[1] = menu.get("Advanced Bracket","Bracket type",0)
ab_m[2] = menu.get("Advanced Bracket","Frames",2)
ab_m[3] = menu.get("Advanced Bracket","Sequence",2)
ab_m[4] = menu.get("Advanced Bracket","2-second delay",0)
ab_m[5] = menu.get("Advanced Bracket","ISO shifting",1)
ab_m[6] = menu.get("Advanced Bracket","EV increment",1)
menu.set("Advanced Bracket","Bracket type",0)
menu.set("Advanced Bracket","Frames",2)
menu.set("Advanced Bracket","Sequence",2)
menu.set("Advanced Bracket","2-second delay",0)
menu.set("Advanced Bracket","ISO shifting",1)
local del = 0
if Script_Menu.submenu["ISO logic?"].value == "800" then
if camera.iso.apex < 8 then
del = math.floor(8 - camera.iso.apex + 0.5)
end
elseif Script_Menu.submenu["ISO logic?"].value == "1600" then
if camera.iso.apex < 9 then
del = math.floor(9 - camera.iso.apex + 0.5)
end
elseif Script_Menu.submenu["ISO logic?"].value == "3200" then
if camera.iso.apex < 10 then
del = math.floor(10 - camera.iso.apex + 0.5)
end
else -- float the ISO from the (ETTR) base ISO, irrespective of final value
del = ev_lift
end
menu.set("Advanced Bracket","EV increment",del)
end_count = dryos.shooting_card.file_number
AB_running = true
if base_tv > min_tv then
menu.set("Shoot","Advanced Bracket",0)
camera.shoot()
camera.shutter.apex = min_tv
menu.set("Shoot","Advanced Bracket",1)
menu.set("Advanced Bracket","ISO shifting",1)
camera.shoot()
end_count = end_count + 3
else
camera.shutter.apex = min_tv
menu.set("Shoot","Advanced Bracket",1)
menu.set("Advanced Bracket","ISO shifting",1)
camera.shoot()
end_count = end_count + 2
end
else
return true
end
end
function testkeys(kk)
run = false
if switched_off then return true end
if kk == 1 then timer = dryos.ms_clock end
if (kk == 2 and last_key == 1) and ((dryos.ms_clock - timer) > half_press_dalay) then run = true end
last_key = kk
return true
end
Script_Menu = menu.new
{
parent = "Shoot",
name = "HHBS",
help = "Does what it says",
submenu =
{
{
name = "ON or Off?",
help = "Switches the script on & off",
choices = choices0,
update = function(this)
if this.value == "ON" then
switched_off = false
menu.set("Focus","Toggle SGFB",1)
else
switched_off = true
menu.set("Focus","Toggle SGFB",0)
end
end,
},
{
name = "Delay",
help = "Shutter delay in seconds",
min = 0,
max = 5,
value = 1,
update = function(this)
delay = this.value
end,
},
{
name = "ISO logic?",
help = "Helps manages max ISO sensitivities",
help2 = "Float uses ISO Ev lift from the base ISO",
choices = choices1,
},
{
name = "ISO Ev lift",
help = "Lift above base ISO",
min = 3,
max = 5,
value = 4,
update = function(this)
ev_lift = this.value
end,
},
{
name = "Half Press delay",
help = "In seconds",
min = 1,
max = 9,
value = 3,
update = function(this)
half_press_dalay = this.value * 1000
end,
},
}
}
event.shoot_task = run_script
event.keypress = testkeys
config.create_from_menu(Script_Menu) -- keep track of the script's menu state at camera close
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment