robot

Dependencies:   FastPWM3 mbed

Revision:
155:7c6005933d4c
Parent:
151:5bbb15351798
Child:
221:1e607c8d7d76
--- a/PwmIn/PwmIn.cpp	Thu May 04 16:52:04 2017 +0000
+++ b/PwmIn/PwmIn.cpp	Thu May 04 17:35:10 2017 +0000
@@ -38,19 +38,18 @@
 
 void PwmIn::handle_fall()
 {
-    int usecs_new = timer.read_us();
+    if (!risen) return;
+    risen = false;
+    
+    if (blocked) {
+        blocked = false;;
+        return;
+    }
+    
+    usecs = timer.read_us();
     timer.stop();
     timer.reset();
     timer.start();
-    
-    if (blocked) {
-        blocked = false;
-        risen = false;
-        return;
-    }
-    
-    if (risen) usecs = usecs_new;
-    risen = false;
 }
 
 float PwmIn::get_throttle()