|
@@ -170,6 +170,8 @@
|
170
|
170
|
* M302 - Allow cold extrudes, or set the minimum extrude S<temperature>. (Requires PREVENT_COLD_EXTRUSION)
|
171
|
171
|
* M303 - PID relay autotune S<temperature> sets the target temperature. Default 150C. (Requires PIDTEMP)
|
172
|
172
|
* M304 - Set bed PID parameters P I and D. (Requires PIDTEMPBED)
|
|
173
|
+ * M350 - Set microstepping mode. (Requires digital microstepping pins.)
|
|
174
|
+ * M351 - Toggle MS1 MS2 pins directly. (Requires digital microstepping pins.)
|
173
|
175
|
* M355 - Turn the Case Light on/off and set its brightness. (Requires CASE_LIGHT_PIN)
|
174
|
176
|
* M380 - Activate solenoid on active extruder. (Requires EXT_SOLENOID)
|
175
|
177
|
* M381 - Disable all solenoids. (Requires EXT_SOLENOID)
|
|
@@ -194,6 +196,7 @@
|
194
|
196
|
* M666 - Set delta endstop adjustment. (Requires DELTA)
|
195
|
197
|
* M605 - Set dual x-carriage movement mode: "M605 S<mode> [X<x_offset>] [R<temp_offset>]". (Requires DUAL_X_CARRIAGE)
|
196
|
198
|
* M851 - Set Z probe's Z offset in current units. (Negative = below the nozzle.)
|
|
199
|
+ * M900 - Get and/or Set advance K factor and WH/D ratio. (Requires LIN_ADVANCE)
|
197
|
200
|
* M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given. (Requires HAVE_TMC2130)
|
198
|
201
|
* M907 - Set digital trimpot motor current using axis codes. (Requires a board with digital trimpots)
|
199
|
202
|
* M908 - Control digital trimpot directly. (Requires DAC_STEPPER_CURRENT or DIGIPOTSS_PIN)
|
|
@@ -203,8 +206,6 @@
|
203
|
206
|
* M912 - Clear stepper driver overtemperature pre-warn condition flag. (Requires HAVE_TMC2130)
|
204
|
207
|
* M913 - Set HYBRID_THRESHOLD speed. (Requires HYBRID_THRESHOLD)
|
205
|
208
|
* M914 - Set SENSORLESS_HOMING sensitivity. (Requires SENSORLESS_HOMING)
|
206
|
|
- * M350 - Set microstepping mode. (Requires digital microstepping pins.)
|
207
|
|
- * M351 - Toggle MS1 MS2 pins directly. (Requires digital microstepping pins.)
|
208
|
209
|
*
|
209
|
210
|
* M360 - SCARA calibration: Move to cal-position ThetaA (0 deg calibration)
|
210
|
211
|
* M361 - SCARA calibration: Move to cal-position ThetaB (90 deg calibration - steps per degree)
|
|
@@ -7141,7 +7142,7 @@ inline void gcode_M82() { axis_relative_modes[E_AXIS] = false; }
|
7141
|
7142
|
inline void gcode_M83() { axis_relative_modes[E_AXIS] = true; }
|
7142
|
7143
|
|
7143
|
7144
|
/**
|
7144
|
|
- * M18, M84: Disable all stepper motors
|
|
7145
|
+ * M18, M84: Disable stepper motors
|
7145
|
7146
|
*/
|
7146
|
7147
|
inline void gcode_M18_M84() {
|
7147
|
7148
|
if (code_seen('S')) {
|
|
@@ -8166,7 +8167,7 @@ inline void gcode_M303() {
|
8166
|
8167
|
}
|
8167
|
8168
|
|
8168
|
8169
|
/**
|
8169
|
|
- * M364: SCARA calibration: Move to cal-position PSIC (90 deg to Theta calibration position)
|
|
8170
|
+ * M364: SCARA calibration: Move to cal-position PsiC (90 deg to Theta calibration position)
|
8170
|
8171
|
*/
|
8171
|
8172
|
inline bool gcode_M364() {
|
8172
|
8173
|
SERIAL_ECHOLNPGM(" Cal: Theta-Psi 90");
|
|
@@ -8409,39 +8410,33 @@ void quickstop_stepper() {
|
8409
|
8410
|
#endif
|
8410
|
8411
|
|
8411
|
8412
|
#if ENABLED(MESH_BED_LEVELING)
|
|
8413
|
+
|
8412
|
8414
|
/**
|
8413
|
8415
|
* M421: Set a single Mesh Bed Leveling Z coordinate
|
8414
|
|
- * Use either 'M421 X<linear> Y<linear> Z<linear>' or 'M421 I<xindex> J<yindex> Z<linear>'
|
|
8416
|
+ *
|
|
8417
|
+ * Usage:
|
|
8418
|
+ * M421 X<linear> Y<linear> Z<linear>
|
|
8419
|
+ * M421 X<linear> Y<linear> Q<offset>
|
|
8420
|
+ * M421 I<xindex> J<yindex> Z<linear>
|
|
8421
|
+ * M421 I<xindex> J<yindex> Q<offset>
|
8415
|
8422
|
*/
|
8416
|
8423
|
inline void gcode_M421() {
|
|
8424
|
+ const bool hasX = code_seen('X'), hasI = code_seen('I');
|
|
8425
|
+ const int8_t ix = hasI ? code_value_byte() : hasX ? mbl.probe_index_x(RAW_X_POSITION(code_value_linear_units())) : -1;
|
|
8426
|
+ const bool hasY = code_seen('Y'), hasJ = code_seen('J');
|
|
8427
|
+ const int8_t iy = hasJ ? code_value_byte() : hasY ? mbl.probe_index_y(RAW_Y_POSITION(code_value_linear_units())) : -1;
|
|
8428
|
+ const bool hasZ = code_seen('Z'), hasQ = code_seen('Q');
|
8417
|
8429
|
|
8418
|
|
- const bool hasX = code_seen('X'), hasI = !hasX && code_seen('I');
|
8419
|
|
- const int8_t px = hasX || hasI ? mbl.probe_index_x(code_value_linear_units()) : 0;
|
8420
|
|
- const bool hasY = code_seen('Y'), hasJ = !hasY && code_seen('J');
|
8421
|
|
- const int8_t py = hasY || hasJ ? mbl.probe_index_y(code_value_linear_units()) : 0;
|
8422
|
|
- const bool hasZ = code_seen('Z');
|
8423
|
|
- const float z = hasZ ? code_value_linear_units() : 0;
|
8424
|
|
-
|
8425
|
|
- if (hasX && hasY && hasZ) {
|
8426
|
|
- if (px >= 0 && py >= 0)
|
8427
|
|
- mbl.set_z(px, py, z);
|
8428
|
|
- else {
|
8429
|
|
- SERIAL_ERROR_START;
|
8430
|
|
- SERIAL_ERRORLNPGM(MSG_ERR_MESH_XY);
|
8431
|
|
- }
|
8432
|
|
- }
|
8433
|
|
- else if (hasI && hasJ && hasZ) {
|
8434
|
|
- if (WITHIN(px, 0, GRID_MAX_POINTS_X - 1) && WITHIN(py, 0, GRID_MAX_POINTS_Y - 1))
|
8435
|
|
- mbl.set_z(px, py, z);
|
8436
|
|
- else {
|
8437
|
|
- SERIAL_ERROR_START;
|
8438
|
|
- SERIAL_ERRORLNPGM(MSG_ERR_MESH_XY);
|
8439
|
|
- }
|
8440
|
|
- }
|
8441
|
|
- else {
|
|
8430
|
+ if (int(hasI && hasJ) + int(hasX && hasY) != 1 || hasZ == hasQ) {
|
8442
|
8431
|
SERIAL_ERROR_START;
|
8443
|
8432
|
SERIAL_ERRORLNPGM(MSG_ERR_M421_PARAMETERS);
|
8444
|
8433
|
}
|
|
8434
|
+ else if (ix < 0 || iy < 0) {
|
|
8435
|
+ SERIAL_ERROR_START;
|
|
8436
|
+ SERIAL_ERRORLNPGM(MSG_ERR_MESH_XY);
|
|
8437
|
+ }
|
|
8438
|
+ else
|
|
8439
|
+ mbl.set_z(ix, iy, code_value_linear_units() + (hasQ ? mbl.z_values[ix][iy] : 0));
|
8445
|
8440
|
}
|
8446
|
8441
|
|
8447
|
8442
|
#elif ENABLED(AUTO_BED_LEVELING_BILINEAR)
|
|
@@ -8454,38 +8449,26 @@ void quickstop_stepper() {
|
8454
|
8449
|
* M421 I<xindex> J<yindex> Q<offset>
|
8455
|
8450
|
*/
|
8456
|
8451
|
inline void gcode_M421() {
|
8457
|
|
-
|
8458
|
8452
|
const bool hasI = code_seen('I');
|
8459
|
|
- const int8_t px = hasI ? code_value_int() : 0;
|
|
8453
|
+ const int8_t ix = hasI ? code_value_byte() : -1;
|
8460
|
8454
|
const bool hasJ = code_seen('J');
|
8461
|
|
- const int8_t py = hasJ ? code_value_int() : 0;
|
8462
|
|
- const bool hasZ = code_seen('Z'), hasQ = !hasZ && code_seen('Q');
|
8463
|
|
- const float z = hasZ || hasQ ? code_value_linear_units() : 0;
|
|
8455
|
+ const int8_t iy = hasJ ? code_value_byte() : -1;
|
|
8456
|
+ const bool hasZ = code_seen('Z'), hasQ = code_seen('Q');
|
8464
|
8457
|
|
8465
|
|
- if (!hasI || !hasJ || (hasQ && hasZ) || (!hasQ && !hasZ)) {
|
|
8458
|
+ if (!hasI || !hasJ || hasZ == hasQ) {
|
8466
|
8459
|
SERIAL_ERROR_START;
|
8467
|
8460
|
SERIAL_ERRORLNPGM(MSG_ERR_M421_PARAMETERS);
|
8468
|
|
- return;
|
8469
|
|
- }
|
8470
|
|
-
|
8471
|
|
- if (WITHIN(px, 0, GRID_MAX_POINTS_X - 1) && WITHIN(py, 0, GRID_MAX_POINTS_Y - 1)) {
|
8472
|
|
- if (hasZ) { // doing an absolute mesh value
|
8473
|
|
- z_values[px][py] = z;
|
8474
|
|
- #if ENABLED(ABL_BILINEAR_SUBDIVISION)
|
8475
|
|
- bed_level_virt_interpolate();
|
8476
|
|
- #endif
|
8477
|
|
- }
|
8478
|
|
- else { // doing an offset of a mesh value
|
8479
|
|
- z_values[px][py] += z;
|
8480
|
|
- #if ENABLED(ABL_BILINEAR_SUBDIVISION)
|
8481
|
|
- bed_level_virt_interpolate();
|
8482
|
|
- #endif
|
8483
|
|
- }
|
8484
|
8461
|
}
|
8485
|
|
- else { // bad indexes were specified for the mesh point
|
|
8462
|
+ else if (!WITHIN(ix, 0, GRID_MAX_POINTS_X - 1) || !WITHIN(iy, 0, GRID_MAX_POINTS_Y - 1)) {
|
8486
|
8463
|
SERIAL_ERROR_START;
|
8487
|
8464
|
SERIAL_ERRORLNPGM(MSG_ERR_MESH_XY);
|
8488
|
8465
|
}
|
|
8466
|
+ else {
|
|
8467
|
+ z_values[ix][iy] = code_value_linear_units() + (hasQ ? z_values[ix][iy] : 0);
|
|
8468
|
+ #if ENABLED(ABL_BILINEAR_SUBDIVISION)
|
|
8469
|
+ bed_level_virt_interpolate();
|
|
8470
|
+ #endif
|
|
8471
|
+ }
|
8489
|
8472
|
}
|
8490
|
8473
|
|
8491
|
8474
|
#elif ENABLED(AUTO_BED_LEVELING_UBL)
|
|
@@ -8499,37 +8482,24 @@ void quickstop_stepper() {
|
8499
|
8482
|
* M421 C Z<linear>
|
8500
|
8483
|
* M421 C Q<offset>
|
8501
|
8484
|
*/
|
8502
|
|
-
|
8503
|
8485
|
inline void gcode_M421() {
|
8504
|
|
-
|
8505
|
|
- // Get the closest position for 'C', if needed
|
8506
|
8486
|
const mesh_index_pair location = find_closest_mesh_point_of_type(REAL, current_position[X_AXIS], current_position[Y_AXIS], USE_NOZZLE_AS_REFERENCE, NULL, false);
|
8507
|
|
-
|
8508
|
8487
|
const bool hasC = code_seen('C'), hasI = code_seen('I');
|
8509
|
|
- const int8_t px = hasC ? location.x_index : hasI ? code_value_int() : 0;
|
8510
|
|
-
|
|
8488
|
+ const int8_t ix = hasI ? code_value_byte() : hasC ? location.x_index : -1;
|
8511
|
8489
|
const bool hasJ = code_seen('J');
|
8512
|
|
- const int8_t py = hasC ? location.y_index : hasJ ? code_value_int() : 0;
|
|
8490
|
+ const int8_t iy = hasJ ? code_value_byte() : hasC ? location.y_index : -1;
|
|
8491
|
+ const bool hasZ = code_seen('Z'), hasQ = code_seen('Q');
|
8513
|
8492
|
|
8514
|
|
- const bool hasZ = code_seen('Z'), hasQ = !hasZ && code_seen('Q');
|
8515
|
|
- const float z = hasZ || hasQ ? code_value_linear_units() : 0;
|
8516
|
|
-
|
8517
|
|
- if ( ((hasI && hasJ) == hasC) || (hasQ && hasZ) || (!hasQ && !hasZ)) {
|
|
8493
|
+ if (int(hasC) + int(hasI && hasJ) != 1 || hasZ == hasQ) {
|
8518
|
8494
|
SERIAL_ERROR_START;
|
8519
|
8495
|
SERIAL_ERRORLNPGM(MSG_ERR_M421_PARAMETERS);
|
8520
|
|
- return;
|
8521
|
8496
|
}
|
8522
|
|
-
|
8523
|
|
- if (WITHIN(px, 0, GRID_MAX_POINTS_X - 1) && WITHIN(py, 0, GRID_MAX_POINTS_Y - 1)) {
|
8524
|
|
- if (hasZ) // doing an absolute mesh value
|
8525
|
|
- ubl.z_values[px][py] = z;
|
8526
|
|
- else // doing an offset of a mesh value
|
8527
|
|
- ubl.z_values[px][py] += z;
|
8528
|
|
- }
|
8529
|
|
- else { // bad indexes were specified for the mesh point
|
|
8497
|
+ else if (!WITHIN(ix, 0, GRID_MAX_POINTS_X - 1) || !WITHIN(iy, 0, GRID_MAX_POINTS_Y - 1)) {
|
8530
|
8498
|
SERIAL_ERROR_START;
|
8531
|
8499
|
SERIAL_ERRORLNPGM(MSG_ERR_MESH_XY);
|
8532
|
8500
|
}
|
|
8501
|
+ else
|
|
8502
|
+ ubl.z_values[ix][iy] = code_value_linear_units() + (hasQ ? ubl.z_values[ix][iy] : 0);
|
8533
|
8503
|
}
|
8534
|
8504
|
|
8535
|
8505
|
#endif // AUTO_BED_LEVELING_UBL
|