Merge pull request #2082 from blckmn/task_dispatch
SRXL: Added dispatcher start only if needed.
This commit is contained in:
commit
a0cb722254
|
@ -27,6 +27,17 @@
|
||||||
#include "fc/fc_dispatch.h"
|
#include "fc/fc_dispatch.h"
|
||||||
|
|
||||||
static dispatchEntry_t *head = NULL;
|
static dispatchEntry_t *head = NULL;
|
||||||
|
static bool dispatchEnabled = false;
|
||||||
|
|
||||||
|
bool dispatchIsEnabled(void)
|
||||||
|
{
|
||||||
|
return dispatchEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
void dispatchEnable(void)
|
||||||
|
{
|
||||||
|
dispatchEnabled = true;
|
||||||
|
}
|
||||||
|
|
||||||
void dispatchProcess(uint32_t currentTime)
|
void dispatchProcess(uint32_t currentTime)
|
||||||
{
|
{
|
||||||
|
|
|
@ -26,5 +26,7 @@ typedef struct dispatchEntry_s {
|
||||||
struct dispatchEntry_s *next;
|
struct dispatchEntry_s *next;
|
||||||
} dispatchEntry_t;
|
} dispatchEntry_t;
|
||||||
|
|
||||||
|
bool dispatchIsEnabled(void);
|
||||||
|
void dispatchEnable(void);
|
||||||
void dispatchProcess(uint32_t currentTime);
|
void dispatchProcess(uint32_t currentTime);
|
||||||
void dispatchAdd(dispatchEntry_t *entry, int delayUs);
|
void dispatchAdd(dispatchEntry_t *entry, int delayUs);
|
||||||
|
|
|
@ -235,7 +235,7 @@ void fcTasksInit(void)
|
||||||
setTaskEnabled(TASK_BATTERY, feature(FEATURE_VBAT) || feature(FEATURE_CURRENT_METER));
|
setTaskEnabled(TASK_BATTERY, feature(FEATURE_VBAT) || feature(FEATURE_CURRENT_METER));
|
||||||
setTaskEnabled(TASK_RX, true);
|
setTaskEnabled(TASK_RX, true);
|
||||||
|
|
||||||
setTaskEnabled(TASK_DISPATCH, true);
|
setTaskEnabled(TASK_DISPATCH, dispatchIsEnabled());
|
||||||
|
|
||||||
#ifdef BEEPER
|
#ifdef BEEPER
|
||||||
setTaskEnabled(TASK_BEEPER, true);
|
setTaskEnabled(TASK_BEEPER, true);
|
||||||
|
|
|
@ -316,6 +316,9 @@ bool spektrumInit(const rxConfig_t *rxConfig, rxRuntimeConfig_t *rxRuntimeConfig
|
||||||
rssi_channel = 0;
|
rssi_channel = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (serialPort && srxlEnabled) {
|
||||||
|
dispatchEnable();
|
||||||
|
}
|
||||||
return serialPort != NULL;
|
return serialPort != NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue