mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-19 14:25:20 +03:00
Fixed dispatch initialisation for persistent statistics.
This commit is contained in:
parent
9abf63a0b0
commit
c6c4c3adf9
4 changed files with 13 additions and 3 deletions
|
@ -88,6 +88,7 @@
|
||||||
#include "fc/init.h"
|
#include "fc/init.h"
|
||||||
#include "fc/rc_controls.h"
|
#include "fc/rc_controls.h"
|
||||||
#include "fc/runtime_config.h"
|
#include "fc/runtime_config.h"
|
||||||
|
#include "fc/stats.h"
|
||||||
#include "fc/tasks.h"
|
#include "fc/tasks.h"
|
||||||
|
|
||||||
#include "flight/failsafe.h"
|
#include "flight/failsafe.h"
|
||||||
|
@ -932,10 +933,13 @@ void init(void)
|
||||||
pwmEnableMotors();
|
pwmEnableMotors();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef USE_PERSISTENT_STATS
|
||||||
|
statsInit();
|
||||||
|
#endif
|
||||||
|
|
||||||
setArmingDisabled(ARMING_DISABLED_BOOT_GRACE_TIME);
|
setArmingDisabled(ARMING_DISABLED_BOOT_GRACE_TIME);
|
||||||
|
|
||||||
fcTasksInit();
|
fcTasksInit();
|
||||||
|
|
||||||
systemState |= SYSTEM_STATE_READY;
|
systemState |= SYSTEM_STATE_READY;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -767,7 +767,7 @@ static void processStepwiseAdjustments(controlRateConfig_t *controlRateConfig, c
|
||||||
|
|
||||||
static void setConfigDirtyIfNotPermanent(const channelRange_t *range)
|
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).
|
// Only set the configuration dirty if this range is NOT permanently enabled (and the config thus never used).
|
||||||
setConfigDirty();
|
setConfigDirty();
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,6 +49,11 @@ static bool saveRequired = false;
|
||||||
#define DISTANCE_FLOWN_CM (0)
|
#define DISTANCE_FLOWN_CM (0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
void statsInit(void)
|
||||||
|
{
|
||||||
|
dispatchEnable();
|
||||||
|
}
|
||||||
|
|
||||||
void writeStats(struct dispatchEntry_s* self)
|
void writeStats(struct dispatchEntry_s* self)
|
||||||
{
|
{
|
||||||
UNUSED(self);
|
UNUSED(self);
|
||||||
|
@ -93,7 +98,6 @@ void statsOnDisarm(void)
|
||||||
if (saveRequired) {
|
if (saveRequired) {
|
||||||
/* signal that stats need to be saved but don't execute time consuming flash operation
|
/* 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 */
|
now - let the disarming process complete and then execute the actual save */
|
||||||
dispatchEnable();
|
|
||||||
dispatchAdd(&writeStatsEntry, STATS_SAVE_DELAY_US);
|
dispatchAdd(&writeStatsEntry, STATS_SAVE_DELAY_US);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,5 +20,7 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
void statsInit(void);
|
||||||
|
|
||||||
void statsOnArm(void);
|
void statsOnArm(void);
|
||||||
void statsOnDisarm(void);
|
void statsOnDisarm(void);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue