Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of PsiSwarmV9 by
Diff: demo.cpp
- Revision:
- 20:2b6ebe60929d
- Parent:
- 19:3e3b03d80ea3
diff -r 3e3b03d80ea3 -r 2b6ebe60929d demo.cpp
--- a/demo.cpp	Mon Jun 05 22:47:14 2017 +0000
+++ b/demo.cpp	Mon Jul 08 10:50:40 2019 +0000
@@ -126,7 +126,7 @@
     if(!handling_event) {
         handling_event = 1;
         last_switch_pressed = switch_pressed;
-        demo_event.attach_us(this,&Demo::demo_event_thread, 1000);
+        demo_event.attach_us(callback(this, &Demo::demo_event_thread), 1000);
     }
 }
 
@@ -866,7 +866,7 @@
     display.write_string(bottomline);
     // Periodically update when on sensors menu
     if(top_menu == 2  && level == 1) {
-        demo_event.attach(this,&Demo::demo_event_thread, 0.25);
+        demo_event.attach(callback(this, &Demo::demo_event_thread), 0.25);
     }
 }
 
@@ -1041,7 +1041,7 @@
         if(test_step == 4) test_step = 0;
     }
 
-    demo_timeout.attach_us(this,&Demo::quick_test_cycle, wait_period);
+    demo_timeout.attach_us(callback(this, &Demo::quick_test_cycle), wait_period);
 }
 
 void Demo::toggle_quick_test()
@@ -1060,12 +1060,12 @@
     } else {
         // Reset all LEDs, motors, display
         pc.printf("\n________________________________________\n");
-        pc.printf("Self test started at %f\n\n",psi.get_uptime(),test_warnings);
+        pc.printf("Self test started at %f\n\n", psi.get_uptime());//, test_warnings);
         display.clear_display();
         test_step = 0;
         test_substep = 0;
         demo_running = 1;
-        demo_timeout.attach_us(this,&Demo::quick_test_cycle,1000);
+        demo_timeout.attach_us(callback(this, &Demo::quick_test_cycle), 1000);
     }
 }
 
@@ -1078,7 +1078,7 @@
     speed = 0;
     led_step = 0;
     demo_running = 1;
-    demo_timeout.attach_us(this,&Demo::line_demo_cycle,1000);
+    demo_timeout.attach_us(callback(this, &Demo::line_demo_cycle), 1000);
 }
 
 void Demo::start_obstacle_demo()
@@ -1090,7 +1090,7 @@
     speed = 0;
     led_step = 0;
     demo_running = 1;
-    demo_timeout.attach_us(this,&Demo::obstacle_demo_cycle,1000);
+    demo_timeout.attach_us(callback(this, &Demo::obstacle_demo_cycle), 1000);
 }
 
 void Demo::start_colour_demo()
@@ -1103,7 +1103,7 @@
     led_step = 0;
     demo_running = 1;
     colour.start_colour_ticker(100);
-    demo_timeout.attach_us(this,&Demo::colour_demo_cycle,1000);
+    demo_timeout.attach_us(callback(this, &Demo::colour_demo_cycle), 1000);
 }
 
 void Demo::start_stress_demo()
@@ -1119,7 +1119,7 @@
     stress_step = 0;
     spin_step = 0;
     demo_running = 1;
-    demo_timeout.attach_us(this,&Demo::stress_demo_cycle,1000);
+    demo_timeout.attach_us(callback(this, &Demo::stress_demo_cycle), 1000);
 }
 
 void Demo::start_spinning_demo()
@@ -1132,7 +1132,7 @@
     led_step = 0;
     spin_step = 0;
     demo_running = 1;
-    demo_timeout.attach_us(this,&Demo::spinning_demo_cycle,1000);
+    demo_timeout.attach_us(callback(this, &Demo::spinning_demo_cycle), 1000);
 }
 
 void Demo::line_demo_cycle()
@@ -1209,7 +1209,7 @@
 
         demo_timer.reset();
     }
-    if(demo_running == 1)demo_timeout.attach_us(this,&Demo::line_demo_cycle,500);
+    if(demo_running == 1)demo_timeout.attach_us(callback(this, &Demo::line_demo_cycle), 500);
     else {
         motors.stop();
         display.set_backlight_brightness(bl_brightness * 0.01f);
@@ -1256,7 +1256,7 @@
         }
         demo_timer.reset();
     }
-    if(demo_running == 1)demo_timeout.attach_us(this,&Demo::stress_demo_cycle,500);
+    if(demo_running == 1)demo_timeout.attach_us(callback(this, &Demo::stress_demo_cycle), 500);
     else {
         motors.stop();
         display.set_backlight_brightness(bl_brightness * 0.01f);
@@ -1494,7 +1494,7 @@
         }
         demo_timer.reset();
     }
-    if(demo_running == 1)demo_timeout.attach_us(this,&Demo::spinning_demo_cycle,500);
+    if(demo_running == 1)demo_timeout.attach_us(callback(this, &Demo::spinning_demo_cycle), 500);
     else {
         motors.stop();
         display.set_backlight_brightness(bl_brightness * 0.01f);
@@ -1562,7 +1562,7 @@
         }
         demo_timer.reset();
     }
-    if(demo_running == 1)demo_timeout.attach_us(this,&Demo::colour_demo_cycle,200);
+    if(demo_running == 1)demo_timeout.attach_us(callback(this, &Demo::colour_demo_cycle), 200);
     else {
         motors.stop();
         display.set_backlight_brightness(bl_brightness * 0.01f);
@@ -1639,7 +1639,7 @@
         }
         demo_timer.reset();
     }
-    if(demo_running == 1)demo_timeout.attach_us(this,&Demo::obstacle_demo_cycle,200);
+    if(demo_running == 1)demo_timeout.attach_us(callback(this, &Demo::obstacle_demo_cycle), 200);
     else {
         motors.stop();
         display.set_backlight_brightness(bl_brightness * 0.01f);
    