refactor(radio): async call handling to prevent GX12 switch lockups (#5949)

This commit is contained in:
3djc
2025-03-05 11:08:45 +10:00
committed by GitHub
parent 4b281b95d0
commit 466b06c597
3 changed files with 47 additions and 19 deletions
+15 -2
View File
@@ -205,12 +205,15 @@ void telemetryStop()
}
}
static volatile bool _poll_frame_queued[NUM_MODULES] = {false};
static void _poll_frame(void *pvParameter1, uint32_t ulParameter2)
{
_telemetryIsPolling = true;
auto drv = (const etx_proto_driver_t*)pvParameter1;
auto module = (uint8_t)ulParameter2;
_poll_frame_queued[module] = false;
auto mod = pulsesGetModuleDriver(module);
if (!mod || !mod->drv || !mod->ctx || (drv != mod->drv))
@@ -246,8 +249,18 @@ static void _poll_frame(void *pvParameter1, uint32_t ulParameter2)
void telemetryFrameTrigger_ISR(uint8_t module, const etx_proto_driver_t* drv)
{
BaseType_t xHigherPriorityTaskWoken = pdFALSE;
xTimerPendFunctionCallFromISR(_poll_frame, (void*)drv, module, &xHigherPriorityTaskWoken);
portYIELD_FROM_ISR( xHigherPriorityTaskWoken );
BaseType_t xReturn = pdFALSE;
if (!_poll_frame_queued[module] && xTaskGetSchedulerState() != taskSCHEDULER_NOT_STARTED) {
xReturn = xTimerPendFunctionCallFromISR(_poll_frame, (void*)drv, module, &xHigherPriorityTaskWoken);
if (xReturn == pdPASS) {
_poll_frame_queued[module] = true;
} else {
TRACE("xTimerPendFunctionCallFromISR() queue full");
}
portYIELD_FROM_ISR( xHigherPriorityTaskWoken );
}
}
#endif