Have M420 report a changed position
This commit is contained in:
parent
03ba79f144
commit
7d2e850577
1 changed files with 15 additions and 3 deletions
|
@ -45,6 +45,11 @@
|
||||||
*/
|
*/
|
||||||
void GcodeSuite::M420() {
|
void GcodeSuite::M420() {
|
||||||
|
|
||||||
|
const float oldpos[XYZE] = {
|
||||||
|
current_position[X_AXIS], current_position[Y_AXIS],
|
||||||
|
current_position[Z_AXIS], current_position[E_AXIS]
|
||||||
|
};
|
||||||
|
|
||||||
#if ENABLED(AUTO_BED_LEVELING_UBL)
|
#if ENABLED(AUTO_BED_LEVELING_UBL)
|
||||||
|
|
||||||
// L to load a mesh from the EEPROM
|
// L to load a mesh from the EEPROM
|
||||||
|
@ -104,13 +109,16 @@ void GcodeSuite::M420() {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
const bool to_enable = parser.boolval('S');
|
|
||||||
if (parser.seen('S')) set_bed_leveling_enabled(to_enable);
|
|
||||||
|
|
||||||
#if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
|
#if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
|
||||||
if (parser.seen('Z')) set_z_fade_height(parser.value_linear_units(), false);
|
if (parser.seen('Z')) set_z_fade_height(parser.value_linear_units(), false);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
bool to_enable = false;
|
||||||
|
if (parser.seen('S')) {
|
||||||
|
to_enable = parser.value_bool();
|
||||||
|
set_bed_leveling_enabled(to_enable);
|
||||||
|
}
|
||||||
|
|
||||||
const bool new_status = planner.leveling_active;
|
const bool new_status = planner.leveling_active;
|
||||||
|
|
||||||
if (to_enable && !new_status) {
|
if (to_enable && !new_status) {
|
||||||
|
@ -129,6 +137,10 @@ void GcodeSuite::M420() {
|
||||||
else
|
else
|
||||||
SERIAL_ECHOLNPGM(MSG_OFF);
|
SERIAL_ECHOLNPGM(MSG_OFF);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Report change in position
|
||||||
|
if (memcmp(oldpos, current_position, sizeof(oldpos)))
|
||||||
|
report_current_position();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // HAS_LEVELING
|
#endif // HAS_LEVELING
|
Reference in a new issue