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)
|
||||
{
|
||||
queueClear();
|
||||
|
|
|
@ -144,6 +144,7 @@ void getTaskInfo(cfTaskId_e taskId, cfTaskInfo_t *taskInfo);
|
|||
void rescheduleTask(cfTaskId_e taskId, uint32_t newPeriodMicros);
|
||||
void setTaskEnabled(cfTaskId_e taskId, bool newEnabledState);
|
||||
uint32_t getTaskDeltaTime(cfTaskId_e taskId);
|
||||
void schedulerResetTaskStatistics(cfTaskId_e taskId);
|
||||
|
||||
void schedulerInit(void);
|
||||
void scheduler(void);
|
||||
|
|
|
@ -54,6 +54,8 @@
|
|||
#include "io/beeper.h"
|
||||
#include "io/statusindicator.h"
|
||||
|
||||
#include "scheduler/scheduler.h"
|
||||
|
||||
#include "sensors/sensors.h"
|
||||
#include "sensors/boardalignment.h"
|
||||
#include "sensors/gyro.h"
|
||||
|
@ -359,6 +361,7 @@ static void performGyroCalibration(uint8_t gyroMovementCalibrationThreshold)
|
|||
}
|
||||
|
||||
if (isOnFinalGyroCalibrationCycle()) {
|
||||
schedulerResetTaskStatistics(TASK_SELF); // so calibration cycles do not pollute tasks statistics
|
||||
beeper(BEEPER_GYRO_CALIBRATED);
|
||||
}
|
||||
calibratingG--;
|
||||
|
|
Loading…
Reference in New Issue