1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-17 05:15:25 +03:00

Still update duration of next anticipated state even is current execution time is ignored

This commit is contained in:
Steve Evans 2022-01-14 03:22:52 +00:00
parent 4e47a792d8
commit e7b61a928f
2 changed files with 27 additions and 25 deletions

View file

@ -1006,6 +1006,8 @@ void osdDrawStats2(timeUs_t currentTimeUs)
osdStatsEnabled = false;
stats.armed_time = 0;
}
schedulerIgnoreTaskExecTime();
}
#ifdef USE_ESC_SENSOR
if (featureIsEnabled(FEATURE_ESC_SENSOR)) {
@ -1305,20 +1307,22 @@ void osdUpdate(timeUs_t currentTimeUs)
break;
}
executeTimeUs = micros() - currentTimeUs;
if (!schedulerGetIgnoreTaskExecTime()) {
executeTimeUs = micros() - currentTimeUs;
// On the first pass no element groups will have been formed, so all elements will have been
// rendered which is unrepresentative, so ignore
if (!firstPass) {
if (osdCurState == OSD_STATE_UPDATE_ELEMENTS) {
if (executeTimeUs > osdElementGroupDurationUs[osdCurElementGroup]) {
osdElementGroupDurationUs[osdCurElementGroup] = executeTimeUs;
// On the first pass no element groups will have been formed, so all elements will have been
// rendered which is unrepresentative, so ignore
if (!firstPass) {
if (osdCurState == OSD_STATE_UPDATE_ELEMENTS) {
if (executeTimeUs > osdElementGroupDurationUs[osdCurElementGroup]) {
osdElementGroupDurationUs[osdCurElementGroup] = executeTimeUs;
}
}
}
if (executeTimeUs > osdStateDurationUs[osdCurState]) {
osdStateDurationUs[osdCurState] = executeTimeUs;
if (executeTimeUs > osdStateDurationUs[osdCurState]) {
osdStateDurationUs[osdCurState] = executeTimeUs;
}
}
}