Reset task statistics after gyro calibration complete
This commit is contained in:
parent
e03744330d
commit
10d3c2e76b
|
@ -185,6 +185,25 @@ uint32_t getTaskDeltaTime(cfTaskId_e taskId)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void schedulerResetTaskStatistics(cfTaskId_e taskId)
|
||||||
|
{
|
||||||
|
#ifdef SKIP_TASK_STATISTICS
|
||||||
|
UNUSED(taskId);
|
||||||
|
#else
|
||||||
|
if (taskId == TASK_SELF) {
|
||||||
|
currentTask->movingSumExecutionTime = 0;
|
||||||
|
currentTask->totalExecutionTime = 0;
|
||||||
|
currentTask->maxExecutionTime = 0;
|
||||||
|
} else if (taskId < TASK_COUNT) {
|
||||||
|
cfTasks[taskId].movingSumExecutionTime = 0;
|
||||||
|
cfTasks[taskId].totalExecutionTime = 0;
|
||||||
|
cfTasks[taskId].totalExecutionTime = 0;
|
||||||
|
} else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
void schedulerInit(void)
|
void schedulerInit(void)
|
||||||
{
|
{
|
||||||
queueClear();
|
queueClear();
|
||||||
|
|
|
@ -144,6 +144,7 @@ void getTaskInfo(cfTaskId_e taskId, cfTaskInfo_t *taskInfo);
|
||||||
void rescheduleTask(cfTaskId_e taskId, uint32_t newPeriodMicros);
|
void rescheduleTask(cfTaskId_e taskId, uint32_t newPeriodMicros);
|
||||||
void setTaskEnabled(cfTaskId_e taskId, bool newEnabledState);
|
void setTaskEnabled(cfTaskId_e taskId, bool newEnabledState);
|
||||||
uint32_t getTaskDeltaTime(cfTaskId_e taskId);
|
uint32_t getTaskDeltaTime(cfTaskId_e taskId);
|
||||||
|
void schedulerResetTaskStatistics(cfTaskId_e taskId);
|
||||||
|
|
||||||
void schedulerInit(void);
|
void schedulerInit(void);
|
||||||
void scheduler(void);
|
void scheduler(void);
|
||||||
|
|
|
@ -54,6 +54,8 @@
|
||||||
#include "io/beeper.h"
|
#include "io/beeper.h"
|
||||||
#include "io/statusindicator.h"
|
#include "io/statusindicator.h"
|
||||||
|
|
||||||
|
#include "scheduler/scheduler.h"
|
||||||
|
|
||||||
#include "sensors/sensors.h"
|
#include "sensors/sensors.h"
|
||||||
#include "sensors/boardalignment.h"
|
#include "sensors/boardalignment.h"
|
||||||
#include "sensors/gyro.h"
|
#include "sensors/gyro.h"
|
||||||
|
@ -359,6 +361,7 @@ static void performGyroCalibration(uint8_t gyroMovementCalibrationThreshold)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isOnFinalGyroCalibrationCycle()) {
|
if (isOnFinalGyroCalibrationCycle()) {
|
||||||
|
schedulerResetTaskStatistics(TASK_SELF); // so calibration cycles do not pollute tasks statistics
|
||||||
beeper(BEEPER_GYRO_CALIBRATED);
|
beeper(BEEPER_GYRO_CALIBRATED);
|
||||||
}
|
}
|
||||||
calibratingG--;
|
calibratingG--;
|
||||||
|
@ -403,11 +406,11 @@ void gyroUpdate(void)
|
||||||
const bool calibrationComplete = isGyroCalibrationComplete();
|
const bool calibrationComplete = isGyroCalibrationComplete();
|
||||||
if (calibrationComplete) {
|
if (calibrationComplete) {
|
||||||
#if defined(GYRO_USES_SPI) && defined(USE_MPU_DATA_READY_SIGNAL)
|
#if defined(GYRO_USES_SPI) && defined(USE_MPU_DATA_READY_SIGNAL)
|
||||||
// SPI-based gyro so can read and update in ISR
|
// SPI-based gyro so can read and update in ISR
|
||||||
if (gyroConfig->gyro_isr_update) {
|
if (gyroConfig->gyro_isr_update) {
|
||||||
mpuGyroSetIsrUpdate(&gyro.dev, gyroUpdateISR);
|
mpuGyroSetIsrUpdate(&gyro.dev, gyroUpdateISR);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifdef DEBUG_MPU_DATA_READY_INTERRUPT
|
#ifdef DEBUG_MPU_DATA_READY_INTERRUPT
|
||||||
debug[3] = (uint16_t)(micros() & 0xffff);
|
debug[3] = (uint16_t)(micros() & 0xffff);
|
||||||
|
|
Loading…
Reference in New Issue