Show Total E during print (#15703)

This commit is contained in:
Scott Lahteine
2019-10-27 17:49:27 -05:00
committed by GitHub
parent 0f8c3ed29a
commit 7a342ecb93
116 changed files with 407 additions and 24 deletions

View File

@ -815,14 +815,28 @@ void MarlinUI::draw_status_screen() {
sprintf_P(mixer_messages, PSTR("%s %d;%d%% "), mix_label, int(mixer.mix[0]), int(mixer.mix[1]));
lcd_put_u8str(mixer_messages);
#else
#else // !DUAL_MIXING_EXTRUDER
xy_pos_t lpos = current_position; toLogical(lpos);
_draw_axis_value(X_AXIS, ftostr4sign(lpos.x), blink);
lcd_put_wchar(' ');
_draw_axis_value(Y_AXIS, ftostr4sign(lpos.y), blink);
if (true
#if ENABLED(LCD_SHOW_E_TOTAL)
&& !printingIsActive()
#endif
) {
xy_pos_t lpos = current_position; toLogical(lpos);
_draw_axis_value(X_AXIS, ftostr4sign(lpos.x), blink);
lcd_put_wchar(' ');
_draw_axis_value(Y_AXIS, ftostr4sign(lpos.y), blink);
}
else {
#if ENABLED(LCD_SHOW_E_TOTAL)
char tmp[20];
const uint8_t escale = e_move_accumulator >= 100000.0f ? 10 : 1; // After 100m switch to cm
sprintf_P(tmp, PSTR("E %ld%cm "), uint32_t(_MAX(e_move_accumulator, 0.0f)) / escale, escale == 10 ? 'c' : 'm'); // 1234567mm
lcd_put_u8str(tmp);
#endif
}
#endif
#endif // !DUAL_MIXING_EXTRUDER
#endif // HOTENDS <= 2 && (HOTENDS <= 1 || !HAS_HEATED_BED)

View File

@ -299,7 +299,7 @@ FORCE_INLINE void _draw_heater_status(const heater_ind_t heater, const bool blin
//
FORCE_INLINE void _draw_axis_value(const AxisEnum axis, const char *value, const bool blink) {
const uint8_t offs = (XYZ_SPACING) * axis;
lcd_put_wchar(X_LABEL_POS + offs, XYZ_BASELINE, 'X' + axis);
lcd_put_wchar(X_LABEL_POS + offs, XYZ_BASELINE, axis_codes[axis]);
lcd_moveto(X_VALUE_POS + offs, XYZ_BASELINE);
if (blink)
lcd_put_u8str(value);
@ -328,7 +328,11 @@ void MarlinUI::draw_status_screen() {
if (first_page) count_renders++;
#endif
static char xstring[5], ystring[5], zstring[8];
static char xstring[5
#if ENABLED(LCD_SHOW_E_TOTAL)
+ 7
#endif
], ystring[5], zstring[8];
#if ENABLED(FILAMENT_LCD_DISPLAY)
static char wstring[5], mstring[4];
#endif
@ -373,7 +377,19 @@ void MarlinUI::draw_status_screen() {
heat_bits = new_bits;
#endif
const xyz_pos_t lpos = current_position.asLogical();
strcpy(xstring, ftostr4sign(lpos.x));
const bool showxy = (true
#if ENABLED(LCD_SHOW_E_TOTAL)
&& !printingIsActive()
#endif
);
if (showxy)
strcpy(xstring, ftostr4sign(lpos.x));
else {
#if ENABLED(LCD_SHOW_E_TOTAL)
const uint8_t escale = e_move_accumulator >= 100000.0f ? 10 : 1; // After 100m switch to cm
sprintf_P(xstring, PSTR("%ld%cm"), uint32_t(_MAX(e_move_accumulator, 0.0f)) / escale, escale == 10 ? 'c' : 'm'); // 1234567mm
#endif
}
strcpy(ystring, ftostr4sign(lpos.y));
strcpy(zstring, ftostr52sp( lpos.z));
#if ENABLED(FILAMENT_LCD_DISPLAY)
@ -692,8 +708,14 @@ void MarlinUI::draw_status_screen() {
#else
_draw_axis_value(X_AXIS, xstring, blink);
_draw_axis_value(Y_AXIS, ystring, blink);
if (showxy) {
_draw_axis_value(X_AXIS, xstring, blink);
_draw_axis_value(Y_AXIS, ystring, blink);
}
else {
_draw_axis_value(E_AXIS, xstring, true);
lcd_put_u8str_P(PSTR(" "));
}
#endif

View File

@ -59,6 +59,10 @@
#include "../../sd/cardreader.h"
#endif
#if ENABLED(LCD_SHOW_E_TOTAL)
#include "../../Marlin.h" // for printingIsActive
#endif
#define TEXT_MODE_LCD_WIDTH 16
#define BUFFER_WIDTH 256
@ -660,7 +664,7 @@ void ST7920_Lite_Status_Screen::draw_status_message() {
#endif
}
void ST7920_Lite_Status_Screen::draw_position(const xyz_pos_t &pos, const bool position_known) {
void ST7920_Lite_Status_Screen::draw_position(const xyze_pos_t &pos, const bool position_known) {
char str[7];
set_ddram_address(DDRAM_LINE_4);
begin_data();
@ -668,11 +672,25 @@ void ST7920_Lite_Status_Screen::draw_position(const xyz_pos_t &pos, const bool p
// If position is unknown, flash the labels.
const unsigned char alt_label = position_known ? 0 : (ui.get_blink() ? ' ' : 0);
write_byte(alt_label ? alt_label : 'X');
write_str(dtostrf(pos.x, -4, 0, str), 4);
if (true
#if ENABLED(LCD_SHOW_E_TOTAL)
&& !printingIsActive()
#endif
) {
write_byte(alt_label ? alt_label : 'X');
write_str(dtostrf(pos.x, -4, 0, str), 4);
write_byte(alt_label ? alt_label : 'Y');
write_str(dtostrf(pos.y, -4, 0, str), 4);
write_byte(alt_label ? alt_label : 'Y');
write_str(dtostrf(pos.y, -4, 0, str), 4);
}
else {
#if ENABLED(LCD_SHOW_E_TOTAL)
char tmp[15];
const uint8_t escale = e_move_accumulator >= 100000.0f ? 10 : 1; // After 100m switch to cm
sprintf_P(tmp, PSTR("E%-7ld%cm "), uint32_t(_MAX(e_move_accumulator, 0.0f)) / escale, escale == 10 ? 'c' : 'm'); // 1234567mm
write_str(tmp);
#endif
}
write_byte(alt_label ? alt_label : 'Z');
write_str(dtostrf(pos.z, -5, 1, str), 5);

View File

@ -87,7 +87,7 @@ class ST7920_Lite_Status_Screen {
static void draw_print_time(const duration_t &elapsed);
static void draw_feedrate_percentage(const uint16_t percentage);
static void draw_status_message();
static void draw_position(const xyz_pos_t &pos, bool position_known = true);
static void draw_position(const xyze_pos_t &pos, bool position_known = true);
static bool indicators_changed();
static bool position_changed();