Merge pull request #4432 from andrethomas/patch-1

Update CPU average load function
This commit is contained in:
Theo Arends 2018-11-24 18:05:40 +01:00 committed by GitHub
commit bd8bd514ed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 2 deletions

View File

@ -2588,8 +2588,7 @@ void UpdateLoopLoadAvg(uint32_t loop_activity)
{
uint32_t loops_per_second = 1000 / (uint32_t)Settings.param[P_LOOP_SLEEP_DELAY]; // We need to keep track of this many loops per second
uint32_t this_cycle_ratio = 100 * loop_activity / (uint32_t)Settings.param[P_LOOP_SLEEP_DELAY];
uint32_t new_load_avg = loop_load_avg - (loop_load_avg / loops_per_second); // Take away one loop average
loop_load_avg = new_load_avg + this_cycle_ratio;;
loop_load_avg = loop_load_avg - (loop_load_avg / loops_per_second) + this_cycle_ratio; // Take away one loop average away and add the new one
}
extern "C" {