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

@@ -34,7 +34,9 @@
* U<angle> - Stowed Angle
*/
void GcodeSuite::M281() {
if (!parser.seenval('P')) return;
const int servo_index = parser.value_int();
if (WITHIN(servo_index, 0, NUM_SERVOS - 1)) {
#if ENABLED(BLTOUCH)
@@ -53,16 +55,14 @@ void GcodeSuite::M281() {
angle_change = true;
}
if (!angle_change) {
SERIAL_ECHO_START();
SERIAL_ECHOLNPAIR(" Servo ", servo_index,
" L", servo_angles[servo_index][0],
" U", servo_angles[servo_index][1]);
SERIAL_ECHO_MSG(" Servo ", servo_index,
" L", servo_angles[servo_index][0],
" U", servo_angles[servo_index][1]);
}
}
else {
SERIAL_ERROR_START();
SERIAL_ECHOLNPAIR("Servo ", servo_index, " out of range");
}
else
SERIAL_ERROR_MSG("Servo ", servo_index, " out of range");
}
#endif // EDITABLE_SERVO_ANGLES

View File

@@ -35,14 +35,15 @@
* D<dval> - Set the D value
*/
void GcodeSuite::M304() {
if (parser.seen('P')) thermalManager.temp_bed.pid.Kp = parser.value_float();
if (parser.seen('I')) thermalManager.temp_bed.pid.Ki = scalePID_i(parser.value_float());
if (parser.seen('D')) thermalManager.temp_bed.pid.Kd = scalePID_d(parser.value_float());
SERIAL_ECHO_START();
SERIAL_ECHOLNPAIR(" p:", thermalManager.temp_bed.pid.Kp,
" i:", unscalePID_i(thermalManager.temp_bed.pid.Ki),
" d:", unscalePID_d(thermalManager.temp_bed.pid.Kd));
SERIAL_ECHO_MSG(" p:", thermalManager.temp_bed.pid.Kp,
" i:", unscalePID_i(thermalManager.temp_bed.pid.Ki),
" d:", unscalePID_d(thermalManager.temp_bed.pid.Kd));
}
#endif // PIDTEMPBED

View File

@@ -49,10 +49,8 @@ void GcodeSuite::M305() {
const bool do_set = parser.seen("BCRT");
// A valid P index is required
if (t_index >= (USER_THERMISTORS) || (do_set && t_index < 0)) {
SERIAL_ECHO_START();
SERIAL_ECHOLNPAIR("!Invalid index. (0 <= P <= ", int(USER_THERMISTORS - 1), ")");
}
if (t_index >= (USER_THERMISTORS) || (do_set && t_index < 0))
SERIAL_ECHO_MSG("!Invalid index. (0 <= P <= ", int(USER_THERMISTORS - 1), ")");
else if (do_set) {
if (parser.seen('R')) // Pullup resistor value
if (!thermalManager.set_pull_up_res(t_index, parser.value_float()))