EOSM script 1 (Toggler)
--[[ | |
Simple (no menu, ie runs in the background) script to help control ML states to your ML favorite states using your buttons of choice, | |
for example the MENU, PLAY & INFO buttons on the EOSM work well. | |
Note this is the EOSM version | |
To use the script simply note the following sequences on an EOSM (but you can change these for other cameras): | |
3+ sec press of screen = enter toggler interactive imode | |
In imode [PLAY] and [MENU] will toggle back and forwards through your ML condition states giving you an on-screen message | |
In imode [INFO] will set that condition and leave interactive mode. | |
In imode pressing (most) any other key, eg [SET] (not [MENU], [INFO] or [PLAY]) will leave interactive mode and use that key as normal: but some keys don't work!' | |
Change/set the preset table below and the chunks of script to your liking, but note the need to keep track of ML states as you move between | |
toggled conditions, eg change functions reset() & display_message() | |
Version M1.19 | |
Garry George May 2018 | |
http://photography.grayheron.net/ | |
--]] | |
last_key_pressed = 999 | |
imode = false | |
config = 1 | |
last_config = 1 | |
-- Change the buttons to your choice, for example | |
-- B1 = PLAY and B2 = INFO on an 5D3, and B1 = INFO and B2 = PLAY on a EOSM | |
button_1 = KEY.INFO -- imode switch and set | |
button_2 = KEY.PLAY -- used to go forwards in imode | |
button_3 = KEY.MENU -- used to go backwards in imode | |
message_flag = false | |
change = false | |
-- The colours can be changed to your choice. See here - http://builds.magiclantern.fm/lua_api/modules/constants.html#COLOR | |
display_color = COLOR.BLACK | |
con = COLOR.GREEN1 -- 'On' state | |
coff = COLOR.RED -- 'Off' | |
touch_timer_running = false | |
touch_time_pressed = 0 | |
presets = | |
{ | |
{ | |
name = "Exit & Do Nothing", | |
color = COLOR.BLACK, | |
}, | |
{ | |
name = "FB ON/OFF", | |
color = COLOR.BLACK, | |
}, | |
{ | |
name = "FB Sacking ON/OFF", | |
color = COLOR.BLACK, | |
}, | |
{ | |
name = "Show Info", | |
color = COLOR.BLACK, | |
}, | |
{ | |
name = "ND Script", | |
color = COLOR.BLACK, | |
}, | |
{ | |
name = "Auto ETTR", -- Only Auto ETTR | |
color = COLOR.BLACK, | |
}, | |
{ | |
name = "Dual ISO", -- Only DUAL ISO | |
color = COLOR.BLACK, | |
}, | |
{ | |
name = "ML Auto Bracketing", -- Auto Bracketing | |
color = COLOR.BLACK, | |
}, | |
-- add other presets here | |
} | |
function refresh_screen() | |
display.clear() | |
end | |
function reset(k) | |
message_flag = false | |
if presets[k].name == "Exit & Do Nothing" then | |
-- do nothing | |
-- The following elseif chuncks simply control toggling of the menu state you have selected | |
-- I've done it this 'long winded' way so you can easily add/subtract from it' | |
elseif presets[k].name == "FB ON/OFF" then -- if FB not present, does nothing | |
if menu.get("Focus Bar","Display","") == "ON" then | |
menu.set("Focus Bar","Display","OFF") | |
presets[k].color = coff | |
else | |
menu.set("Focus Bar","Display","ON") | |
menu.set("ND Script","Turn Script on and off","OFF") | |
presets[k].color = con | |
end | |
display.draw(refresh_screen) | |
elseif presets[k].name == "Show Info" then -- if FB not present, does nothing | |
menu.set("Focus Bar","update","ON") -- flag to alert the Focus Bar | |
if menu.get("Focus Bar","Show Info","") == "Simple" then | |
menu.set("Focus Bar","Show Info","Full") | |
presets[k].color = coff | |
else | |
menu.set("Focus Bar","Show Info","Simple") | |
presets[k].color = con | |
end | |
elseif presets[k].name == "FB Sacking ON/OFF" then -- if FB not present, does nothing | |
if menu.get("Focus Bar","Focus Stacking","") == "ON" then | |
menu.set("Focus Bar","Focus Stacking","OFF") | |
presets[k].color = coff | |
else | |
menu.set("Focus Bar","Focus Stacking","ON") | |
presets[k].color = con | |
end | |
elseif presets[k].name == "Dual ISO" then | |
if menu.get("Expo","Dual ISO",1) == 1 then | |
menu.set("Expo","Dual ISO",0) | |
presets[k].color = coff | |
else | |
menu.set("Expo","Dual ISO",1) | |
presets[k].color = con | |
end | |
elseif presets[k].name == "ND Script" then | |
if menu.get("ND Script","Turn Script on and off","") == "ON" then | |
menu.set("ND Script","Turn Script on and off","OFF") | |
presets[k].color = coff | |
else | |
menu.set("ND Script","Turn Script on and off","ON") | |
menu.set("Focus Bar","Display","OFF") | |
presets[k].color = con | |
end | |
display.draw(refresh_screen) | |
elseif presets[k].name == "Auto ETTR" then | |
if menu.get("Expo","Auto ETTR",1) == 1 then | |
menu.set("Expo","Auto ETTR",0) | |
presets[k].color = coff | |
else | |
menu.set("Expo","Auto ETTR",1) | |
presets[k].color = con | |
end | |
elseif presets[k].name == "ML Auto Bracketing" then | |
if menu.get("Shoot","Advanced Bracket",1) == 1 then | |
menu.set("Shoot","Advanced Bracket",0) | |
presets[k].color = coff | |
else | |
menu.set("Shoot","Advanced Bracket",1) | |
presets[k].color = con | |
end | |
-- add others menus to toggle here | |
end | |
end | |
function test4reset(k) | |
if k == 35 and lv.overlays == 2 then | |
touch_timer_running = true -- start looking for 1 finger long press | |
touch_time_pressed = dryos.ms_clock | |
message_flag = false | |
imode = false | |
return true | |
elseif k == 36 and touch_timer_running and lv.overlays == 2 then | |
if dryos.ms_clock - touch_time_pressed > 3000 then -- 3 sec plus pre | |
touch_timer_running = false -- stop looking for a long press | |
message_flag = true | |
imode = true | |
return true | |
else -- less than 3 seconds so handle as a normal unpress | |
touch_timer_running = false | |
message_flag = false | |
imode = false | |
return true | |
end | |
end | |
if not menu.visible and lv.running and imode then -- ok to use | |
change = false | |
if imode then | |
if k == button_2 then -- move forward through presets | |
last_config = config | |
config = config + 1 | |
if config > #presets then config = 1 end | |
message_flag = true | |
return false | |
end | |
if k == button_3 then -- move backwards through presets | |
last_config = config | |
config = config - 1 | |
if config == 0 then config = #presets end | |
message_flag = true | |
return false | |
end | |
if k == button_1 then -- leave imode and reset ML menus as requested | |
imode = false | |
change = true | |
message_flag = true | |
return false | |
end | |
imode = false | |
local message = "" | |
local qq = 0 | |
message = presets[config].name | |
qq = FONT.LARGE:width(message)/2 | |
display.print(message,360-qq, 290,FONT.LARGE,COLOR.TRANSPARENT,COLOR.TRANSPARENT) | |
change = false | |
message_flag = false | |
display.draw(refresh_screen) | |
key.press(KEY.HALFSHUTTER) | |
key.press(KEY.UNPRESS_HALFSHUTTER) | |
return true | |
end | |
else -- don't use script | |
message_flag = false | |
return true | |
end | |
end | |
function display_message(arg) | |
if message_flag then | |
-- The following if-then section handles the display colours that show you the existing menu state, and the selected colour state on exiting Toggler | |
if presets[config].name == "FB ON/OFF" then | |
if menu.get("Focus Bar","Display","") == "ON" then presets[config].color = con else presets[config].color = coff end | |
elseif presets[config].name == "Dual ISO" then | |
if menu.get("Expo","Dual ISO",1) == 1 then presets[config].color = con else presets[config].color = coff end | |
elseif presets[config].name == "Auto ETTR" then | |
if menu.get("Expo","Auto ETTR",1) == 1 then presets[config].color = con else presets[config].color = coff end | |
elseif presets[config].name == "FB Sacking ON/OFF" then | |
if menu.get("Focus Bar","Focus Stacking","") == "ON" then presets[config].color = con else presets[config].color = coff end | |
elseif presets[config].name == "ML Auto Bracketing" then | |
if menu.get("Shoot","Advanced Bracket",1) == 1 then presets[config].color = con else presets[config].color = coff end | |
elseif presets[config].name == "ND Script" then | |
if menu.get("ND Script","Turn Script on and off","") == "ON" then presets[config].color = con else presets[config].color = coff end | |
elseif presets[config].name == "Show Info" then | |
if menu.get("Focus Bar","Show Info","") == "Simple" then presets[config].color = con else presets[config].color = coff end | |
-- repeat above here to manage color changes (if you want to) | |
end | |
local qq = 0 | |
local message = "" | |
if change then | |
message = presets[config].name | |
reset(config) -- toggle | |
qq = FONT.LARGE:width(message)/2 | |
display.print(message,360-qq, 290,FONT.LARGE,presets[config].color,COLOR.WHITE) | |
msleep(1000) | |
display.print(message,360-qq, 290,FONT.LARGE,COLOR.TRANSPARENT,COLOR.TRANSPARENT) | |
change = false | |
display.draw(refresh_screen) | |
key.press(KEY.HALFSHUTTER) | |
key.press(KEY.UNPRESS_HALFSHUTTER) | |
else | |
message = presets[last_config].name | |
qq = FONT.LARGE:width(message)/2 | |
display.print(message,360-qq, 290,FONT.LARGE,COLOR.TRANSPARENT,COLOR.TRANSPARENT) | |
message = presets[config].name | |
qq = FONT.LARGE:width(message)/2 | |
display.print(message, 360-qq, 290,FONT.LARGE,presets[config].color,COLOR.WHITE) | |
message_flag = false | |
end | |
end | |
end | |
event.shoot_task = display_message | |
event.keypress = test4reset |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment