Issuing the following sequence of commands results in a motion downsampling query turning into a set:
The issue is that once a sentinel character is found, the buffer is passed to run as-is:
|
// a string to hold incoming data |
|
while (serial.available()) { |
|
// get the new byte: |
|
int ch = serial.read(); |
|
received_chars[rec_cnt++] = (char)ch; |
|
// end of user input |
|
if(echo) |
|
print((char)ch); |
|
if (isSentinel(ch)) { |
|
// execute the user command |
|
run(received_chars); |
Later atof reads past the sentinel and picks up the trailing 5 in the buffer, and the downsampling is set to 5. The least invasive solution might be to null out the character after the sentinel (if we're not at the end of the buffer).
Issuing the following sequence of commands results in a motion downsampling query turning into a set:
MLC0.5MCDThe issue is that once a sentinel character is found, the buffer is passed to
runas-is:Arduino-FOC/src/communication/Commander.cpp
Lines 33 to 43 in 395b6cd
Later
atofreads past the sentinel and picks up the trailing5in the buffer, and the downsampling is set to 5. The least invasive solution might be to null out the character after the sentinel (if we're not at the end of the buffer).