From 6fbb0094fb072adb26cdee80940218b564aa673b Mon Sep 17 00:00:00 2001 From: Guo-Rong <5484552+gkoh@users.noreply.github.com> Date: Thu, 29 Feb 2024 14:02:45 +1030 Subject: [PATCH] Enter shutter lock if release and focus are both pressed. During remote control, if focus button is held and release is pressed, enter shutter lock. Exit shutter lock if either focus or release are clicked. --- src/furble.ino | 70 +++++++++++++++++++++++++++++++++----------------- 1 file changed, 46 insertions(+), 24 deletions(-) diff --git a/src/furble.ino b/src/furble.ino index be93937..49c01d9 100644 --- a/src/furble.ino +++ b/src/furble.ino @@ -167,12 +167,15 @@ static void remote_interval(Furble::Device *device) { } static void remote_control(Furble::Device *device) { + + static bool shutter_lock = false; + Serial.println("Remote Control"); #ifdef M5STACK_CORE2 - ez.msgBox("Remote Shutter", "", "Release#Focus#Back", false); + ez.msgBox("Remote Shutter", "Lock: Focus+Release", "Release#Focus#Back", false); #else - ez.msgBox("Remote Shutter", "Back: Power", "Release#Focus", false); + ez.msgBox("Remote Shutter", "Lock: Focus+Release\nBack: Power", "Release#Focus", false); #endif do { M5.update(); @@ -180,32 +183,51 @@ static void remote_control(Furble::Device *device) { update_geodata(device); if (M5.BtnPWR.wasClicked() || M5.BtnC.wasPressed()) { + if (shutter_lock) { + // ensure shutter is released on exit + device->shutterRelease(); + } Serial.println("Exit shutter"); break; } - if (M5.BtnA.wasPressed()) { - device->shutterPress(); - Serial.println("shutterPress()"); - continue; - } - - if (M5.BtnA.wasReleased()) { - device->shutterRelease(); - Serial.println("shutterRelease()"); - continue; - } - - if (M5.BtnB.wasPressed()) { - device->focusPress(); - Serial.println("focusPress()"); - continue; - } - - if (M5.BtnB.wasReleased()) { - device->focusRelease(); - Serial.println("focusRelease()"); - continue; + if (shutter_lock) { + // release shutter if either shutter or focus is pressed + if (M5.BtnA.wasClicked() || M5.BtnB.wasClicked()) { + shutter_lock = false; + device->shutterRelease(); + Serial.println("shutterRelease(unlock)"); + } + } else { + if (M5.BtnA.wasPressed()) { + device->shutterPress(); + Serial.println("shutterPress()"); + continue; + } + + if (M5.BtnA.wasReleased()) { + // focus + shutter = shutter lock + if (M5.BtnB.isPressed()) { + shutter_lock = true; + Serial.println("shutter lock"); + } else { + device->shutterRelease(); + Serial.println("shutterRelease()"); + } + continue; + } + + if (M5.BtnB.wasPressed()) { + device->focusPress(); + Serial.println("focusPress()"); + continue; + } + + if (M5.BtnB.wasReleased()) { + device->focusRelease(); + Serial.println("focusRelease()"); + continue; + } } ez.yield();