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

@ -1025,7 +1025,7 @@ void MarlinUI::draw_status_screen() {
}
void draw_edit_screen(PGM_P const pstr, const char* const value/*=NULL*/) {
lcd_moveto(1, 1);
lcd_moveto(0, 1);
lcd_put_u8str_P(pstr);
if (value != NULL) {
lcd_put_wchar(':');

View File

@ -389,7 +389,7 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop
if (value != NULL) {
lcd_put_wchar(':');
if (extra_row) {
// Assume the value is numeric (with no descender)
// Assume that value is numeric (with no descender)
baseline += EDIT_FONT_ASCENT + 2;
onpage = PAGE_CONTAINS(baseline - (EDIT_FONT_ASCENT - 1), baseline);
}

View File

@ -97,6 +97,10 @@
#include "../../feature/runout.h"
#endif
#if ENABLED(BABYSTEPPING)
#include "../../feature/babystep.h"
#endif
inline float clamp(const float value, const float minimum, const float maximum) {
return MAX(MIN(value, maximum), minimum);
}
@ -584,10 +588,10 @@ namespace ExtUI {
bool babystepAxis_steps(const int16_t steps, const axis_t axis) {
switch (axis) {
#if ENABLED(BABYSTEP_XY)
case X: thermalManager.babystep_axis(X_AXIS, steps); break;
case Y: thermalManager.babystep_axis(Y_AXIS, steps); break;
case X: babystep.add_steps(X_AXIS, steps); break;
case Y: babystep.add_steps(Y_AXIS, steps); break;
#endif
case Z: thermalManager.babystep_axis(Z_AXIS, steps); break;
case Z: babystep.add_steps(Z_AXIS, steps); break;
default: return false;
};
return true;

View File

@ -903,6 +903,9 @@
#ifndef MSG_BABYSTEP_Z
#define MSG_BABYSTEP_Z _UxGT("Babystep Z")
#endif
#ifndef MSG_BABYSTEP_TOTAL
#define MSG_BABYSTEP_TOTAL _UxGT("Total")
#endif
#ifndef MSG_ENDSTOP_ABORT
#define MSG_ENDSTOP_ABORT _UxGT("Endstop abort")
#endif

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