Optimaze with new mbed os for study

Dependencies:   TS_DISCO_F746NG BSP_DISCO_F746NG Graphics

Revision:
1:5e49b46de1b0
Parent:
0:d8b9955d2b36
Child:
2:8db224cc1fcb
diff -r d8b9955d2b36 -r 5e49b46de1b0 RadarDemo/RadarDemo.cpp
--- a/RadarDemo/RadarDemo.cpp	Fri Nov 04 01:02:37 2016 +0000
+++ b/RadarDemo/RadarDemo.cpp	Fri Nov 04 17:10:50 2016 +0000
@@ -21,23 +21,31 @@
 
 void RadarDemo::Initialize()
 {
-    _needsRedraw = true;
-
+    // Set scan perion for 6 seconds
     scanPeriod = 6000;
-    demoTime = 0;   //2 * scanPeriod;
 
+    // Run forever, to set limited time for the demo
+    // use for example: demoTime = 10 * scanPeriod;
+    demoTime = 0;
+
+    // Put a number of sample targets on the display
     AddSampleTargets(100);
 
+    // Use medium range, values 0..2 are available now
     SetRange(1);
+
     //SetCenter(0, 0);
 
     // Remark : Data member initializer is not allowed for ARM compiler,
-    //          initialize data in class constructor.   
+    //          initialize data in class constructor.
     runningTime = 0;
     lastScanTime = runningTime;
     currentBeamAngle = 0;
     lastBeamAngle = currentBeamAngle;
 
+    // Force background redraw
+    UnvalidateBackground();
+
 #ifndef _SDL_timer_h
     t.start();
 #endif
@@ -64,9 +72,6 @@
         currentBeamAngle -= 2 * M_PI;
     }
 
-    //pc.printf("Sector :%3.1f, %3.1f\r\n", lastBeamAngle*180.f/M_PI, currentBeamAngle*180.f / M_PI) ;
-    //pc.printf("Time : ms=%dms, r=%dms, l=%dms\r\n", msTime, runningTime, lastScanTime) ;
-
     RK043FN48H* display = (RK043FN48H*)GetDisplay();
 
     if(NeedsRedraw()) {
@@ -85,16 +90,19 @@
         _needsRedraw = false;
 
     }
-   
+
 #ifdef _SDL_timer_h
     runningTime = SDL_GetTicks();
 #else
     runningTime = t.read_ms();
 #endif
+    
     UpdateTargetsLocation(lastBeamAngle, currentBeamAngle, runningTime);
     
+    // Redraw foreground
     display->Clear();
     DrawTracks();
+
     DrawRadarBeam(currentBeamAngle);
 }
 
@@ -142,7 +150,7 @@
 
 void RadarDemo::UnvalidateBackground()
 {
-    _needsRedraw = false;
+    _needsRedraw = true;
 }