Skip to content

Instantly share code, notes, and snippets.

@Jip-Hop
Last active Jul 4, 2019
Embed
What would you like to do?
-- Crop mode toggle
-- Toggle between 3x crop mode
require('config')
-- end this script if not eosm
if camera.model_short ~= "EOSM" then
display.notify_box("Script not working on this cam");
msleep(2000);
return
end
-- warnings
while camera.mode ~= MODE.MOVIE do
display.notify_box("enable MOVIE mode");
msleep(1000);
end
function toggle_x3crop()
-- console.show();
local recording = movie.recording;
if recording == true then
display.notify_box("STOPPED RECORDING");
movie.stop();
end
-- crop mode
if menu.get("Crop mode", "x3crop") == "x3crop" then
display.notify_box("DISABLED X3CROP");
menu.set("Crop mode", "x3crop", 0);
else
display.notify_box("ENABLED X3CROP");
menu.set("Crop mode", "x3crop", "x3crop");
end
lv.pause();
lv.start();
if recording == true then
local max_tries = 40
while max_tries > 0 do
max_tries = max_tries - 1
msleep(100)
movie.start();
if(movie.recording == true) then
display.notify_box("RESTARTED RECORDING");
break
end
end
end
end
x3crop_toggle_menu = menu.new
{
parent = "Movie",
name = "x3crop toggle",
help = "Pick a button to toggle x3crop in mv1080.",
value = 0,
submenu =
{
{
select = function(this)
if x3crop_toggle_menu.value == 0 then
x3crop_toggle_menu.value = 1;
else
x3crop_toggle_menu.value = 0;
end
end,
update = function(this)
if x3crop_toggle_menu.value == 0 then
this.name = "Enable";
else
this.name = "Disable";
end
end,
},
{
name = "Button",
choices = { "SET", "INFO", "HALFSHUTTER"},
}
},
update = function(this)
if this.value == 0 then
this.help2 = "Click Enable in submenu to activate.";
return "OFF";
else
this.help2 = ""
return "ON, " .. this.submenu["Button"].value;
end
end,
};
config.create_from_menu(x3crop_toggle_menu)
event.keypress = function(key)
if key == KEY[x3crop_toggle_menu.submenu["Button"].value] and menu.visible == false and x3crop_toggle_menu.value ~= 0 then
task.create(toggle_x3crop);
return false;
end
end
console.hide();
@dannephoto
Copy link

dannephoto commented Jul 4, 2019

Really nice work on this. I like the INFO button and I think it´s the better button to use. One thing with this button though is that it also has a lot of goodies such as iso and also other general purpose settings tht we no longer acces once the button is reassigned. Suggestion. Short press still let´s us go into info screen. A longer push(maybe 0.5s) instead enters x3 toggle.
Another idea is to run a double push to access x3 toggle. One push would enter INFO screen.
In my c-code equivalent I keep a 0.5 sec delay since then halfpress shutter button also can access magic zoom etc.

@Jip-Hop
Copy link
Author

Jip-Hop commented Jul 4, 2019

@Jip-Hop
Copy link
Author

Jip-Hop commented Jul 4, 2019

@dannephoto
Copy link

dannephoto commented Jul 4, 2019

Yes, wonky time, recording stops so a watch guard while recording needed too.
What's ETC by the way? Maybe rename it to CMT?

@Jip-Hop
Copy link
Author

Jip-Hop commented Jul 4, 2019

@dannephoto
Copy link

dannephoto commented Jul 4, 2019

Hehe, I see. Yes, nunbers and also length is problematic. No more than eight characters I think.

@Jip-Hop
Copy link
Author

Jip-Hop commented Jul 4, 2019

Should now restart movie recording more or less as quick as it can when you toggle x3crop while recording.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment