Use serial shorthand
This commit is contained in:
@ -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
|
||||
|
Reference in New Issue
Block a user