mirror of
https://github.com/MrUnknownDE/OpenIris-ESPIDF.git
synced 2026-04-19 06:23:44 +02:00
Refactor global state management for startup commands and USB handover (no Race-Condition); enhance SerialManager shutdown process and buffer handling in UVCStream.
This commit is contained in:
@@ -4,15 +4,15 @@
|
||||
// Forward declarations
|
||||
extern void start_video_streaming(void *arg);
|
||||
|
||||
bool startupCommandReceived = false;
|
||||
static bool s_startupCommandReceived = false;
|
||||
bool getStartupCommandReceived()
|
||||
{
|
||||
return startupCommandReceived;
|
||||
return s_startupCommandReceived;
|
||||
}
|
||||
|
||||
void setStartupCommandReceived(bool startupCommandReceived)
|
||||
{
|
||||
startupCommandReceived = startupCommandReceived;
|
||||
s_startupCommandReceived = startupCommandReceived;
|
||||
}
|
||||
|
||||
static TaskHandle_t *g_serial_manager_handle = nullptr;
|
||||
@@ -27,15 +27,15 @@ void setSerialManagerHandle(TaskHandle_t *serialManagerHandle)
|
||||
}
|
||||
|
||||
// Global pause state
|
||||
bool startupPaused = false;
|
||||
static bool s_startupPaused = false;
|
||||
bool getStartupPaused()
|
||||
{
|
||||
return startupPaused;
|
||||
return s_startupPaused;
|
||||
}
|
||||
|
||||
void setStartupPaused(bool startupPaused)
|
||||
{
|
||||
startupPaused = startupPaused;
|
||||
s_startupPaused = startupPaused;
|
||||
}
|
||||
|
||||
// Function to manually activate streaming
|
||||
@@ -47,4 +47,9 @@ void activateStreaming(bool disableSetup)
|
||||
void *serialTaskHandle = (serialHandle && *serialHandle) ? *serialHandle : nullptr;
|
||||
|
||||
start_video_streaming(serialTaskHandle);
|
||||
}
|
||||
}
|
||||
|
||||
// USB handover state
|
||||
static bool s_usbHandoverDone = false;
|
||||
bool getUsbHandoverDone() { return s_usbHandoverDone; }
|
||||
void setUsbHandoverDone(bool done) { s_usbHandoverDone = done; }
|
||||
@@ -21,4 +21,8 @@ void setStartupCommandReceived(bool startupCommandReceived);
|
||||
bool getStartupPaused();
|
||||
void setStartupPaused(bool startupPaused);
|
||||
|
||||
// Tracks whether USB handover from usb_serial_jtag to TinyUSB was performed
|
||||
bool getUsbHandoverDone();
|
||||
void setUsbHandoverDone(bool done);
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user