2014 Eurobot fork

Dependencies:   mbed-rtos mbed QEI

Revision:
42:6504d85d85b4
Parent:
28:4e20b44251c6
--- a/System/system.cpp	Thu Apr 11 18:49:08 2013 +0000
+++ b/System/system.cpp	Thu Apr 11 19:49:46 2013 +0000
@@ -7,7 +7,7 @@
 
 Ticker CPUIdleMeasureTicker;
 volatile unsigned int nopctr = 0;
-const float s_per_nopcycle = 1.0f/24000000.0f;
+const float s_per_nopcycle = 1.0f/16000000.0f;
 
 float CpuUsage = 0;
 
@@ -17,9 +17,11 @@
 }
 
 void PostAndResetCPUIdle(){
-    CpuUsage = 1.0f - (s_per_nopcycle * nopctr);
+    static int oldnopctr = 0;
+    int deltanop = nopctr - oldnopctr;
+    oldnopctr = nopctr;
+    CpuUsage = 1.0f - (s_per_nopcycle * deltanop);
     Printing::updateval(10,CpuUsage);
-    nopctr = 0;
 }
 
 void measureCPUidle (void const*){