Use serial shorthand

This commit is contained in:
Scott Lahteine
2021-02-04 23:22:42 -06:00
parent 49564e5310
commit 708ea3d0bb
21 changed files with 88 additions and 132 deletions

View File

@ -31,7 +31,9 @@
* M280: Get or set servo position. P<index> [S<angle>]
*/
void GcodeSuite::M280() {
if (!parser.seen('P')) return;
const int servo_index = parser.value_int();
if (WITHIN(servo_index, 0, NUM_SERVOS - 1)) {
if (parser.seen('S')) {
@ -41,15 +43,12 @@ void GcodeSuite::M280() {
else
MOVE_SERVO(servo_index, a);
}
else {
SERIAL_ECHO_START();
SERIAL_ECHOLNPAIR(" Servo ", servo_index, ": ", servo[servo_index].read());
}
}
else {
SERIAL_ERROR_START();
SERIAL_ECHOLNPAIR("Servo ", servo_index, " out of range");
else
SERIAL_ECHO_MSG(" Servo ", servo_index, ": ", servo[servo_index].read());
}
else
SERIAL_ERROR_MSG("Servo ", servo_index, " out of range");
}
#endif // HAS_SERVOS