Option to show babysteps total since G28 (#13580)

This commit is contained in:
Roxy-3D
2019-04-06 18:04:34 -05:00
committed by Scott Lahteine
parent 3221658a78
commit 9cee81d47e
91 changed files with 443 additions and 123 deletions

View File

@ -37,7 +37,7 @@
#include "../../module/configuration_store.h"
#endif
#if WATCH_HOTENDS || WATCH_BED || ENABLED(BABYSTEP_ZPROBE_OFFSET)
#if WATCH_HOTENDS || WATCH_BED
#include "../../module/temperature.h"
#endif
@ -352,6 +352,8 @@ void MarlinUI::completion_feedback(const bool good/*=true*/) {
#if ENABLED(BABYSTEP_ZPROBE_OFFSET)
#include "../../feature/babystep.h"
void lcd_babystep_zoffset() {
if (ui.use_click()) return ui.goto_previous_screen_no_defer();
ui.defer_status_screen();
@ -376,7 +378,7 @@ void MarlinUI::completion_feedback(const bool good/*=true*/) {
;
if (WITHIN(new_offs, Z_PROBE_OFFSET_RANGE_MIN, Z_PROBE_OFFSET_RANGE_MAX)) {
thermalManager.babystep_axis(Z_AXIS, babystep_increment);
babystep.add_steps(Z_AXIS, babystep_increment);
if (do_probe) zprobe_zoffset = new_offs;
#if ENABLED(BABYSTEP_HOTEND_Z_OFFSET)

View File

@ -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