Marumbo Sichinga / Mbed 2 deprecated SmartWatchTopicDisplay

Dependencies:   mbed

Revision:
4:63bf2f3d54a5
Parent:
3:ab4d9bcf8dd1
Child:
5:235bf7c41262
--- a/main.cpp	Sat Jul 10 19:45:53 2021 +0000
+++ b/main.cpp	Sat Jul 10 21:40:09 2021 +0000
@@ -140,11 +140,6 @@
 Ticker flipper;
  
  
- 
-volatile bool running = true;
- 
- 
- 
 void PrintTemperatureAndTime() {
         
         time_t seconds = time(NULL);
@@ -183,7 +178,7 @@
 void StartButtonTimer(){
     printf("Button Timer start \n");
     buttonTimerStart = time(NULL);
-    printf("Button timer start: %d \n",buttonTimerStart);
+    printf("Button timer start: %ld \n",buttonTimerStart);
     wait(0.5);
     
   
@@ -199,8 +194,8 @@
     loraDuration = loraTimerStop - loraTimerStart;
     
     buttonDuration = buttonTimerStop - buttonTimerStart;
-    printf("Duration Lora: %ld \n", loraDuration); 
-    printf("Duration Button: %ld \n", buttonDuration); 
+    printf("Duration Lora: %d \n", loraDuration); 
+    printf("Duration Button: %d \n", buttonDuration); 
     
     DurationCheck();
    
@@ -280,13 +275,13 @@
     loraTimerStart = time(NULL);
     Display(content[current_topic][1]);
 
-    pushButton.fall(callback(&StopButtonTimer)); 
-    pushButton.rise(callback(&StartButtonTimer));
-    
 }
  
 void CheckDirection(){
+    pushButton.rise(callback(&StartButtonTimer)); 
+    pushButton.fall(callback(&StopButtonTimer));
     
+    while(1) {
     if(direction == 0) //O is a forward direction
     {
         redLed = 0;
@@ -300,6 +295,9 @@
         blueLed = 0;
         PrintContent();
     }
+    
+    wait_ms(200);
+    }
 }
  
 void BlinkWhiteLed() {
@@ -325,9 +323,12 @@
   
     printf("Mode 2... \n");
     printf("current topic %s \n", content[current_topic][0].c_str());
+    flipper.detach();
+    
     lcd.cls();
+    wait_ms(500);
     CheckDirection();
-    Mode1();
+ 
     
 }