Use babystepping to adjust bed probe z-offset

This commit is contained in:
Thomas Moore 2017-02-12 17:20:24 -06:00 committed by Scott Lahteine
parent 36e5c7c389
commit 361655828f
2 changed files with 45 additions and 5 deletions

View file

@ -7991,6 +7991,11 @@ inline void gcode_M503() {
#endif #endif
#endif #endif
#if ENABLED(BABYSTEPPING)
if (planner.abl_enabled)
thermalManager.babystep_axis(Z_AXIS, lround((value - zprobe_zoffset) * planner.axis_steps_per_mm[Z_AXIS]));
#endif
zprobe_zoffset = value; zprobe_zoffset = value;
SERIAL_ECHO(zprobe_zoffset); SERIAL_ECHO(zprobe_zoffset);
} }

View file

@ -834,7 +834,7 @@ void kill_screen(const char* lcd_msg) {
if (lcd_clicked) { defer_return_to_status = false; return lcd_goto_previous_menu(); } if (lcd_clicked) { defer_return_to_status = false; return lcd_goto_previous_menu(); }
ENCODER_DIRECTION_NORMAL(); ENCODER_DIRECTION_NORMAL();
if (encoderPosition) { if (encoderPosition) {
int babystep_increment = (int32_t)encoderPosition * (BABYSTEP_MULTIPLICATOR); const int babystep_increment = (int32_t)encoderPosition * (BABYSTEP_MULTIPLICATOR);
encoderPosition = 0; encoderPosition = 0;
lcdDrawUpdate = LCDVIEW_REDRAW_NOW; lcdDrawUpdate = LCDVIEW_REDRAW_NOW;
thermalManager.babystep_axis(axis, babystep_increment); thermalManager.babystep_axis(axis, babystep_increment);
@ -850,9 +850,38 @@ void kill_screen(const char* lcd_msg) {
void lcd_babystep_x() { lcd_goto_screen(_lcd_babystep_x); babysteps_done = 0; defer_return_to_status = true; } void lcd_babystep_x() { lcd_goto_screen(_lcd_babystep_x); babysteps_done = 0; defer_return_to_status = true; }
void lcd_babystep_y() { lcd_goto_screen(_lcd_babystep_y); babysteps_done = 0; defer_return_to_status = true; } void lcd_babystep_y() { lcd_goto_screen(_lcd_babystep_y); babysteps_done = 0; defer_return_to_status = true; }
#endif #endif
#if HAS_BED_PROBE
void lcd_babystep_zoffset() {
if (lcd_clicked) { defer_return_to_status = false; return lcd_goto_previous_menu(); }
defer_return_to_status = true;
ENCODER_DIRECTION_NORMAL();
if (encoderPosition) {
const int babystep_increment = (int32_t)encoderPosition * (BABYSTEP_MULTIPLICATOR);
encoderPosition = 0;
const float new_zoffset = zprobe_zoffset + steps_to_mm[Z_AXIS] * babystep_increment;
if (WITHIN(new_zoffset, Z_PROBE_OFFSET_RANGE_MIN, Z_PROBE_OFFSET_RANGE_MAX)) {
if (planner.abl_enabled)
thermalManager.babystep_axis(Z_AXIS, babystep_increment);
zprobe_zoffset = new_zoffset;
lcdDrawUpdate = LCDVIEW_REDRAW_NOW;
}
}
if (lcdDrawUpdate)
lcd_implementation_drawedit(PSTR(MSG_ZPROBE_ZOFFSET), ftostr43sign(zprobe_zoffset));
}
#else // !HAS_BED_PROBE
void _lcd_babystep_z() { _lcd_babystep(Z_AXIS, PSTR(MSG_BABYSTEPPING_Z)); } void _lcd_babystep_z() { _lcd_babystep(Z_AXIS, PSTR(MSG_BABYSTEPPING_Z)); }
void lcd_babystep_z() { lcd_goto_screen(_lcd_babystep_z); babysteps_done = 0; defer_return_to_status = true; } void lcd_babystep_z() { lcd_goto_screen(_lcd_babystep_z); babysteps_done = 0; defer_return_to_status = true; }
#endif // HAS_BED_PROBE
#endif //BABYSTEPPING #endif //BABYSTEPPING
#if ENABLED(AUTO_BED_LEVELING_UBL) #if ENABLED(AUTO_BED_LEVELING_UBL)
@ -1057,8 +1086,10 @@ void kill_screen(const char* lcd_msg) {
MENU_ITEM(submenu, MSG_BABYSTEP_X, lcd_babystep_x); MENU_ITEM(submenu, MSG_BABYSTEP_X, lcd_babystep_x);
MENU_ITEM(submenu, MSG_BABYSTEP_Y, lcd_babystep_y); MENU_ITEM(submenu, MSG_BABYSTEP_Y, lcd_babystep_y);
#endif //BABYSTEP_XY #endif //BABYSTEP_XY
#if !HAS_BED_PROBE
MENU_ITEM(submenu, MSG_BABYSTEP_Z, lcd_babystep_z); MENU_ITEM(submenu, MSG_BABYSTEP_Z, lcd_babystep_z);
#endif #endif
#endif
// //
// Change filament // Change filament
@ -2378,8 +2409,12 @@ void kill_screen(const char* lcd_msg) {
START_MENU(); START_MENU();
MENU_BACK(MSG_CONTROL); MENU_BACK(MSG_CONTROL);
#if HAS_BED_PROBE #if HAS_BED_PROBE
#if ENABLED(BABYSTEPPING)
MENU_ITEM(submenu, MSG_ZPROBE_ZOFFSET, lcd_babystep_zoffset);
#else
MENU_ITEM_EDIT(float32, MSG_ZPROBE_ZOFFSET, &zprobe_zoffset, Z_PROBE_OFFSET_RANGE_MIN, Z_PROBE_OFFSET_RANGE_MAX); MENU_ITEM_EDIT(float32, MSG_ZPROBE_ZOFFSET, &zprobe_zoffset, Z_PROBE_OFFSET_RANGE_MIN, Z_PROBE_OFFSET_RANGE_MAX);
#endif #endif
#endif
// Manual bed leveling, Bed Z: // Manual bed leveling, Bed Z:
#if ENABLED(MESH_BED_LEVELING) && ENABLED(LCD_BED_LEVELING) #if ENABLED(MESH_BED_LEVELING) && ENABLED(LCD_BED_LEVELING)
MENU_ITEM_EDIT(float43, MSG_BED_Z, &mbl.z_offset, -1, 1); MENU_ITEM_EDIT(float43, MSG_BED_Z, &mbl.z_offset, -1, 1);