1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-12-01 09:24:10 +01:00

correctly detect 100% load

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@2836 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
FredericG 2011-02-21 21:50:10 +00:00 committed by FredericG
parent 931102bf37
commit 42cf204dcd

View File

@ -270,6 +270,11 @@ static void updateStats()
#else
stats.HeapRemaining = xPortGetFreeHeapSize();
#endif
// When idleCounterClear was not reset by the idle-task, it means the idle-task did not run
if (idleCounterClear) {
idleCounter = 0;
}
stats.CPULoad =
100 - (uint8_t) round(100.0 * ((float)idleCounter / (float)(SYSTEM_UPDATE_PERIOD_MS / 1000)) / (float)IDLE_COUNTS_PER_SEC_AT_NO_LOAD);
idleCounterClear = 1;