Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Toggler for EOSM
--[[
Simple (no menu, ie runs in the background) script to help control the EOSM:
1. to your ML favorite states 'just' using the MENU, PLAY & INFO buttons on the EOSM
2. simulates a dedicated [Q] button when ML menu active, ie the INFO button
To use the script simply note the following sequences:
[INFO] = simulated [Q] if ML menu active (note [PLAY] and [INFO] also 'do things' via the ML UI)
[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.4
Garry George May 2017
http://photography.grayheron.net/
--]]
last_key_pressed = 999
imode = false
config = 1
last_config = 1
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 = "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 = 1},
}
},
{
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 = 1},
}
},
{
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 = 1},
}
},
{
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 = 1},
}
},
{
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 = 1},
}
},
{
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 = 1},
}
},
{
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)
for i,v in ipairs(presets[k].menus) do
menu.set(v.menu,v.item,v.value)
end
end
function test4reset(k)
-- check if ML menu open
if menu.visible then
if k == KEY.INFO then -- sim dedicated [Q]
imode = false
last_key_pressed = 999
key.press(KEY.Q)
return false
else
return true
end
end
-- 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