diff --git a/src/main/fc/fc_dispatch.c b/src/main/fc/fc_dispatch.c index 00c785315..cc46e53d5 100644 --- a/src/main/fc/fc_dispatch.c +++ b/src/main/fc/fc_dispatch.c @@ -27,6 +27,17 @@ #include "fc/fc_dispatch.h" static dispatchEntry_t *head = NULL; +static bool dispatchEnabled = false; + +bool isDispatchEnabled(void) +{ + return dispatchEnabled; +} + +void dispatchStart(void) +{ + dispatchEnabled = true; +} void dispatchProcess(uint32_t currentTime) { diff --git a/src/main/fc/fc_dispatch.h b/src/main/fc/fc_dispatch.h index b88d75928..bc3b14095 100644 --- a/src/main/fc/fc_dispatch.h +++ b/src/main/fc/fc_dispatch.h @@ -26,5 +26,7 @@ typedef struct dispatchEntry_s { struct dispatchEntry_s *next; } dispatchEntry_t; +bool isDispatchEnabled(void); +void dispatchStart(void); void dispatchProcess(uint32_t currentTime); void dispatchAdd(dispatchEntry_t *entry, int delayUs); diff --git a/src/main/fc/fc_tasks.c b/src/main/fc/fc_tasks.c index e548568ca..1ff15c214 100644 --- a/src/main/fc/fc_tasks.c +++ b/src/main/fc/fc_tasks.c @@ -235,7 +235,9 @@ void fcTasksInit(void) setTaskEnabled(TASK_BATTERY, feature(FEATURE_VBAT) || feature(FEATURE_CURRENT_METER)); setTaskEnabled(TASK_RX, true); - setTaskEnabled(TASK_DISPATCH, true); + if (isDispatchEnabled()) { + setTaskEnabled(TASK_DISPATCH, true); + } #ifdef BEEPER setTaskEnabled(TASK_BEEPER, true); diff --git a/src/main/rx/spektrum.c b/src/main/rx/spektrum.c index 2fc97191b..da0b64fdd 100644 --- a/src/main/rx/spektrum.c +++ b/src/main/rx/spektrum.c @@ -316,6 +316,9 @@ bool spektrumInit(const rxConfig_t *rxConfig, rxRuntimeConfig_t *rxRuntimeConfig rssi_channel = 0; } + if (serialPort && srxlEnabled) { + dispatchStart(); + } return serialPort != NULL; }