A simple post today, to let you know that my Toggler ML script has been refactored and tidied up.
All the Toggler does is allow you to switch on/off certain ML menus, in a cyclic way:
Simply opening the Toggler menu resets all the above to off and puts Toggler in the OFF state if it is enabled or not, ie if Toggler is enabled all the above ML menus set are set to off when the Toggler menu is displayed.
As usual I welcome feedback.
--[[
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 = {"Yes","No"},
update = function(this) -- set all Toggler menus to their off state
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
-- menu.close()
end
}
}
}
All the Toggler does is allow you to switch on/off certain ML menus, in a cyclic way:
- OFF -- All the following are switched off
- ETTR = ETTR on
- DUAL = Dual-ISO on
- BRAC = Auto-Bracketing on
- FRSP = Full Res Silent Picture on
Simply opening the Toggler menu resets all the above to off and puts Toggler in the OFF state if it is enabled or not, ie if Toggler is enabled all the above ML menus set are set to off when the Toggler menu is displayed.
As usual I welcome feedback.
--[[
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 = {"Yes","No"},
update = function(this) -- set all Toggler menus to their off state
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
-- menu.close()
end
}
}
}