potato

Dependencies:   mbed

Fork of analoghalls by N K

Revision:
3:86ccde39f61b
Parent:
2:b5c19d4eddcc
Child:
4:f18f6bc5e1fd
diff -r b5c19d4eddcc -r 86ccde39f61b isr.cpp
--- a/isr.cpp	Mon Feb 23 19:42:50 2015 +0000
+++ b/isr.cpp	Wed Feb 25 04:44:05 2015 +0000
@@ -63,7 +63,7 @@
         break;
     }   
 #endif    
-    if (motor->halt) {
+    if (motor->halt || motor->debug_stop) {
         setDtcA(0);
         setDtcB(1.0f);
         setDtcC(0);
@@ -96,6 +96,16 @@
     
     if(motor->angle > 360.0f) motor->angle = 360.0f;
     if(motor->angle < 0) motor->angle = 0;
+    
+#ifdef __DEBUG
+    if (!motor->halt) {
+        fbuffer[bufidx] = motor->angle;
+        bufidx++;
+    }
+    if (bufidx == 10000) {
+        motor->debug_stop = 1;
+    }
+#endif
 }
 
 void throttle_update() {