Safeguard serial error prints
This commit is contained in:
@@ -32,7 +32,9 @@ void Motion::moveTask(void * args) {
|
||||
uint32_t runtime = (uint32_t)args;
|
||||
|
||||
if (!Motion::left.setSpeed(LEFT_MOTOR_DUTY) || !Motion::right.setSpeed(RIGHT_MOTOR_DUTY)) {
|
||||
Serial.println("ailed to start motors due to power constraints");
|
||||
if(Serial){
|
||||
Serial.println("Failed to start motors due to power constraints");
|
||||
}
|
||||
Motion::stop(); // Use to clean up
|
||||
return;
|
||||
}
|
||||
@@ -123,7 +125,9 @@ void Motion::leftMotorTask(void * args) {
|
||||
}
|
||||
Motion::right.setSpeed(0);
|
||||
if(!Motion::left.setSpeed(LEFT_MOTOR_DUTY)){
|
||||
Serial.println("Can not rotate Clockwise due to power constraints");
|
||||
if(Serial){
|
||||
Serial.println("Can not rotate Clockwise due to power constraints");
|
||||
}
|
||||
Motion::stop();
|
||||
return;
|
||||
}
|
||||
@@ -166,7 +170,10 @@ void Motion::rightMotorTask(void * args) {
|
||||
xClockwiseTaskHandle = NULL;
|
||||
}
|
||||
if(!Motion::left.setSpeed(RIGHT_MOTOR_DUTY)){
|
||||
Serial.println("Can not rotate Antilockwise due to power constraints");
|
||||
if(Serial){
|
||||
Serial.println(
|
||||
"Can not rotate Antilcockwise due to power constraints");
|
||||
}
|
||||
Motion::stop();
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user