File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed
Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -43,11 +43,11 @@ void Commander::run(Stream& serial, char eol){
4343 run (received_chars);
4444
4545 // reset the command buffer
46- received_chars[ 0 ] = 0 ;
46+ memset ( received_chars, 0 , MAX_COMMAND_LENGTH) ;
4747 rec_cnt=0 ;
4848 }
4949 if (rec_cnt>=MAX_COMMAND_LENGTH) { // prevent buffer overrun if message is too long
50- received_chars[ 0 ] = 0 ;
50+ memset ( received_chars, 0 , MAX_COMMAND_LENGTH) ;
5151 rec_cnt=0 ;
5252 }
5353 }
@@ -380,7 +380,8 @@ void Commander::motor(FOCMotor* motor, char* user_command) {
380380void Commander::motion (FOCMotor* motor, char * user_cmd, char * separator){
381381 char cmd = user_cmd[0 ];
382382 char sub_cmd = user_cmd[1 ];
383- bool GET = isSentinel (user_cmd[1 ]);
383+ int value_index = (sub_cmd == SCMD_DOWNSAMPLE) ? 2 : 1 ;
384+ bool GET = isSentinel (user_cmd[value_index]);
384385 float value = atof (&user_cmd[(sub_cmd >= ' A' && sub_cmd <= ' Z' ) ? 2 : 1 ]);
385386
386387 switch (cmd){
You can’t perform that action at this time.
0 commit comments