Skip to content

Commit 95783d0

Browse files
committed
Commander err println
1 parent b30b0f5 commit 95783d0

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

src/communication/Commander.cpp

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,17 @@ void Commander::run(){
2828
// execute the user command
2929
run(received_chars);
3030

31-
// reset the command buffer
31+
// reset the command buffer
3232
received_chars[0] = 0;
3333
rec_cnt=0;
3434
}
3535
}
3636
}
3737

3838
void Commander::run(Stream& serial){
39-
Stream* tmp = com_port; // save the serial instance
39+
Stream* tmp = com_port; // save the serial instance
4040
// 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;
4242

4343
// a string to hold incoming data
4444
while (serial.available()) {
@@ -49,7 +49,7 @@ void Commander::run(Stream& serial){
4949
// execute the user command
5050
run(received_chars);
5151

52-
// reset the command buffer
52+
// reset the command buffer
5353
received_chars[0] = 0;
5454
rec_cnt=0;
5555
}
@@ -111,27 +111,27 @@ void Commander::motor(FOCMotor* motor, char* user_command) {
111111

112112
// a bit of optimisation of variable memory for Arduino UNO (atmega328)
113113
switch(cmd){
114-
case CMD_C_Q_PID: //
114+
case CMD_C_Q_PID: //
115115
printVerbose(F("PID curr q| "));
116116
if(sub_cmd == SCMD_LPF_TF) lpf(&motor->LPF_current_q, &user_command[1]);
117117
else pid(&motor->PID_current_q,&user_command[1]);
118118
break;
119-
case CMD_C_D_PID: //
119+
case CMD_C_D_PID: //
120120
printVerbose(F("PID curr d| "));
121121
if(sub_cmd == SCMD_LPF_TF) lpf(&motor->LPF_current_d, &user_command[1]);
122122
else pid(&motor->PID_current_d, &user_command[1]);
123123
break;
124-
case CMD_V_PID: //
124+
case CMD_V_PID: //
125125
printVerbose(F("PID vel| "));
126126
if(sub_cmd == SCMD_LPF_TF) lpf(&motor->LPF_velocity, &user_command[1]);
127127
else pid(&motor->PID_velocity, &user_command[1]);
128128
break;
129-
case CMD_A_PID: //
129+
case CMD_A_PID: //
130130
printVerbose(F("PID angle| "));
131131
if(sub_cmd == SCMD_LPF_TF) lpf(&motor->LPF_angle, &user_command[1]);
132132
else pid(&motor->P_angle, &user_command[1]);
133133
break;
134-
case CMD_LIMITS: //
134+
case CMD_LIMITS: //
135135
printVerbose(F("Limits| "));
136136
switch (sub_cmd){
137137
case SCMD_LIM_VOLT: // voltage limit change
@@ -294,20 +294,20 @@ void Commander::motor(FOCMotor* motor, char* user_command) {
294294
break;
295295
}
296296
break;
297-
case SCMD_DOWNSAMPLE:
297+
case SCMD_DOWNSAMPLE:
298298
printVerbose(F("downsample: "));
299299
if(!GET) motor->monitor_downsample = value;
300300
println((int)motor->monitor_downsample);
301301
break;
302-
case SCMD_CLEAR:
303-
motor->monitor_variables = (uint8_t) 0;
302+
case SCMD_CLEAR:
303+
motor->monitor_variables = (uint8_t) 0;
304304
println(F("clear"));
305305
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;
308308
for(int i = 0; i < 7; i++){
309309
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);
311311
print( (user_command[value_index+i] - '0') );
312312
}
313313
println("");
@@ -371,7 +371,7 @@ void Commander::lpf(LowPassFilter* lpf, char* user_cmd){
371371
printVerbose(F("Tf: "));
372372
if(!GET) lpf->Tf = value;
373373
println(lpf->Tf);
374-
break;
374+
break;
375375
default:
376376
printError();
377377
break;
@@ -435,5 +435,5 @@ void Commander::printVerbose(const __FlashStringHelper *message){
435435
if(verbose == VerboseMode::user_friendly) print(message);
436436
}
437437
void Commander::printError(){
438-
print(F("err"));
438+
println(F("err"));
439439
}

0 commit comments

Comments
 (0)