Change M421 to take coordinates
This makes `M421` more amenable for irregular matrices
This commit is contained in:
parent
fb379384ee
commit
ff178d8cf7
@ -188,7 +188,7 @@
|
|||||||
* M407 - Display measured filament diameter
|
* M407 - Display measured filament diameter
|
||||||
* M410 - Quickstop. Abort all the planned moves
|
* M410 - Quickstop. Abort all the planned moves
|
||||||
* M420 - Enable/Disable Mesh Leveling (with current values) S1=enable S0=disable
|
* M420 - Enable/Disable Mesh Leveling (with current values) S1=enable S0=disable
|
||||||
* M421 - Set a single Z coordinate in the Mesh Leveling grid. X<index> Y<index> Z<offset in mm>
|
* M421 - Set a single Z coordinate in the Mesh Leveling grid. X<mm> Y<mm> Z<mm>
|
||||||
* M500 - Store parameters in EEPROM
|
* M500 - Store parameters in EEPROM
|
||||||
* M501 - Read parameters from EEPROM (if you need reset them after you changed them temporarily).
|
* M501 - Read parameters from EEPROM (if you need reset them after you changed them temporarily).
|
||||||
* M502 - Revert to the default "factory settings". You still need to store them in EEPROM afterwards if you want to.
|
* M502 - Revert to the default "factory settings". You still need to store them in EEPROM afterwards if you want to.
|
||||||
@ -4467,16 +4467,15 @@ inline void gcode_M410() { quickStop(); }
|
|||||||
* M421: Set a single Mesh Bed Leveling Z coordinate
|
* M421: Set a single Mesh Bed Leveling Z coordinate
|
||||||
*/
|
*/
|
||||||
inline void gcode_M421() {
|
inline void gcode_M421() {
|
||||||
int x, y;
|
float x, y, z;
|
||||||
float z;
|
|
||||||
bool err = false, hasX, hasY, hasZ;
|
bool err = false, hasX, hasY, hasZ;
|
||||||
if ((hasX = code_seen('X'))) x = code_value_short();
|
if ((hasX = code_seen('X'))) x = code_value();
|
||||||
if ((hasY = code_seen('Y'))) y = code_value_short();
|
if ((hasY = code_seen('Y'))) y = code_value();
|
||||||
if ((hasZ = code_seen('Z'))) z = code_value();
|
if ((hasZ = code_seen('Z'))) z = code_value();
|
||||||
|
|
||||||
if (!hasX || !hasY || !hasZ) {
|
if (!hasX || !hasY || !hasZ) {
|
||||||
SERIAL_ERROR_START;
|
SERIAL_ERROR_START;
|
||||||
SERIAL_ERRORLNPGM(MSG_ERR_XYZ_REQUIRED_FOR_M421);
|
SERIAL_ERRORLNPGM(MSG_ERR_M421_REQUIRES_XYZ);
|
||||||
err = true;
|
err = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4486,7 +4485,7 @@ inline void gcode_M410() { quickStop(); }
|
|||||||
err = true;
|
err = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!err) mbl.z_values[y][x] = z;
|
if (!err) mbl.set_z(select_x_index(x), select_y_index(y), z);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -96,8 +96,8 @@
|
|||||||
#include "configuration_store.h"
|
#include "configuration_store.h"
|
||||||
|
|
||||||
#ifdef MESH_BED_LEVELING
|
#ifdef MESH_BED_LEVELING
|
||||||
#include "mesh_bed_leveling.h"
|
#include "mesh_bed_leveling.h"
|
||||||
#endif // MESH_BED_LEVELING
|
#endif
|
||||||
|
|
||||||
void _EEPROM_writeData(int &pos, uint8_t* value, uint8_t size) {
|
void _EEPROM_writeData(int &pos, uint8_t* value, uint8_t size) {
|
||||||
uint8_t c;
|
uint8_t c;
|
||||||
@ -168,9 +168,7 @@ void Config_StoreSettings() {
|
|||||||
EEPROM_WRITE_VAR(i, mesh_num_x);
|
EEPROM_WRITE_VAR(i, mesh_num_x);
|
||||||
EEPROM_WRITE_VAR(i, mesh_num_y);
|
EEPROM_WRITE_VAR(i, mesh_num_y);
|
||||||
dummy = 0.0f;
|
dummy = 0.0f;
|
||||||
for (int q=0; q<mesh_num_x*mesh_num_y; q++) {
|
for (int q=0; q<mesh_num_x*mesh_num_y; q++) EEPROM_WRITE_VAR(i, dummy);
|
||||||
EEPROM_WRITE_VAR(i, dummy);
|
|
||||||
}
|
|
||||||
#endif // MESH_BED_LEVELING
|
#endif // MESH_BED_LEVELING
|
||||||
|
|
||||||
#ifndef ENABLE_AUTO_BED_LEVELING
|
#ifndef ENABLE_AUTO_BED_LEVELING
|
||||||
@ -685,8 +683,8 @@ void Config_PrintSettings(bool forReplay) {
|
|||||||
for (int y=0; y<MESH_NUM_Y_POINTS; y++) {
|
for (int y=0; y<MESH_NUM_Y_POINTS; y++) {
|
||||||
for (int x=0; x<MESH_NUM_X_POINTS; x++) {
|
for (int x=0; x<MESH_NUM_X_POINTS; x++) {
|
||||||
CONFIG_ECHO_START;
|
CONFIG_ECHO_START;
|
||||||
SERIAL_ECHOPAIR(" M421 X", x);
|
SERIAL_ECHOPAIR(" M421 X", mbl.get_x(x));
|
||||||
SERIAL_ECHOPAIR(" Y", y);
|
SERIAL_ECHOPAIR(" Y", mbl.get_y(y));
|
||||||
SERIAL_ECHOPAIR(" Z", mbl.z_values[y][x]);
|
SERIAL_ECHOPAIR(" Z", mbl.z_values[y][x]);
|
||||||
SERIAL_EOL;
|
SERIAL_EOL;
|
||||||
}
|
}
|
||||||
|
@ -159,7 +159,7 @@
|
|||||||
#define MSG_Z2_MAX "z2_max: "
|
#define MSG_Z2_MAX "z2_max: "
|
||||||
#define MSG_Z_PROBE "z_probe: "
|
#define MSG_Z_PROBE "z_probe: "
|
||||||
#define MSG_ERR_MATERIAL_INDEX "M145 S<index> out of range (0-1)"
|
#define MSG_ERR_MATERIAL_INDEX "M145 S<index> out of range (0-1)"
|
||||||
#define MSG_ERR_XYZ_REQUIRED_FOR_M421 "M421 requires XYZ parameters"
|
#define MSG_ERR_M421_REQUIRES_XYZ "M421 requires XYZ parameters"
|
||||||
#define MSG_ERR_MESH_INDEX_OOB "Mesh XY index is out of bounds"
|
#define MSG_ERR_MESH_INDEX_OOB "Mesh XY index is out of bounds"
|
||||||
#define MSG_M119_REPORT "Reporting endstop status"
|
#define MSG_M119_REPORT "Reporting endstop status"
|
||||||
#define MSG_ENDSTOP_HIT "TRIGGERED"
|
#define MSG_ENDSTOP_HIT "TRIGGERED"
|
||||||
|
@ -159,7 +159,7 @@
|
|||||||
#define MSG_Z2_MAX "z2_max: "
|
#define MSG_Z2_MAX "z2_max: "
|
||||||
#define MSG_Z_PROBE "z_probe: "
|
#define MSG_Z_PROBE "z_probe: "
|
||||||
#define MSG_ERR_MATERIAL_INDEX "M145 S<index> out of range (0-1)"
|
#define MSG_ERR_MATERIAL_INDEX "M145 S<index> out of range (0-1)"
|
||||||
#define MSG_ERR_XYZ_REQUIRED_FOR_M421 "M421 requires XYZ parameters"
|
#define MSG_ERR_M421_REQUIRES_XYZ "M421 requires XYZ parameters"
|
||||||
#define MSG_ERR_MESH_INDEX_OOB "Mesh XY index is out of bounds"
|
#define MSG_ERR_MESH_INDEX_OOB "Mesh XY index is out of bounds"
|
||||||
#define MSG_M119_REPORT "Reporting endstop status"
|
#define MSG_M119_REPORT "Reporting endstop status"
|
||||||
#define MSG_ENDSTOP_HIT "TRIGGERED"
|
#define MSG_ENDSTOP_HIT "TRIGGERED"
|
||||||
|
Loading…
Reference in New Issue
Block a user