Create a gist now

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Toggler for EOSM
--[[
No menu (complex) script, that runs in the background, to help control the camera and switch between your favorite ML/Canon states using your buttons of choice,
for example the MENU, PLAY & INFO buttons on the EOSM work well.
To use the script simply note the following sequences:
[MENU] = normal use of [MENU] if not in imode
[PLAY][PLAY] = normal use of [PLAY]
[PLAY][MENU] = enter toggler interactive imode
In imode [PLAY] and [INFO] will toggle back and forwards through your ML condition states giving you an on-screen message
In imode [MENU] will set that condition and leave interactive mode.
In imode pressing any other key, eg [SET] (not [MENU], [INFO] or [PLAY]) will leave interactive mode
Change/set the preset table below to your liking, but note the need to keep track of ML states as you move between toggled conditions
Version 0.51
Garry George December 2017
http://photography.grayheron.net/
--]]
last_key_pressed = 999
imode = false
config = 1
last_config = 1
-- Change the buttons to your choice
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
presets =
{
{
name = "Exit & Do Nothing"
},
{
name = "Open ML menu"
},
{
name = "FB ON/OFF"
},
{
name = "FB Sacking ON/OFF"
},
{
name = "All off",
menus=
{
{ menu = "Shoot", item = "Advanced Bracket", value = 0},
{ menu = "Shoot", item = "Silent Picture", value = 0},
{ menu = "Silent Picture", item = "Silent Mode", value = 5},
{ menu = "Silent Picture", item = "File Format", value = 1},
{ menu = "Expo", item = "Auto ETTR", value = 0},
{ menu = "Expo", item = "Dual ISO", value = 0},
{ menu = "Shoot", item = "Intervalometer", value = 0},
{ menu = "Movie", item = "FPS override", value = 0},
{ menu = "Expo", item = "ExpSim", value = 1},
{ menu = "Expo", item = "Expo. Override", value = 0},
}
},
{
name = "Auto ETTR", -- Only Auto ETTR
menus=
{
{ menu = "Shoot", item = "Advanced Bracket", value = 0},
{ menu = "Shoot", item = "Silent Picture", value = 0},
{ menu = "Silent Picture", item = "Silent Mode", value = 5},
{ menu = "Silent Picture", item = "File Format", value = 1},
{ menu = "Expo", item = "Auto ETTR", value = 1},
{ menu = "Expo", item = "Dual ISO", value = 0},
{ menu = "Shoot", item = "Intervalometer", value = 0},
{ menu = "Movie", item = "FPS override", value = 0},
{ menu = "Expo", item = "ExpSim", value = 1},
{ menu = "Expo", item = "Expo. Override", value = 0},
}
},
{
name = "Dual ISO", -- Only DUAL ISO
menus=
{
{ menu = "Shoot", item = "Advanced Bracket", value = 0},
{ menu = "Shoot", item = "Silent Picture", value = 0},
{ menu = "Silent Picture", item = "Silent Mode", value = 5},
{ menu = "Silent Picture", item = "File Format", value = 1},
{ menu = "Expo", item = "Auto ETTR", value = 0},
{ menu = "Expo", item = "Dual ISO", value = 1},
{ menu = "Shoot", item = "Intervalometer", value = 0},
{ menu = "Movie", item = "FPS override", value = 0},
{ menu = "Expo", item = "ExpSim", value = 1},
{ menu = "Expo", item = "Expo. Override", value = 0},
}
},
{
name = "Dual + ETTR", -- Both DUAL + ETTR
menus=
{
{ menu = "Shoot", item = "Advanced Bracket", value = 0},
{ menu = "Shoot", item = "Silent Picture", value = 0},
{ menu = "Silent Picture", item = "Silent Mode", value = 5},
{ menu = "Silent Picture", item = "File Format", value = 1},
{ menu = "Expo", item = "Auto ETTR", value = 1},
{ menu = "Expo", item = "Dual ISO", value = 1},
{ menu = "Shoot", item = "Intervalometer", value = 0},
{ menu = "Movie", item = "FPS override", value = 0},
{ menu = "Expo", item = "ExpSim", value = 1},
{ menu = "Expo", item = "Expo. Override", value = 0},
}
},
{
name = "ML Auto Bracketing", -- Auto Bracketing
menus=
{
{ menu = "Shoot", item = "Advanced Bracket", value = 1},
{ menu = "Shoot", item = "Silent Picture", value = 0},
{ menu = "Silent Picture", item = "Silent Mode", value = 5},
{ menu = "Silent Picture", item = "File Format", value = 1},
{ menu = "Expo", item = "Auto ETTR", value = 0},
{ menu = "Expo", item = "Dual ISO", value = 0},
{ menu = "Shoot", item = "Intervalometer", value = 0},
{ menu = "Movie", item = "FPS override", value = 0},
{ menu = "Expo", item = "ExpSim", value = 1},
{ menu = "Expo", item = "Expo. Override", value = 0},
}
},
{
name = "FRSP", -- Full Res Silent Picture
menus=
{
{ menu = "Shoot", item = "Advanced Bracket", value = 0},
{ menu = "Shoot", item = "Silent Picture", value = 1},
{ menu = "Silent Picture", item = "Silent Mode", value = 5},
{ menu = "Silent Picture", item = "File Format", value = 1},
{ menu = "Expo", item = "Auto ETTR", value = 0},
{ menu = "Expo", item = "Dual ISO", value = 0},
{ menu = "Shoot", item = "Intervalometer", value = 0},
{ menu = "Movie", item = "FPS override", value = 0},
{ menu = "Expo", item = "ExpSim", value = 1},
{ menu = "Expo", item = "Expo. Override", value = 0},
}
},
{
name = "Compose", -- Just for composing in dark conditions
menus=
{
{ menu = "Shoot", item = "Advanced Bracket", value = 0},
{ menu = "Shoot", item = "Silent Picture", value = 0},
{ menu = "Silent Picture", item = "Silent Mode", value = 5},
{ menu = "Silent Picture", item = "File Format", value = 1},
{ menu = "Expo", item = "Auto ETTR", value = 0},
{ menu = "Expo", item = "Dual ISO", value = 0},
{ menu = "Shoot", item = "Intervalometer", value = 0},
{ menu = "Movie", item = "FPS override", value = 1},
{ menu = "Expo", item = "ExpSim", value = 0},
{ menu = "Expo", item = "Expo. Override", value = 0},
}
}
}
function reset(k)
if presets[k].name == "Exit & Do Nothing" then
-- do nothing
-- or add new stuff here, eg ML or Canon state changes
elseif presets[k].name == "Open ML menu" then
menu.open()
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")
else
menu.set("Focus Bar","Display","ON")
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")
else
menu.set("Focus Bar","Focus Stacking","ON")
end
else -- do the other (named) presets
for i,v in ipairs(presets[k].menus) do
menu.set(v.menu,v.item,v.value)
end
end
end
function test4reset(k)
-- check for imode in ML menu not showing
if not menu.visible 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
-- display.notify_box(presets[config].name, message_time)
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
--display.notify_box(presets[config].name, message_time)
return false
end
if k == button_1 then -- leave imode and reset ML menus as requested
imode = false
change = true
return false
end
end
imode = false
if k == button_2 and last_key_pressed == button_2 then -- use key as normal
last_key_pressed = 999 -- reset
return true
elseif (k == button_1 and last_key_pressed == button_2) then -- go into imode
imode = true
last_key_pressed = 999
if config == 0 then config = 1 end
message_flag = true
return false -- steal key press
elseif k == button_2 then -- first press of button_2 key in new sequence
last_key_pressed = button_2
imode = false
return false -- steal key press
else
imode = false
last_key_pressed = 999 -- reset
return true -- use all other keys in an unmodified way
end
else -- don't use script
return true
end
end
function display_message(arg)
local qq = 0
local message = ""
if message_flag then
message = presets[last_config].name
qq = FONT.MED:width(message)/2
display.print(message,360-qq, 53, FONT.MEDIUM ,COLOR.TRANSPARENT,COLOR.TRANSPARENT)
message = presets[config].name
qq = FONT.MED:width(message)/2
display.print(message, 360-qq, 53, FONT.MEDIUM ,COLOR.WHITE,COLOR.TRANSPARENT_BLACK)
message_flag = false
elseif change then
message = presets[config].name
qq = FONT.MED:width(message)/2
display.print(message,360-qq, 53, FONT.MEDIUM ,COLOR.TRANSPARENT,COLOR.TRANSPARENT)
change = false
reset(config)
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