mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-21 15:25:36 +03:00
Minor tidy of blackbox
This commit is contained in:
parent
94180dcdbb
commit
c48826a739
1 changed files with 11 additions and 5 deletions
|
@ -763,7 +763,7 @@ static void loadSlowState(blackboxSlowState_t *slow)
|
||||||
* If allowPeriodicWrite is true, the frame is also logged if it has been more than SLOW_FRAME_INTERVAL logging iterations
|
* If allowPeriodicWrite is true, the frame is also logged if it has been more than SLOW_FRAME_INTERVAL logging iterations
|
||||||
* since the field was last logged.
|
* since the field was last logged.
|
||||||
*/
|
*/
|
||||||
static void writeSlowFrameIfNeeded(void)
|
static bool writeSlowFrameIfNeeded(void)
|
||||||
{
|
{
|
||||||
// Write the slow frame peridocially so it can be recovered if we ever lose sync
|
// Write the slow frame peridocially so it can be recovered if we ever lose sync
|
||||||
bool shouldWrite = blackboxSlowFrameIterationTimer >= SLOW_FRAME_INTERVAL;
|
bool shouldWrite = blackboxSlowFrameIterationTimer >= SLOW_FRAME_INTERVAL;
|
||||||
|
@ -786,6 +786,7 @@ static void writeSlowFrameIfNeeded(void)
|
||||||
if (shouldWrite) {
|
if (shouldWrite) {
|
||||||
writeSlowFrame();
|
writeSlowFrame();
|
||||||
}
|
}
|
||||||
|
return shouldWrite;
|
||||||
}
|
}
|
||||||
|
|
||||||
void blackboxValidateConfig(void)
|
void blackboxValidateConfig(void)
|
||||||
|
@ -821,6 +822,13 @@ void blackboxValidateConfig(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void blackboxResetIterationTimers(void)
|
||||||
|
{
|
||||||
|
blackboxIteration = 0;
|
||||||
|
blackboxPFrameIndex = 0;
|
||||||
|
blackboxIFrameIndex = 0;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Start Blackbox logging if it is not already running. Intended to be called upon arming.
|
* Start Blackbox logging if it is not already running. Intended to be called upon arming.
|
||||||
*/
|
*/
|
||||||
|
@ -850,11 +858,9 @@ static void blackboxStart(void)
|
||||||
*/
|
*/
|
||||||
blackboxBuildConditionCache();
|
blackboxBuildConditionCache();
|
||||||
|
|
||||||
blackboxModeActivationConditionPresent = isModeActivationConditionPresent(modeActivationConditions(0), BOXBLACKBOX);
|
blackboxModeActivationConditionPresent = isModeActivationConditionPresent(modeActivationConditions(0), BOXBLACKBOX);
|
||||||
|
|
||||||
blackboxIteration = 0;
|
blackboxResetIterationTimers();
|
||||||
blackboxPFrameIndex = 0;
|
|
||||||
blackboxIFrameIndex = 0;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Record the beeper's current idea of the last arming beep time, so that we can detect it changing when
|
* Record the beeper's current idea of the last arming beep time, so that we can detect it changing when
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue