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:
Tue Nov 13 17:23:50 2018 +0000
Parent:
248:c4539ee69052
Child:
250:ef028cbd0749
Commit message:
11/13/2018 12:33 - changes to rxCallback() - fast commands no longer print "\r>" after completion; non-ASCII chars are no longer echoed

Changed in this revision

CHANGELOG.txt Show annotated file Show diff for this revision Revisions of this file
COMMANDS.txt Show annotated file Show diff for this revision Revisions of this file
Transforms/COMMANDS.txt Show diff for this revision Revisions of this file
callbacks.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/CHANGELOG.txt	Tue Nov 13 16:21:06 2018 +0000
+++ b/CHANGELOG.txt	Tue Nov 13 17:23:50 2018 +0000
@@ -83,4 +83,6 @@
 11/12/2018 07:42 - PWM configured to be non-inverting in BREMSConfigRegisters, moved inverting code to hardware.h like it should be
 11/13/2018 10:05 - added io.cmd_busy flag to block execution of processCmd() during execution of processCmd()
 11/13/2018 11:04 - added fast commands (which have command and data > 127 and aren't issuable from a terminal)
-11/13/2018 11:20 - added COMMANDS.txt, added bounds check in OP_TORQUE
\ No newline at end of file
+11/13/2018 11:20 - added COMMANDS.txt, added bounds check in OP_TORQUE
+11/13/2018 12:00 - moved COMMANDS.txt to the right location
+11/13/2018 12:33 - changes to rxCallback() - fast commands no longer print "\r>" after completion; non-ASCII chars are no longer echoed
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/COMMANDS.txt	Tue Nov 13 17:23:50 2018 +0000
@@ -0,0 +1,41 @@
+MODE SWITCHING
+
+run: puts the controller in RUN mode
+cfg: puts the controller in CONFIG mode - necessary to run some commands
+zero: zeroes encoder, loading result into POS_OFFSET
+wizard: motor characterization, unimplemented.
+
+mode <run | cfg | zero | wizard>: same as above
+
+src <rc | analog | terminal | serial | can | internal>: sets control source
+
+op <torque | driving | speed | position>: sets operation. user command maps to percent max torque, speed, or position.
+
+setp <value>: sets user command
+
+SETTING AND GETTING PARAMETERS
+
+ls: list all flash-stored parameters and values
+ls <param name>: print the value of one parameter
+get <param_name>: same as ls
+
+load | reload: reload all parameters from flash
+flush: write current working parameter set to flash
+
+set <param_name> <value>: sets a parameter; new value is used immediately
+
+query <w | cmd | d | q | d_ref | q_ref | vd | vq | tq | ia | ib | ic>: displays a variable
+query errors: displays error status
+
+MISC
+
+clear: clears screen on compliant terminals
+exit: same as run
+
+FAST COMMANDS:
+
+These are non-printable commands that execute much faster than their printable equivalents
+
+[128] [value]: sets user command to (value - 127) / 128
+[129]: returns velocity as a signed 16-bit int
+[130]: sends back one logger data packet, containing useful information about current controller state
\ No newline at end of file
--- a/Transforms/COMMANDS.txt	Tue Nov 13 16:21:06 2018 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,41 +0,0 @@
-MODE SWITCHING
-
-run: puts the controller in RUN mode
-cfg: puts the controller in CONFIG mode - necessary to run some commands
-zero: zeroes encoder, loading result into POS_OFFSET
-wizard: motor characterization, unimplemented.
-
-mode <run | cfg | zero | wizard>: same as above
-
-src <rc | analog | terminal | serial | can | internal>: sets control source
-
-op <torque | driving | speed | position>: sets operation. user command maps to percent max torque, speed, or position.
-
-setp <value>: sets user command
-
-SETTING AND GETTING PARAMETERS
-
-ls: list all flash-stored parameters and values
-ls <param name>: print the value of one parameter
-get <param_name>: same as ls
-
-load | reload: reload all parameters from flash
-flush: write current working parameter set to flash
-
-set <param_name> <value>: sets a parameter; new value is used immediately
-
-query <w | cmd | d | q | d_ref | q_ref | vd | vq | tq | ia | ib | ic>: displays a variable
-query errors: displays error status
-
-MISC
-
-clear: clears screen on compliant terminals
-exit: same as run
-
-FAST COMMANDS:
-
-These are non-printable commands that execute much faster than their printable equivalents
-
-[128] [value]: sets user command to (value - 127) / 128
-[129]: sends velocity as a signed 16-bit int
-[130]: sends back one logger data packet, containing useful information about current controller state
\ No newline at end of file
--- a/callbacks.cpp	Tue Nov 13 16:21:06 2018 +0000
+++ b/callbacks.cpp	Tue Nov 13 17:23:50 2018 +0000
@@ -14,7 +14,7 @@
         if (c != 127 && c != 8 && c != '\r' && c != '\t') {
             linebuf[index] = c;
             if (index < 127) index++;
-            io.pc->putc(c);
+            if (c < 128) io.pc->putc(c);
         } else if (c == 127 || c == 8) {
             if (index > 0) {
                 index--;
@@ -23,13 +23,14 @@
             }
         } else if (c == '\r') {
             linebuf[index] = 0;
-            io.pc->putc(c);
-            if (!io.cmd_busy) {
-                if (linebuf[0] > 127) processCmdFast(io.pc, io.pref, linebuf);
-                else processCmd(io.pc, io.pref, linebuf);
+            if (!io.cmd_busy && linebuf[0] > 127) {
+                processCmdFast(io.pc, io.pref, linebuf);
+            } else if (!io.cmd_busy) {
+                processCmd(io.pc, io.pref, linebuf);
+                io.pc->putc(c);
+                io.pc->putc('>');
             }
             index = 0;
-            io.pc->putc('>');
         }
     }
 }