@@ -28,17 +28,17 @@ void Commander::run(){
28
28
// execute the user command
29
29
run (received_chars);
30
30
31
- // reset the command buffer
31
+ // reset the command buffer
32
32
received_chars[0 ] = 0 ;
33
33
rec_cnt=0 ;
34
34
}
35
35
}
36
36
}
37
37
38
38
void Commander::run (Stream& serial){
39
- Stream* tmp = com_port; // save the serial instance
39
+ Stream* tmp = com_port; // save the serial instance
40
40
// use the new serial instance to output if not available the one linked in constructor
41
- if (!tmp) com_port = &serial;
41
+ if (!tmp) com_port = &serial;
42
42
43
43
// a string to hold incoming data
44
44
while (serial.available ()) {
@@ -49,7 +49,7 @@ void Commander::run(Stream& serial){
49
49
// execute the user command
50
50
run (received_chars);
51
51
52
- // reset the command buffer
52
+ // reset the command buffer
53
53
received_chars[0 ] = 0 ;
54
54
rec_cnt=0 ;
55
55
}
@@ -111,27 +111,27 @@ void Commander::motor(FOCMotor* motor, char* user_command) {
111
111
112
112
// a bit of optimisation of variable memory for Arduino UNO (atmega328)
113
113
switch (cmd){
114
- case CMD_C_Q_PID: //
114
+ case CMD_C_Q_PID: //
115
115
printVerbose (F (" PID curr q| " ));
116
116
if (sub_cmd == SCMD_LPF_TF) lpf (&motor->LPF_current_q , &user_command[1 ]);
117
117
else pid (&motor->PID_current_q ,&user_command[1 ]);
118
118
break ;
119
- case CMD_C_D_PID: //
119
+ case CMD_C_D_PID: //
120
120
printVerbose (F (" PID curr d| " ));
121
121
if (sub_cmd == SCMD_LPF_TF) lpf (&motor->LPF_current_d , &user_command[1 ]);
122
122
else pid (&motor->PID_current_d , &user_command[1 ]);
123
123
break ;
124
- case CMD_V_PID: //
124
+ case CMD_V_PID: //
125
125
printVerbose (F (" PID vel| " ));
126
126
if (sub_cmd == SCMD_LPF_TF) lpf (&motor->LPF_velocity , &user_command[1 ]);
127
127
else pid (&motor->PID_velocity , &user_command[1 ]);
128
128
break ;
129
- case CMD_A_PID: //
129
+ case CMD_A_PID: //
130
130
printVerbose (F (" PID angle| " ));
131
131
if (sub_cmd == SCMD_LPF_TF) lpf (&motor->LPF_angle , &user_command[1 ]);
132
132
else pid (&motor->P_angle , &user_command[1 ]);
133
133
break ;
134
- case CMD_LIMITS: //
134
+ case CMD_LIMITS: //
135
135
printVerbose (F (" Limits| " ));
136
136
switch (sub_cmd){
137
137
case SCMD_LIM_VOLT: // voltage limit change
@@ -294,20 +294,20 @@ void Commander::motor(FOCMotor* motor, char* user_command) {
294
294
break ;
295
295
}
296
296
break ;
297
- case SCMD_DOWNSAMPLE:
297
+ case SCMD_DOWNSAMPLE:
298
298
printVerbose (F (" downsample: " ));
299
299
if (!GET) motor->monitor_downsample = value;
300
300
println ((int )motor->monitor_downsample );
301
301
break ;
302
- case SCMD_CLEAR:
303
- motor->monitor_variables = (uint8_t ) 0 ;
302
+ case SCMD_CLEAR:
303
+ motor->monitor_variables = (uint8_t ) 0 ;
304
304
println (F (" clear" ));
305
305
break ;
306
- case SCMD_SET:
307
- if (!GET) motor->monitor_variables = (uint8_t ) 0 ;
306
+ case SCMD_SET:
307
+ if (!GET) motor->monitor_variables = (uint8_t ) 0 ;
308
308
for (int i = 0 ; i < 7 ; i++){
309
309
if (user_command[value_index+i] == ' \n ' ) break ;
310
- if (!GET) motor->monitor_variables |= (user_command[value_index+i] - ' 0' ) << (6 -i);
310
+ if (!GET) motor->monitor_variables |= (user_command[value_index+i] - ' 0' ) << (6 -i);
311
311
print ( (user_command[value_index+i] - ' 0' ) );
312
312
}
313
313
println (" " );
@@ -371,7 +371,7 @@ void Commander::lpf(LowPassFilter* lpf, char* user_cmd){
371
371
printVerbose (F (" Tf: " ));
372
372
if (!GET) lpf->Tf = value;
373
373
println (lpf->Tf );
374
- break ;
374
+ break ;
375
375
default :
376
376
printError ();
377
377
break ;
@@ -435,5 +435,5 @@ void Commander::printVerbose(const __FlashStringHelper *message){
435
435
if (verbose == VerboseMode::user_friendly) print (message);
436
436
}
437
437
void Commander::printError (){
438
- print (F (" err" ));
438
+ println (F (" err" ));
439
439
}
0 commit comments