|
@@ -1276,16 +1276,17 @@ void get_available_commands() {
|
1276
|
1276
|
*
|
1277
|
1277
|
* Returns TRUE if the target is invalid
|
1278
|
1278
|
*/
|
1279
|
|
-bool get_target_extruder_from_command(int code) {
|
|
1279
|
+bool get_target_extruder_from_command(const uint16_t code) {
|
1280
|
1280
|
if (parser.seen('T')) {
|
1281
|
|
- if (parser.value_byte() >= EXTRUDERS) {
|
|
1281
|
+ const int8_t e = parser.value_byte();
|
|
1282
|
+ if (e >= EXTRUDERS) {
|
1282
|
1283
|
SERIAL_ECHO_START();
|
1283
|
1284
|
SERIAL_CHAR('M');
|
1284
|
1285
|
SERIAL_ECHO(code);
|
1285
|
|
- SERIAL_ECHOLNPAIR(" " MSG_INVALID_EXTRUDER " ", parser.value_byte());
|
|
1286
|
+ SERIAL_ECHOLNPAIR(" " MSG_INVALID_EXTRUDER " ", e);
|
1286
|
1287
|
return true;
|
1287
|
1288
|
}
|
1288
|
|
- target_extruder = parser.value_byte();
|
|
1289
|
+ target_extruder = e;
|
1289
|
1290
|
}
|
1290
|
1291
|
else
|
1291
|
1292
|
target_extruder = active_extruder;
|
|
@@ -5676,7 +5677,7 @@ inline void gcode_G92() {
|
5676
|
5677
|
#if HAS_POSITION_SHIFT
|
5677
|
5678
|
const float p = current_position[i];
|
5678
|
5679
|
#endif
|
5679
|
|
- float v = parser.value_axis_units((AxisEnum)i);
|
|
5680
|
+ const float v = parser.value_axis_units((AxisEnum)i);
|
5680
|
5681
|
|
5681
|
5682
|
current_position[i] = v;
|
5682
|
5683
|
|
|
@@ -6405,7 +6406,7 @@ static bool pin_is_protected(const int8_t pin) {
|
6405
|
6406
|
inline void gcode_M42() {
|
6406
|
6407
|
if (!parser.seen('S')) return;
|
6407
|
6408
|
|
6408
|
|
- int pin_status = parser.value_int();
|
|
6409
|
+ const int pin_status = parser.value_int();
|
6409
|
6410
|
if (!WITHIN(pin_status, 0, 255)) return;
|
6410
|
6411
|
|
6411
|
6412
|
int pin_number = parser.seen('P') ? parser.value_int() : LED_PIN;
|
|
@@ -6645,7 +6646,7 @@ inline void gcode_M42() {
|
6645
|
6646
|
*/
|
6646
|
6647
|
inline void gcode_M43() {
|
6647
|
6648
|
|
6648
|
|
- if (parser.seen('T')) { // must be first or else it's "S" and "E" parameters will execute endstop or servo test
|
|
6649
|
+ if (parser.seen('T')) { // must be first or else its "S" and "E" parameters will execute endstop or servo test
|
6649
|
6650
|
toggle_pins();
|
6650
|
6651
|
return;
|
6651
|
6652
|
}
|
|
@@ -8268,10 +8269,10 @@ inline void gcode_M205() {
|
8268
|
8269
|
home_offset[Z_AXIS] = parser.value_linear_units() - DELTA_HEIGHT;
|
8269
|
8270
|
update_software_endstops(Z_AXIS);
|
8270
|
8271
|
}
|
8271
|
|
- if (parser.seen('L')) delta_diagonal_rod = parser.value_linear_units();
|
8272
|
|
- if (parser.seen('R')) delta_radius = parser.value_linear_units();
|
8273
|
|
- if (parser.seen('S')) delta_segments_per_second = parser.value_float();
|
8274
|
|
- if (parser.seen('B')) delta_calibration_radius = parser.value_float();
|
|
8272
|
+ if (parser.seen('L')) delta_diagonal_rod = parser.value_linear_units();
|
|
8273
|
+ if (parser.seen('R')) delta_radius = parser.value_linear_units();
|
|
8274
|
+ if (parser.seen('S')) delta_segments_per_second = parser.value_float();
|
|
8275
|
+ if (parser.seen('B')) delta_calibration_radius = parser.value_float();
|
8275
|
8276
|
if (parser.seen('X')) delta_tower_angle_trim[A_AXIS] = parser.value_float();
|
8276
|
8277
|
if (parser.seen('Y')) delta_tower_angle_trim[B_AXIS] = parser.value_float();
|
8277
|
8278
|
if (parser.seen('Z')) { // rotate all 3 axis for Z = 0
|
|
@@ -8580,7 +8581,7 @@ inline void gcode_M226() {
|
8580
|
8581
|
*/
|
8581
|
8582
|
inline void gcode_M280() {
|
8582
|
8583
|
if (!parser.seen('P')) return;
|
8583
|
|
- int servo_index = parser.value_int();
|
|
8584
|
+ const int servo_index = parser.value_int();
|
8584
|
8585
|
if (WITHIN(servo_index, 0, NUM_SERVOS - 1)) {
|
8585
|
8586
|
if (parser.seen('S'))
|
8586
|
8587
|
MOVE_SERVO(servo_index, parser.value_int());
|
|
@@ -8753,7 +8754,7 @@ inline void gcode_M226() {
|
8753
|
8754
|
* M302 S170 P1 ; set min extrude temp to 170 but leave disabled
|
8754
|
8755
|
*/
|
8755
|
8756
|
inline void gcode_M302() {
|
8756
|
|
- bool seen_S = parser.seen('S');
|
|
8757
|
+ const bool seen_S = parser.seen('S');
|
8757
|
8758
|
if (seen_S) {
|
8758
|
8759
|
thermalManager.extrude_min_temp = parser.value_celsius();
|
8759
|
8760
|
thermalManager.allow_cold_extrude = (thermalManager.extrude_min_temp == 0);
|
|
@@ -8960,10 +8961,12 @@ inline void gcode_M400() { stepper.synchronize(); }
|
8960
|
8961
|
* M405: Turn on filament sensor for control
|
8961
|
8962
|
*/
|
8962
|
8963
|
inline void gcode_M405() {
|
8963
|
|
- // This is technically a linear measurement, but since it's quantized to centimeters and is a different unit than
|
8964
|
|
- // everything else, it uses parser.value_int() instead of parser.value_linear_units().
|
8965
|
|
- if (parser.seen('D')) meas_delay_cm = parser.value_byte();
|
8966
|
|
- NOMORE(meas_delay_cm, MAX_MEASUREMENT_DELAY);
|
|
8964
|
+ // This is technically a linear measurement, but since it's quantized to centimeters and is a different
|
|
8965
|
+ // unit than everything else, it uses parser.value_byte() instead of parser.value_linear_units().
|
|
8966
|
+ if (parser.seen('D')) {
|
|
8967
|
+ meas_delay_cm = parser.value_byte();
|
|
8968
|
+ NOMORE(meas_delay_cm, MAX_MEASUREMENT_DELAY);
|
|
8969
|
+ }
|
8967
|
8970
|
|
8968
|
8971
|
if (filwidth_delay_index[1] == -1) { // Initialize the ring buffer if not done since startup
|
8969
|
8972
|
const uint8_t temp_ratio = thermalManager.widthFil_to_size_ratio() - 100; // -100 to scale within a signed byte
|