Sfoglia il codice sorgente

Allow capture leases and indicator guards to end before post-processing

SybexXx 2 giorni fa
parent
commit
b359517e6e

+ 25 - 3
code/components/jomjol_controlcamera/ClassControllCamera.cpp

@@ -175,11 +175,20 @@ public:
 
     ~ScopedCameraOperationLock()
     {
-        if (m_acquired) xSemaphoreGiveRecursive(m_mutex);
+        release();
     }
 
     bool acquired() const { return m_acquired; }
 
+    void release()
+    {
+        if (m_acquired)
+        {
+            xSemaphoreGiveRecursive(m_mutex);
+            m_acquired = false;
+        }
+    }
+
 private:
     SemaphoreHandle_t m_mutex;
     bool m_acquired;
@@ -234,8 +243,21 @@ public:
 
     ~ScopedCameraCaptureIndicators()
     {
-        if (m_flashLed) m_camera.SetCaptureFlashActive(false);
-        if (m_statusLed) m_camera.SetCaptureStatusLedActive(false);
+        release();
+    }
+
+    void release()
+    {
+        if (m_flashLed)
+        {
+            m_camera.SetCaptureFlashActive(false);
+            m_flashLed = false;
+        }
+        if (m_statusLed)
+        {
+            m_camera.SetCaptureStatusLedActive(false);
+            m_statusLed = false;
+        }
     }
 
     ScopedCameraCaptureIndicators(const ScopedCameraCaptureIndicators &) = delete;