mirror of
https://github.com/MarlinFirmware/Marlin.git
synced 2024-11-26 21:36:21 +00:00
🚸 LCD_SHOW_E_TOTAL for TFT_COLOR_UI (#23127)
This commit is contained in:
parent
cb1570d162
commit
39a81d167e
@ -672,14 +672,7 @@ void ST7920_Lite_Status_Screen::draw_position(const xyze_pos_t &pos, const bool
|
|||||||
// If position is unknown, flash the labels.
|
// If position is unknown, flash the labels.
|
||||||
const unsigned char alt_label = position_trusted ? 0 : (ui.get_blink() ? ' ' : 0);
|
const unsigned char alt_label = position_trusted ? 0 : (ui.get_blink() ? ' ' : 0);
|
||||||
|
|
||||||
if (TERN1(LCD_SHOW_E_TOTAL, !printingIsActive())) {
|
if (TERN0(LCD_SHOW_E_TOTAL, printingIsActive())) {
|
||||||
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);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
#if ENABLED(LCD_SHOW_E_TOTAL)
|
#if ENABLED(LCD_SHOW_E_TOTAL)
|
||||||
char tmp[15];
|
char tmp[15];
|
||||||
const uint8_t escale = e_move_accumulator >= 100000.0f ? 10 : 1; // After 100m switch to cm
|
const uint8_t escale = e_move_accumulator >= 100000.0f ? 10 : 1; // After 100m switch to cm
|
||||||
@ -687,6 +680,13 @@ void ST7920_Lite_Status_Screen::draw_position(const xyze_pos_t &pos, const bool
|
|||||||
write_str(tmp);
|
write_str(tmp);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
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 : 'Z');
|
write_byte(alt_label ? alt_label : 'Z');
|
||||||
write_str(dtostrf(pos.z, -5, 1, str), 5);
|
write_str(dtostrf(pos.z, -5, 1, str), 5);
|
||||||
|
@ -258,21 +258,31 @@ void MarlinUI::draw_status_screen() {
|
|||||||
tft.set_background(COLOR_BACKGROUND);
|
tft.set_background(COLOR_BACKGROUND);
|
||||||
tft.add_rectangle(0, 0, TFT_WIDTH - 8, FONT_LINE_HEIGHT, COLOR_AXIS_HOMED);
|
tft.add_rectangle(0, 0, TFT_WIDTH - 8, FONT_LINE_HEIGHT, COLOR_AXIS_HOMED);
|
||||||
|
|
||||||
tft.add_text(200, 3, COLOR_AXIS_HOMED , "X");
|
if (TERN0(LCD_SHOW_E_TOTAL, printingIsActive())) {
|
||||||
tft.add_text(500, 3, COLOR_AXIS_HOMED , "Y");
|
#if ENABLED(LCD_SHOW_E_TOTAL)
|
||||||
|
tft.add_text(200, 3, COLOR_AXIS_HOMED , "E");
|
||||||
|
const uint8_t escale = e_move_accumulator >= 100000.0f ? 10 : 1; // After 100m switch to cm
|
||||||
|
tft_string.set(ftostr4sign(e_move_accumulator / escale));
|
||||||
|
tft_string.add(escale == 10 ? 'c' : 'm');
|
||||||
|
tft_string.add('m');
|
||||||
|
tft.add_text(500 - tft_string.width(), 3, COLOR_AXIS_HOMED, tft_string);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
tft.add_text(200, 3, COLOR_AXIS_HOMED , "X");
|
||||||
|
const bool nhx = axis_should_home(X_AXIS);
|
||||||
|
tft_string.set(blink && nhx ? "?" : ftostr4sign(LOGICAL_X_POSITION(current_position.x)));
|
||||||
|
tft.add_text(300 - tft_string.width(), 3, nhx ? COLOR_AXIS_NOT_HOMED : COLOR_AXIS_HOMED, tft_string);
|
||||||
|
|
||||||
|
tft.add_text(500, 3, COLOR_AXIS_HOMED , "Y");
|
||||||
|
const bool nhy = axis_should_home(Y_AXIS);
|
||||||
|
tft_string.set(blink && nhy ? "?" : ftostr4sign(LOGICAL_Y_POSITION(current_position.y)));
|
||||||
|
tft.add_text(600 - tft_string.width(), 3, nhy ? COLOR_AXIS_NOT_HOMED : COLOR_AXIS_HOMED, tft_string);
|
||||||
|
}
|
||||||
tft.add_text(800, 3, COLOR_AXIS_HOMED , "Z");
|
tft.add_text(800, 3, COLOR_AXIS_HOMED , "Z");
|
||||||
|
|
||||||
bool not_homed = axis_should_home(X_AXIS);
|
|
||||||
tft_string.set(blink && not_homed ? "?" : ftostr4sign(LOGICAL_X_POSITION(current_position.x)));
|
|
||||||
tft.add_text(300 - tft_string.width(), 3, not_homed ? COLOR_AXIS_NOT_HOMED : COLOR_AXIS_HOMED, tft_string);
|
|
||||||
|
|
||||||
not_homed = axis_should_home(Y_AXIS);
|
|
||||||
tft_string.set(blink && not_homed ? "?" : ftostr4sign(LOGICAL_Y_POSITION(current_position.y)));
|
|
||||||
tft.add_text(600 - tft_string.width(), 3, not_homed ? COLOR_AXIS_NOT_HOMED : COLOR_AXIS_HOMED, tft_string);
|
|
||||||
|
|
||||||
uint16_t offset = 32;
|
uint16_t offset = 32;
|
||||||
not_homed = axis_should_home(Z_AXIS);
|
const bool nhz = axis_should_home(Z_AXIS);
|
||||||
if (blink && not_homed)
|
if (blink && nhz)
|
||||||
tft_string.set("?");
|
tft_string.set("?");
|
||||||
else {
|
else {
|
||||||
const float z = LOGICAL_Z_POSITION(current_position.z);
|
const float z = LOGICAL_Z_POSITION(current_position.z);
|
||||||
@ -283,7 +293,7 @@ void MarlinUI::draw_status_screen() {
|
|||||||
tft_string.set(ftostr52sp(z));
|
tft_string.set(ftostr52sp(z));
|
||||||
offset -= tft_string.width();
|
offset -= tft_string.width();
|
||||||
}
|
}
|
||||||
tft.add_text(900 - tft_string.width() - offset, 3, not_homed ? COLOR_AXIS_NOT_HOMED : COLOR_AXIS_HOMED, tft_string);
|
tft.add_text(900 - tft_string.width() - offset, 3, nhz ? COLOR_AXIS_NOT_HOMED : COLOR_AXIS_HOMED, tft_string);
|
||||||
TERN_(TOUCH_SCREEN, touch.add_control(MOVE_AXIS, 4, y, TFT_WIDTH - 8, FONT_LINE_HEIGHT));
|
TERN_(TOUCH_SCREEN, touch.add_control(MOVE_AXIS, 4, y, TFT_WIDTH - 8, FONT_LINE_HEIGHT));
|
||||||
|
|
||||||
y += 100;
|
y += 100;
|
||||||
|
@ -256,21 +256,32 @@ void MarlinUI::draw_status_screen() {
|
|||||||
tft.set_background(COLOR_BACKGROUND);
|
tft.set_background(COLOR_BACKGROUND);
|
||||||
tft.add_rectangle(0, 0, 312, 24, COLOR_AXIS_HOMED);
|
tft.add_rectangle(0, 0, 312, 24, COLOR_AXIS_HOMED);
|
||||||
|
|
||||||
tft.add_text( 10, 3, COLOR_AXIS_HOMED , "X");
|
if (TERN0(LCD_SHOW_E_TOTAL, printingIsActive())) {
|
||||||
tft.add_text(127, 3, COLOR_AXIS_HOMED , "Y");
|
#if ENABLED(LCD_SHOW_E_TOTAL)
|
||||||
|
tft.add_text( 10, 3, COLOR_AXIS_HOMED , "E");
|
||||||
|
const uint8_t escale = e_move_accumulator >= 100000.0f ? 10 : 1; // After 100m switch to cm
|
||||||
|
tft_string.set(ftostr4sign(e_move_accumulator / escale));
|
||||||
|
tft_string.add(escale == 10 ? 'c' : 'm');
|
||||||
|
tft_string.add('m');
|
||||||
|
tft.add_text(127 - tft_string.width(), 3, COLOR_AXIS_HOMED, tft_string);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
tft.add_text( 10, 3, COLOR_AXIS_HOMED , "X");
|
||||||
|
const bool nhx = axis_should_home(X_AXIS);
|
||||||
|
tft_string.set(blink && nhx ? "?" : ftostr4sign(LOGICAL_X_POSITION(current_position.x)));
|
||||||
|
tft.add_text( 68 - tft_string.width(), 3, nhx ? COLOR_AXIS_NOT_HOMED : COLOR_AXIS_HOMED, tft_string);
|
||||||
|
|
||||||
|
tft.add_text(127, 3, COLOR_AXIS_HOMED , "Y");
|
||||||
|
const bool nhy = axis_should_home(Y_AXIS);
|
||||||
|
tft_string.set(blink && nhy ? "?" : ftostr4sign(LOGICAL_Y_POSITION(current_position.y)));
|
||||||
|
tft.add_text(185 - tft_string.width(), 3, nhy ? COLOR_AXIS_NOT_HOMED : COLOR_AXIS_HOMED, tft_string);
|
||||||
|
}
|
||||||
|
|
||||||
tft.add_text(219, 3, COLOR_AXIS_HOMED , "Z");
|
tft.add_text(219, 3, COLOR_AXIS_HOMED , "Z");
|
||||||
|
const bool nhz = axis_should_home(Z_AXIS);
|
||||||
bool not_homed = axis_should_home(X_AXIS);
|
|
||||||
tft_string.set(blink && not_homed ? "?" : ftostr4sign(LOGICAL_X_POSITION(current_position.x)));
|
|
||||||
tft.add_text( 68 - tft_string.width(), 3, not_homed ? COLOR_AXIS_NOT_HOMED : COLOR_AXIS_HOMED, tft_string);
|
|
||||||
|
|
||||||
not_homed = axis_should_home(Y_AXIS);
|
|
||||||
tft_string.set(blink && not_homed ? "?" : ftostr4sign(LOGICAL_Y_POSITION(current_position.y)));
|
|
||||||
tft.add_text(185 - tft_string.width(), 3, not_homed ? COLOR_AXIS_NOT_HOMED : COLOR_AXIS_HOMED, tft_string);
|
|
||||||
|
|
||||||
not_homed = axis_should_home(Z_AXIS);
|
|
||||||
uint16_t offset = 25;
|
uint16_t offset = 25;
|
||||||
if (blink && not_homed)
|
if (blink && nhz)
|
||||||
tft_string.set("?");
|
tft_string.set("?");
|
||||||
else {
|
else {
|
||||||
const float z = LOGICAL_Z_POSITION(current_position.z);
|
const float z = LOGICAL_Z_POSITION(current_position.z);
|
||||||
@ -281,7 +292,7 @@ void MarlinUI::draw_status_screen() {
|
|||||||
tft_string.set(ftostr52sp(z));
|
tft_string.set(ftostr52sp(z));
|
||||||
offset -= tft_string.width();
|
offset -= tft_string.width();
|
||||||
}
|
}
|
||||||
tft.add_text(301 - tft_string.width() - offset, 3, not_homed ? COLOR_AXIS_NOT_HOMED : COLOR_AXIS_HOMED, tft_string);
|
tft.add_text(301 - tft_string.width() - offset, 3, nhz ? COLOR_AXIS_NOT_HOMED : COLOR_AXIS_HOMED, tft_string);
|
||||||
TERN_(TOUCH_SCREEN, touch.add_control(MOVE_AXIS, 0, 103, 312, 24));
|
TERN_(TOUCH_SCREEN, touch.add_control(MOVE_AXIS, 0, 103, 312, 24));
|
||||||
|
|
||||||
// feed rate
|
// feed rate
|
||||||
|
@ -258,21 +258,31 @@ void MarlinUI::draw_status_screen() {
|
|||||||
tft.set_background(COLOR_BACKGROUND);
|
tft.set_background(COLOR_BACKGROUND);
|
||||||
tft.add_rectangle(0, 0, TFT_WIDTH - 8, FONT_LINE_HEIGHT, COLOR_AXIS_HOMED);
|
tft.add_rectangle(0, 0, TFT_WIDTH - 8, FONT_LINE_HEIGHT, COLOR_AXIS_HOMED);
|
||||||
|
|
||||||
tft.add_text( 16, 3, COLOR_AXIS_HOMED , "X");
|
if (TERN0(LCD_SHOW_E_TOTAL, printingIsActive())) {
|
||||||
tft.add_text(192, 3, COLOR_AXIS_HOMED , "Y");
|
#if ENABLED(LCD_SHOW_E_TOTAL)
|
||||||
|
tft.add_text( 16, 3, COLOR_AXIS_HOMED , "E");
|
||||||
|
const uint8_t escale = e_move_accumulator >= 100000.0f ? 10 : 1; // After 100m switch to cm
|
||||||
|
tft_string.set(ftostr4sign(e_move_accumulator / escale));
|
||||||
|
tft_string.add(escale == 10 ? 'c' : 'm');
|
||||||
|
tft_string.add('m');
|
||||||
|
tft.add_text(192 - tft_string.width(), 3, COLOR_AXIS_HOMED, tft_string);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
tft.add_text( 16, 3, COLOR_AXIS_HOMED , "X");
|
||||||
|
const bool nhx = axis_should_home(X_AXIS);
|
||||||
|
tft_string.set(blink && nhx ? "?" : ftostr4sign(LOGICAL_X_POSITION(current_position.x)));
|
||||||
|
tft.add_text(102 - tft_string.width(), 3, nhx ? COLOR_AXIS_NOT_HOMED : COLOR_AXIS_HOMED, tft_string);
|
||||||
|
|
||||||
|
tft.add_text(192, 3, COLOR_AXIS_HOMED , "Y");
|
||||||
|
const bool nhy = axis_should_home(Y_AXIS);
|
||||||
|
tft_string.set(blink && nhy ? "?" : ftostr4sign(LOGICAL_Y_POSITION(current_position.y)));
|
||||||
|
tft.add_text(280 - tft_string.width(), 3, nhy ? COLOR_AXIS_NOT_HOMED : COLOR_AXIS_HOMED, tft_string);
|
||||||
|
}
|
||||||
tft.add_text(330, 3, COLOR_AXIS_HOMED , "Z");
|
tft.add_text(330, 3, COLOR_AXIS_HOMED , "Z");
|
||||||
|
|
||||||
bool not_homed = axis_should_home(X_AXIS);
|
|
||||||
tft_string.set(blink && not_homed ? "?" : ftostr4sign(LOGICAL_X_POSITION(current_position.x)));
|
|
||||||
tft.add_text(102 - tft_string.width(), 3, not_homed ? COLOR_AXIS_NOT_HOMED : COLOR_AXIS_HOMED, tft_string);
|
|
||||||
|
|
||||||
not_homed = axis_should_home(Y_AXIS);
|
|
||||||
tft_string.set(blink && not_homed ? "?" : ftostr4sign(LOGICAL_Y_POSITION(current_position.y)));
|
|
||||||
tft.add_text(280 - tft_string.width(), 3, not_homed ? COLOR_AXIS_NOT_HOMED : COLOR_AXIS_HOMED, tft_string);
|
|
||||||
|
|
||||||
uint16_t offset = 32;
|
uint16_t offset = 32;
|
||||||
not_homed = axis_should_home(Z_AXIS);
|
const bool nhz = axis_should_home(Z_AXIS);
|
||||||
if (blink && not_homed)
|
if (blink && nhz)
|
||||||
tft_string.set("?");
|
tft_string.set("?");
|
||||||
else {
|
else {
|
||||||
const float z = LOGICAL_Z_POSITION(current_position.z);
|
const float z = LOGICAL_Z_POSITION(current_position.z);
|
||||||
@ -283,7 +293,7 @@ void MarlinUI::draw_status_screen() {
|
|||||||
tft_string.set(ftostr52sp(z));
|
tft_string.set(ftostr52sp(z));
|
||||||
offset -= tft_string.width();
|
offset -= tft_string.width();
|
||||||
}
|
}
|
||||||
tft.add_text(455 - tft_string.width() - offset, 3, not_homed ? COLOR_AXIS_NOT_HOMED : COLOR_AXIS_HOMED, tft_string);
|
tft.add_text(455 - tft_string.width() - offset, 3, nhz ? COLOR_AXIS_NOT_HOMED : COLOR_AXIS_HOMED, tft_string);
|
||||||
TERN_(TOUCH_SCREEN, touch.add_control(MOVE_AXIS, 4, y, TFT_WIDTH - 8, FONT_LINE_HEIGHT));
|
TERN_(TOUCH_SCREEN, touch.add_control(MOVE_AXIS, 4, y, TFT_WIDTH - 8, FONT_LINE_HEIGHT));
|
||||||
|
|
||||||
y += TERN(HAS_UI_480x272, 38, 48);
|
y += TERN(HAS_UI_480x272, 38, 48);
|
||||||
|
Loading…
Reference in New Issue
Block a user