robot

Dependencies:   FastPWM3 mbed

Revision:
72:5f1da97d62e1
Parent:
71:292dfc44ca53
Child:
73:d44bc3a46942
--- a/main.cpp	Sun Feb 05 11:58:06 2017 +0000
+++ b/main.cpp	Sun Feb 05 12:23:46 2017 +0000
@@ -17,6 +17,7 @@
 #include "config_pins.h"
 #include "config_inverter.h"
 #include "config_driving.h"
+#include "config_logging.h"
 
 #include "main.h"
 
@@ -146,11 +147,10 @@
     return str * old + (1.0f - str) * x;
 }
 
-void debug_print() {
+void log() {
     io.pc->printf("%d,%d,%d,%d,%d,%d,%d,%d\n", (int) read.w, (int) control.d_ref, (int) control.d_filtered, (int) control.q_ref, (int) control.q_filtered, (int) (255 * control.torque_percent), 
                         (int) (255 * control.d_integral), (int) (255 * control.q_integral));
-    //io.pc->printf("%d\n", (int) (255 * control.torque_percent));
-    wait(0.01);
+    wait(1.0f / LOG_FREQUENCY);
 }
         
 
@@ -172,6 +172,8 @@
     BREMSInit(&io, &read, &foc, &control, false);
     
     for (;;) {
-        debug_print();
+        if (ENABLE_LOGGING) {
+            log();
+        }
     }
 }
\ No newline at end of file