local timers

Dependencies:   TextLCD mbed-rtos mbed

Fork of pacemaker_FINAL_v2 by Pacemaker

Revision:
6:704de3abb5e9
Parent:
5:8cd62e3c3c3a
Child:
7:e3f58c82a4d6
--- a/main.cpp	Thu Dec 04 03:26:06 2014 +0000
+++ b/main.cpp	Thu Dec 04 03:47:04 2014 +0000
@@ -70,14 +70,9 @@
     while (1) {
         Thread::signal_wait(RUN, osWaitForever);
         int done = 0;
-        ta.reset();
         while (!done) {
-            if (AGet == 1 && !isPVARP) {
-                V_thread->signal_set(RUN);
-                flashLED(4);
-                done = 1;
-            }
             if (ta.read_ms() >= LRI-AVI) {
+                tv.reset();
                 V_thread->signal_set(RUN);
                 APace = 1;
                 Thread::wait(2);
@@ -85,6 +80,12 @@
                 flashLED(2);
                 done = 1;
             }
+            if (AGet == 1 && !isPVARP) {
+                tv.reset();
+                V_thread->signal_set(RUN);
+                flashLED(4);
+                done = 1;
+            }
         }
     }
 }
@@ -93,15 +94,9 @@
     while (1) {
         Thread::signal_wait(RUN, osWaitForever);
         int done = 0;
-        tv.reset();
         while (!done) {
-            if (VGet == 1 && !isVRP) {
-                A_thread->signal_set(RUN);
-                blind();
-                flashLED(3);
-                done = 1;
-            }
             if (tv.read_ms() >= AVI) {
+                ta.reset();
                 A_thread->signal_set(RUN);
                 VPace = 1;
                 Thread::wait(2);
@@ -110,6 +105,13 @@
                 flashLED(1);
                 done = 1;
             }
+            if (VGet == 1 && !isVRP) {
+                ta.reset();
+                A_thread->signal_set(RUN);
+                blind();
+                flashLED(3);
+                done = 1;
+            }
         }
     }
 }