Bayley Wang / Mbed 2 deprecated foc-ed_in_the_bot_compact

Dependencies:   FastPWM3 mbed

Files at this revision

API Documentation at this revision

Comitter:
bwang
Date:
Wed Feb 14 04:16:31 2018 +0000
Parent:
206:5c848ea69028
Child:
208:3f3fe99c73ad
Commit message:
02/13/2018 23:15 - cmd_flush() now works in all modes (otherwise the controller would only ever boot up in MODE_CFG)

Changed in this revision

CHANGELOG.txt Show annotated file Show diff for this revision Revisions of this file
CommandProcessor/cmd_set_get.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/CHANGELOG.txt	Wed Feb 14 01:33:47 2018 +0000
+++ b/CHANGELOG.txt	Wed Feb 14 04:16:31 2018 +0000
@@ -47,4 +47,5 @@
 02/11/2018 20:13 - scrambled the mode and error handling code in commutate() to be cleaner
 02/11/2018 21:11 - further improvements to mode handling, output overrides and output disabling now live in their own functions
 02/11/2018 21:21 - cmd_exit() checks that motor is not running
-02/13/2017 20:33 - set serial RX interrupt to be lower priority than commutation interrupt
\ No newline at end of file
+02/13/2017 20:33 - set serial RX interrupt to be lower priority than commutation interrupt
+02/13/2018 23:15 - cmd_flush() now works in all modes (otherwise the controller would only ever boot up in MODE_CFG);
\ No newline at end of file
--- a/CommandProcessor/cmd_set_get.cpp	Wed Feb 14 01:33:47 2018 +0000
+++ b/CommandProcessor/cmd_set_get.cpp	Wed Feb 14 04:16:31 2018 +0000
@@ -161,11 +161,10 @@
 }
 
 void cmd_flush(Serial *pc, PreferenceWriter *pref) {
-    if (BREMS_mode == MODE_RUN || BREMS_mode == MODE_ZERO || BREMS_mode == MODE_CHR) {
-        pc->printf("%s\n", "Can only do that in CFG mode");
+    if (control.user_cmd != 0.0f || control.torque_percent != 0.0f) {
+        pc->printf("%s\n", "Turn off motor first");
         return;
     }
-    
     io.logger->disable();
     if (!pref->ready()) pref->open();
     _PREFS_VALID = 1;