Colour sensors calibrated
Dependencies: mbed-rtos mbed Servo QEI
Fork of ICRSEurobot13 by
Diff: System/system.cpp
- Revision:
- 43:6504d85d85b4
- Parent:
- 29:4e20b44251c6
diff -r 26e5f24b55b3 -r 6504d85d85b4 System/system.cpp --- 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*){