Option to show babysteps total since G28 (#13580)
This commit is contained in:
@ -65,32 +65,60 @@
|
||||
|
||||
#if ENABLED(BABYSTEPPING)
|
||||
|
||||
long babysteps_done = 0;
|
||||
#include "../../feature/babystep.h"
|
||||
#include "../lcdprint.h"
|
||||
#if HAS_GRAPHICAL_LCD
|
||||
#include "../dogm/ultralcd_DOGM.h"
|
||||
#endif
|
||||
|
||||
void _lcd_babystep(const AxisEnum axis, PGM_P msg) {
|
||||
void _lcd_babystep(const AxisEnum axis, PGM_P const msg) {
|
||||
if (ui.use_click()) return ui.goto_previous_screen_no_defer();
|
||||
ui.encoder_direction_normal();
|
||||
if (ui.encoderPosition) {
|
||||
const int16_t babystep_increment = (int32_t)ui.encoderPosition * (BABYSTEP_MULTIPLICATOR);
|
||||
const int16_t steps = (int32_t)ui.encoderPosition * (BABYSTEP_MULTIPLICATOR);
|
||||
ui.encoderPosition = 0;
|
||||
ui.refresh(LCDVIEW_REDRAW_NOW);
|
||||
thermalManager.babystep_axis(axis, babystep_increment);
|
||||
babysteps_done += babystep_increment;
|
||||
babystep.add_steps(axis, steps);
|
||||
}
|
||||
if (ui.should_draw())
|
||||
draw_edit_screen(msg, ftostr43sign(planner.steps_to_mm[axis] * babysteps_done));
|
||||
if (ui.should_draw()) {
|
||||
const float spm = planner.steps_to_mm[axis];
|
||||
draw_edit_screen(msg, ftostr54sign(spm * babystep.accum));
|
||||
#if ENABLED(BABYSTEP_DISPLAY_TOTAL)
|
||||
const bool in_view = (true
|
||||
#if HAS_GRAPHICAL_LCD
|
||||
&& PAGE_CONTAINS(LCD_PIXEL_HEIGHT - MENU_FONT_HEIGHT, LCD_PIXEL_HEIGHT - 1)
|
||||
#endif
|
||||
);
|
||||
if (in_view) {
|
||||
#if HAS_GRAPHICAL_LCD
|
||||
ui.set_font(FONT_MENU);
|
||||
lcd_moveto(0, LCD_PIXEL_HEIGHT - MENU_FONT_DESCENT);
|
||||
#else
|
||||
lcd_moveto(0, LCD_HEIGHT - 1);
|
||||
#endif
|
||||
lcd_put_u8str_P(PSTR(MSG_BABYSTEP_TOTAL ":"));
|
||||
lcd_put_u8str(ftostr54sign(spm * babystep.axis_total[BS_TOTAL_AXIS(axis)]));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
inline void _lcd_babystep_go(const screenFunc_t screen) {
|
||||
ui.goto_screen(screen);
|
||||
ui.defer_status_screen();
|
||||
babystep.accum = 0;
|
||||
}
|
||||
|
||||
#if ENABLED(BABYSTEP_XY)
|
||||
void _lcd_babystep_x() { _lcd_babystep(X_AXIS, PSTR(MSG_BABYSTEP_X)); }
|
||||
void _lcd_babystep_y() { _lcd_babystep(Y_AXIS, PSTR(MSG_BABYSTEP_Y)); }
|
||||
void lcd_babystep_x() { ui.goto_screen(_lcd_babystep_x); babysteps_done = 0; ui.defer_status_screen(); }
|
||||
void lcd_babystep_y() { ui.goto_screen(_lcd_babystep_y); babysteps_done = 0; ui.defer_status_screen(); }
|
||||
void lcd_babystep_x() { _lcd_babystep_go(_lcd_babystep_x); }
|
||||
void lcd_babystep_y() { _lcd_babystep_go(_lcd_babystep_y); }
|
||||
#endif
|
||||
|
||||
#if DISABLED(BABYSTEP_ZPROBE_OFFSET)
|
||||
void _lcd_babystep_z() { _lcd_babystep(Z_AXIS, PSTR(MSG_BABYSTEP_Z)); }
|
||||
void lcd_babystep_z() { ui.goto_screen(_lcd_babystep_z); babysteps_done = 0; ui.defer_status_screen(); }
|
||||
void lcd_babystep_z() { _lcd_babystep_go(_lcd_babystep_z); }
|
||||
#endif
|
||||
|
||||
#endif // BABYSTEPPING
|
||||
|
Reference in New Issue
Block a user