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

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