Add M88 command to move Z axis to full-step position

Introduces the M88 G-code command for TMC2130 drivers to move the Z axis to a full-step position. Adds corresponding message and menu item for LCD calibration when Z axis position is known.
This commit is contained in:
Mathias Gyldenberg 2025-09-06 22:54:18 +02:00
parent d3f95592c1
commit 788d0cc63a
4 changed files with 21 additions and 0 deletions

View File

@ -5707,6 +5707,22 @@ void process_commands()
break;
#endif
/*!
### M88 - Move Z axis to a full-step position
*/
#ifdef TMC2130
case 88:
if (axis_known_position[Z_AXIS]) {
float target_z = current_position[Z_AXIS] + float(1024 - tmc2130_rd_MSCNT(Z_AXIS)) / (tmc2130_get_res(Z_AXIS) * cs.axis_steps_per_mm[Z_AXIS]) + 0.16f;
if (target_z <= max_pos[Z_AXIS]) {
current_position[Z_AXIS] = target_z;
plan_buffer_line_curposXYZE(homing_feedrate[Z_AXIS]/60);
st_synchronize();
}
}
break;
#endif
/*!
### M92 - Set Axis steps-per-unit <a href="https://reprap.org/wiki/G-code#M92:_Set_axis_steps_per_unit">M92: Set axis_steps_per_unit</a>
Allows programming of steps per unit (usually mm) for motor drives. These values are reset to firmware defaults on power on, unless saved to EEPROM if available (M500 in Marlin)

View File

@ -413,6 +413,7 @@ const char MSG_HOST_ACTION_START[] PROGMEM_N1 = "//action:start"; ////
const char MSG_HOST_ACTION_UVLO_RECOVERY_READY[] PROGMEM_N1 = "//action:uvlo_recovery_ready"; ////
const char MSG_HOST_ACTION_UVLO_AUTO_RECOVERY_READY[] PROGMEM_N1 = "//action:uvlo_auto_recovery_ready"; ////
const char MSG_HOST_ACTION_NOTIFICATION[] PROGMEM_N1 = "//action:notification %S\n"; ////
const char MSG_FULLSTEP_Z[] PROGMEM_N1 = "Fullstep Z axis"; ////
#ifdef HOST_SHUTDOWN
const char MSG_HOST_ACTION_SHUTDOWN[] PROGMEM_N1 = "//action:shutdown"; ////
#endif //HOST_SHUTOWN

View File

@ -415,6 +415,7 @@ extern const char MSG_HOST_ACTION_START[];
extern const char MSG_HOST_ACTION_UVLO_RECOVERY_READY[];
extern const char MSG_HOST_ACTION_UVLO_AUTO_RECOVERY_READY[];
extern const char MSG_HOST_ACTION_NOTIFICATION[];
extern const char MSG_FULLSTEP_Z[];
#ifdef HOST_SHUTDOWN
extern const char MSG_HOST_ACTION_SHUTDOWN[];
#endif //HOST_SHUTOWN

View File

@ -4525,6 +4525,9 @@ static void lcd_calibration_menu()
MENU_ITEM_SUBMENU_P(_T(MSG_V2_CALIBRATION), lcd_first_layer_calibration_reset);
}
MENU_ITEM_GCODE_P(_T(MSG_AUTO_HOME), G28W);
if (axis_known_position[Z_AXIS]) {
MENU_ITEM_GCODE_P(_T(MSG_FULLSTEP_Z), PSTR("M88"));
}
#ifdef TMC2130
MENU_ITEM_FUNCTION_P(_T(MSG_BELTTEST), lcd_belttest_v);
#endif //TMC2130