Fixed dispatch initialisation for persistent statistics.

This commit is contained in:
mikeller 2019-06-23 19:56:45 +12:00
parent 9abf63a0b0
commit c6c4c3adf9
4 changed files with 13 additions and 3 deletions

View File

@ -88,6 +88,7 @@
#include "fc/init.h"
#include "fc/rc_controls.h"
#include "fc/runtime_config.h"
#include "fc/stats.h"
#include "fc/tasks.h"
#include "flight/failsafe.h"
@ -932,10 +933,13 @@ void init(void)
pwmEnableMotors();
#endif
#ifdef USE_PERSISTENT_STATS
statsInit();
#endif
setArmingDisabled(ARMING_DISABLED_BOOT_GRACE_TIME);
fcTasksInit();
systemState |= SYSTEM_STATE_READY;
}

View File

@ -767,7 +767,7 @@ static void processStepwiseAdjustments(controlRateConfig_t *controlRateConfig, c
static void setConfigDirtyIfNotPermanent(const channelRange_t *range)
{
if (range->startStep == MIN_MODE_RANGE_STEP && range->endStep == MAX_MODE_RANGE_STEP) {
if (!(range->startStep == MIN_MODE_RANGE_STEP && range->endStep == MAX_MODE_RANGE_STEP)) {
// Only set the configuration dirty if this range is NOT permanently enabled (and the config thus never used).
setConfigDirty();
}

View File

@ -49,6 +49,11 @@ static bool saveRequired = false;
#define DISTANCE_FLOWN_CM (0)
#endif
void statsInit(void)
{
dispatchEnable();
}
void writeStats(struct dispatchEntry_s* self)
{
UNUSED(self);
@ -93,7 +98,6 @@ void statsOnDisarm(void)
if (saveRequired) {
/* signal that stats need to be saved but don't execute time consuming flash operation
now - let the disarming process complete and then execute the actual save */
dispatchEnable();
dispatchAdd(&writeStatsEntry, STATS_SAVE_DELAY_US);
}
}

View File

@ -20,5 +20,7 @@
#pragma once
void statsInit(void);
void statsOnArm(void);
void statsOnDisarm(void);