Last active
June 2, 2016 14:02
-
-
Save pigeonhill/0ba658b24d7bf784b8240b10734f3c92 to your computer and use it in GitHub Desktop.
Magic Lantern Toggler Script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--[[ | |
Still photography toggler script | |
Version 1.6 (should work on all ML enabled cameras with the Lua module) | |
Garry George June 2016 | |
http://photography.grayheron.net/ | |
Toggler script for ML settings. | |
Toggle through ML settings using the selected option, ie a button you rarely use. | |
Must be in LV. | |
--]] | |
-- Declare some variables | |
toggler_play = 1 | |
toggler = 0 | |
frsp = false | |
frsp_ok = false | |
-- Change toggler value to your choice of button, eg KEY.RATE, KEY.UP, KEY.INFO or KEY.PLAY. | |
-- See http://davidmilligan.github.io/ml-lua/modules/constants.html for key constants | |
-- Default is KEY.RATE for non-EOSM cameras. EOSM self selects upper toggle on main dial as the EOSM doesn't have many buttons! | |
if camera.model_short == "EOSM" then toggler = KEY.UP else toggler = KEY.RATE end -- Change RATE to your choice | |
function property.SHUTTER:handler(value) -- Check if shutter value changed between toggles | |
if keymenu.submenu["Enabled?"].value == "Yes" and frsp then -- then need to recheck FRSP values in case user changes shutter speed | |
if camera.shutter.value < 0.2 or camera.shutter.value > 14 then | |
frsp_ok = false -- outside FRSP range | |
menu.set("Shoot","Silent Picture",0) | |
else | |
frsp_ok = true -- Good to go with FRSP | |
menu.set("Shoot","Silent Picture",1) | |
end | |
end | |
end | |
toggler_presets = | |
{ | |
{ | |
name = "OFF ", -- Toggler active but all ML Toggler menus turned off | |
menus= | |
{ | |
{ menu = "Shoot", item = "Advanced Bracket", value = 0}, | |
{ menu = "Shoot", item = "Silent Picture", value = 0}, | |
{ menu = "Expo", item = "Auto ETTR", value = 0}, | |
{ menu = "Expo", item = "Dual ISO", value = 0}, | |
} | |
}, | |
{ | |
name = "ETTR", | |
menus= | |
{ | |
{ menu = "Expo", item = "Auto ETTR", value = 1}, | |
} | |
}, | |
{ | |
name = "DUAL", | |
menus= | |
{ | |
{ menu = "Expo", item = "Auto ETTR", value = 0}, | |
{ menu = "Expo", item = "Dual ISO", value = 1}, | |
} | |
}, | |
{ | |
name = "BRAC", | |
menus= | |
{ | |
{ menu = "Shoot", item = "Advanced Bracket", value = 1}, | |
{ menu = "Expo", item = "Dual ISO", value = 0}, | |
} | |
}, | |
{ | |
name = "FRSP", | |
menus= | |
{ | |
{ menu = "Shoot", item = "Silent Picture", value = 1}, | |
{ menu = "Shoot", item = "Advanced Bracket", value = 0}, | |
} | |
} | |
} | |
-- You can add other ML 'menu states' above | |
event.keypress = function(key) | |
if keymenu.submenu["Enabled?"].value == "No" then | |
return true -- Toggler does nothing and shows no menu states | |
elseif key == toggler then -- act on a toggle | |
toggler_play = toggler_play + 1 | |
frsp = false -- assume FRSP not selected | |
if toggler_play > #toggler_presets then toggler_play = 1 end | |
for i,v in ipairs(toggler_presets[toggler_play].menus) do | |
menu.set(v.menu,v.item,v.value) | |
if v.item == "Silent Picture" and v.value == 1 then frsp = true end -- check if FRSP set to ON in this toggle | |
end | |
if frsp then -- check shutter values following toggle and FRSP requested | |
if camera.shutter.value < 0.2 or camera.shutter.value > 14 then | |
frsp_ok = false -- outside FRSP range | |
menu.set("Shoot","Silent Picture",0) | |
else | |
frsp_ok = true -- Good to go with FRSP | |
menu.set("Shoot","Silent Picture",1) | |
end | |
end | |
return false | |
end | |
end | |
lv.info | |
{ | |
name = "Info 1", | |
priority = 100, | |
value = "", | |
update = function(this) | |
this.background = COLOR.BLUE | |
this.foreground = COLOR.YELLOW | |
if keymenu.submenu["Enabled?"].value == "Yes" then | |
if frsp then -- FRSP requested then need to feedback FRSP shutter speed is OK or not | |
if not frsp_ok then this.foreground = COLOR.RED end | |
end | |
this.value = toggler_presets[toggler_play].name | |
else | |
this.value = "" | |
end | |
end | |
} | |
keymenu = menu.new | |
{ | |
parent = "Shoot", | |
name = "Toggler", | |
help = "Toggle through various ML options", | |
depends_on = DEPENDS_ON.LIVEVIEW, | |
submenu = | |
{ | |
{ | |
name = "Enabled?", | |
help = "Switches the script on/off", | |
choices = {"No","Yes"}, | |
icon_type = ICON_TYPE.BOOL, | |
select = function(this) | |
if this.value == "Yes" then | |
this.value = "No" | |
else | |
this.value = "Yes" | |
end | |
-- Reset Toggler | |
menu.set("Shoot","Silent Picture",0) | |
menu.set("Shoot","Advanced Bracket",0) | |
menu.set("Expo","Auto ETTR",0) | |
menu.set("Expo","Dual ISO",0) | |
toggler_play = 1 | |
frsp = false | |
end | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment