Sfoglia il codice sorgente

🚸 LCD_SHOW_E_TOTAL for TFT_COLOR_UI (#23127)

Mikhail Basov 2 anni fa
parent
commit
36b2650f65
Nessun account collegato all'indirizzo email del committer

+ 8
- 8
Marlin/src/lcd/dogm/status_screen_lite_ST7920.cpp Vedi File

@@ -672,14 +672,7 @@ void ST7920_Lite_Status_Screen::draw_position(const xyze_pos_t &pos, const bool
672 672
   // If position is unknown, flash the labels.
673 673
   const unsigned char alt_label = position_trusted ? 0 : (ui.get_blink() ? ' ' : 0);
674 674
 
675
-  if (TERN1(LCD_SHOW_E_TOTAL, !printingIsActive())) {
676
-    write_byte(alt_label ? alt_label : 'X');
677
-    write_str(dtostrf(pos.x, -4, 0, str), 4);
678
-
679
-    write_byte(alt_label ? alt_label : 'Y');
680
-    write_str(dtostrf(pos.y, -4, 0, str), 4);
681
-  }
682
-  else {
675
+  if (TERN0(LCD_SHOW_E_TOTAL, printingIsActive())) {
683 676
     #if ENABLED(LCD_SHOW_E_TOTAL)
684 677
       char tmp[15];
685 678
       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
687 680
       write_str(tmp);
688 681
     #endif
689 682
   }
683
+  else {
684
+    write_byte(alt_label ? alt_label : 'X');
685
+    write_str(dtostrf(pos.x, -4, 0, str), 4);
686
+
687
+    write_byte(alt_label ? alt_label : 'Y');
688
+    write_str(dtostrf(pos.y, -4, 0, str), 4);
689
+  }
690 690
 
691 691
   write_byte(alt_label ? alt_label : 'Z');
692 692
   write_str(dtostrf(pos.z, -5, 1, str), 5);

+ 24
- 14
Marlin/src/lcd/tft/ui_1024x600.cpp Vedi File

@@ -258,21 +258,31 @@ void MarlinUI::draw_status_screen() {
258 258
   tft.set_background(COLOR_BACKGROUND);
259 259
   tft.add_rectangle(0, 0, TFT_WIDTH - 8, FONT_LINE_HEIGHT, COLOR_AXIS_HOMED);
260 260
 
261
-  tft.add_text(200, 3, COLOR_AXIS_HOMED , "X");
262
-  tft.add_text(500, 3, COLOR_AXIS_HOMED , "Y");
261
+  if (TERN0(LCD_SHOW_E_TOTAL, printingIsActive())) {
262
+    #if ENABLED(LCD_SHOW_E_TOTAL)
263
+      tft.add_text(200, 3, COLOR_AXIS_HOMED , "E");
264
+      const uint8_t escale = e_move_accumulator >= 100000.0f ? 10 : 1; // After 100m switch to cm
265
+      tft_string.set(ftostr4sign(e_move_accumulator / escale));
266
+      tft_string.add(escale == 10 ? 'c' : 'm');
267
+      tft_string.add('m');
268
+      tft.add_text(500 - tft_string.width(), 3, COLOR_AXIS_HOMED, tft_string);
269
+    #endif
270
+  }
271
+  else {
272
+    tft.add_text(200, 3, COLOR_AXIS_HOMED , "X");
273
+    const bool nhx = axis_should_home(X_AXIS);
274
+    tft_string.set(blink && nhx ? "?" : ftostr4sign(LOGICAL_X_POSITION(current_position.x)));
275
+    tft.add_text(300 - tft_string.width(), 3, nhx ? COLOR_AXIS_NOT_HOMED : COLOR_AXIS_HOMED, tft_string);
276
+
277
+    tft.add_text(500, 3, COLOR_AXIS_HOMED , "Y");
278
+    const bool nhy = axis_should_home(Y_AXIS);
279
+    tft_string.set(blink && nhy ? "?" : ftostr4sign(LOGICAL_Y_POSITION(current_position.y)));
280
+    tft.add_text(600 - tft_string.width(), 3, nhy ? COLOR_AXIS_NOT_HOMED : COLOR_AXIS_HOMED, tft_string);
281
+  }
263 282
   tft.add_text(800, 3, COLOR_AXIS_HOMED , "Z");
264
-
265
-  bool not_homed = axis_should_home(X_AXIS);
266
-  tft_string.set(blink && not_homed ? "?" : ftostr4sign(LOGICAL_X_POSITION(current_position.x)));
267
-  tft.add_text(300 - tft_string.width(), 3, not_homed ? COLOR_AXIS_NOT_HOMED : COLOR_AXIS_HOMED, tft_string);
268
-
269
-  not_homed = axis_should_home(Y_AXIS);
270
-  tft_string.set(blink && not_homed ? "?" : ftostr4sign(LOGICAL_Y_POSITION(current_position.y)));
271
-  tft.add_text(600 - tft_string.width(), 3, not_homed ? COLOR_AXIS_NOT_HOMED : COLOR_AXIS_HOMED, tft_string);
272
-
273 283
   uint16_t offset = 32;
274
-  not_homed = axis_should_home(Z_AXIS);
275
-  if (blink && not_homed)
284
+  const bool nhz = axis_should_home(Z_AXIS);
285
+  if (blink && nhz)
276 286
     tft_string.set("?");
277 287
   else {
278 288
     const float z = LOGICAL_Z_POSITION(current_position.z);
@@ -283,7 +293,7 @@ void MarlinUI::draw_status_screen() {
283 293
     tft_string.set(ftostr52sp(z));
284 294
     offset -= tft_string.width();
285 295
   }
286
-  tft.add_text(900 - tft_string.width() - offset, 3, not_homed ? COLOR_AXIS_NOT_HOMED : COLOR_AXIS_HOMED, tft_string);
296
+  tft.add_text(900 - tft_string.width() - offset, 3, nhz ? COLOR_AXIS_NOT_HOMED : COLOR_AXIS_HOMED, tft_string);
287 297
   TERN_(TOUCH_SCREEN, touch.add_control(MOVE_AXIS, 4, y, TFT_WIDTH - 8, FONT_LINE_HEIGHT));
288 298
 
289 299
   y += 100;

+ 25
- 14
Marlin/src/lcd/tft/ui_320x240.cpp Vedi File

@@ -256,21 +256,32 @@ void MarlinUI::draw_status_screen() {
256 256
   tft.set_background(COLOR_BACKGROUND);
257 257
   tft.add_rectangle(0, 0, 312, 24, COLOR_AXIS_HOMED);
258 258
 
259
-  tft.add_text( 10, 3, COLOR_AXIS_HOMED , "X");
260
-  tft.add_text(127, 3, COLOR_AXIS_HOMED , "Y");
261
-  tft.add_text(219, 3, COLOR_AXIS_HOMED , "Z");
262
-
263
-  bool not_homed = axis_should_home(X_AXIS);
264
-  tft_string.set(blink && not_homed ? "?" : ftostr4sign(LOGICAL_X_POSITION(current_position.x)));
265
-  tft.add_text( 68 - tft_string.width(), 3, not_homed ? COLOR_AXIS_NOT_HOMED : COLOR_AXIS_HOMED, tft_string);
266
-
267
-  not_homed = axis_should_home(Y_AXIS);
268
-  tft_string.set(blink && not_homed ? "?" : ftostr4sign(LOGICAL_Y_POSITION(current_position.y)));
269
-  tft.add_text(185 - tft_string.width(), 3, not_homed ? COLOR_AXIS_NOT_HOMED : COLOR_AXIS_HOMED, tft_string);
259
+  if (TERN0(LCD_SHOW_E_TOTAL, printingIsActive())) {
260
+    #if ENABLED(LCD_SHOW_E_TOTAL)
261
+      tft.add_text( 10, 3, COLOR_AXIS_HOMED , "E");
262
+      const uint8_t escale = e_move_accumulator >= 100000.0f ? 10 : 1; // After 100m switch to cm
263
+      tft_string.set(ftostr4sign(e_move_accumulator / escale));
264
+      tft_string.add(escale == 10 ? 'c' : 'm');
265
+      tft_string.add('m');
266
+      tft.add_text(127 - tft_string.width(), 3, COLOR_AXIS_HOMED, tft_string);
267
+    #endif
268
+  }
269
+  else {
270
+    tft.add_text( 10, 3, COLOR_AXIS_HOMED , "X");
271
+    const bool nhx = axis_should_home(X_AXIS);
272
+    tft_string.set(blink && nhx ? "?" : ftostr4sign(LOGICAL_X_POSITION(current_position.x)));
273
+    tft.add_text( 68 - tft_string.width(), 3, nhx ? COLOR_AXIS_NOT_HOMED : COLOR_AXIS_HOMED, tft_string);
274
+
275
+    tft.add_text(127, 3, COLOR_AXIS_HOMED , "Y");
276
+    const bool nhy = axis_should_home(Y_AXIS);
277
+    tft_string.set(blink && nhy ? "?" : ftostr4sign(LOGICAL_Y_POSITION(current_position.y)));
278
+    tft.add_text(185 - tft_string.width(), 3, nhy ? COLOR_AXIS_NOT_HOMED : COLOR_AXIS_HOMED, tft_string);
279
+  }
270 280
 
271
-  not_homed = axis_should_home(Z_AXIS);
281
+  tft.add_text(219, 3, COLOR_AXIS_HOMED , "Z");
282
+  const bool nhz = axis_should_home(Z_AXIS);
272 283
   uint16_t offset = 25;
273
-  if (blink && not_homed)
284
+  if (blink && nhz)
274 285
     tft_string.set("?");
275 286
   else {
276 287
     const float z = LOGICAL_Z_POSITION(current_position.z);
@@ -281,7 +292,7 @@ void MarlinUI::draw_status_screen() {
281 292
     tft_string.set(ftostr52sp(z));
282 293
     offset -= tft_string.width();
283 294
   }
284
-  tft.add_text(301 - tft_string.width() - offset, 3, not_homed ? COLOR_AXIS_NOT_HOMED : COLOR_AXIS_HOMED, tft_string);
295
+  tft.add_text(301 - tft_string.width() - offset, 3, nhz ? COLOR_AXIS_NOT_HOMED : COLOR_AXIS_HOMED, tft_string);
285 296
   TERN_(TOUCH_SCREEN, touch.add_control(MOVE_AXIS, 0, 103, 312, 24));
286 297
 
287 298
   // feed rate

+ 24
- 14
Marlin/src/lcd/tft/ui_480x320.cpp Vedi File

@@ -258,21 +258,31 @@ void MarlinUI::draw_status_screen() {
258 258
   tft.set_background(COLOR_BACKGROUND);
259 259
   tft.add_rectangle(0, 0, TFT_WIDTH - 8, FONT_LINE_HEIGHT, COLOR_AXIS_HOMED);
260 260
 
261
-  tft.add_text( 16, 3, COLOR_AXIS_HOMED , "X");
262
-  tft.add_text(192, 3, COLOR_AXIS_HOMED , "Y");
261
+  if (TERN0(LCD_SHOW_E_TOTAL, printingIsActive())) {
262
+    #if ENABLED(LCD_SHOW_E_TOTAL)
263
+      tft.add_text( 16, 3, COLOR_AXIS_HOMED , "E");
264
+      const uint8_t escale = e_move_accumulator >= 100000.0f ? 10 : 1; // After 100m switch to cm
265
+      tft_string.set(ftostr4sign(e_move_accumulator / escale));
266
+      tft_string.add(escale == 10 ? 'c' : 'm');
267
+      tft_string.add('m');
268
+      tft.add_text(192 - tft_string.width(), 3, COLOR_AXIS_HOMED, tft_string);
269
+    #endif
270
+  }
271
+  else {
272
+    tft.add_text( 16, 3, COLOR_AXIS_HOMED , "X");
273
+    const bool nhx = axis_should_home(X_AXIS);
274
+    tft_string.set(blink && nhx ? "?" : ftostr4sign(LOGICAL_X_POSITION(current_position.x)));
275
+    tft.add_text(102 - tft_string.width(), 3, nhx ? COLOR_AXIS_NOT_HOMED : COLOR_AXIS_HOMED, tft_string);
276
+
277
+    tft.add_text(192, 3, COLOR_AXIS_HOMED , "Y");
278
+    const bool nhy = axis_should_home(Y_AXIS);
279
+    tft_string.set(blink && nhy ? "?" : ftostr4sign(LOGICAL_Y_POSITION(current_position.y)));
280
+    tft.add_text(280 - tft_string.width(), 3, nhy ? COLOR_AXIS_NOT_HOMED : COLOR_AXIS_HOMED, tft_string);
281
+  }
263 282
   tft.add_text(330, 3, COLOR_AXIS_HOMED , "Z");
264
-
265
-  bool not_homed = axis_should_home(X_AXIS);
266
-  tft_string.set(blink && not_homed ? "?" : ftostr4sign(LOGICAL_X_POSITION(current_position.x)));
267
-  tft.add_text(102 - tft_string.width(), 3, not_homed ? COLOR_AXIS_NOT_HOMED : COLOR_AXIS_HOMED, tft_string);
268
-
269
-  not_homed = axis_should_home(Y_AXIS);
270
-  tft_string.set(blink && not_homed ? "?" : ftostr4sign(LOGICAL_Y_POSITION(current_position.y)));
271
-  tft.add_text(280 - tft_string.width(), 3, not_homed ? COLOR_AXIS_NOT_HOMED : COLOR_AXIS_HOMED, tft_string);
272
-
273 283
   uint16_t offset = 32;
274
-  not_homed = axis_should_home(Z_AXIS);
275
-  if (blink && not_homed)
284
+  const bool nhz = axis_should_home(Z_AXIS);
285
+  if (blink && nhz)
276 286
     tft_string.set("?");
277 287
   else {
278 288
     const float z = LOGICAL_Z_POSITION(current_position.z);
@@ -283,7 +293,7 @@ void MarlinUI::draw_status_screen() {
283 293
     tft_string.set(ftostr52sp(z));
284 294
     offset -= tft_string.width();
285 295
   }
286
-  tft.add_text(455 - tft_string.width() - offset, 3, not_homed ? COLOR_AXIS_NOT_HOMED : COLOR_AXIS_HOMED, tft_string);
296
+  tft.add_text(455 - tft_string.width() - offset, 3, nhz ? COLOR_AXIS_NOT_HOMED : COLOR_AXIS_HOMED, tft_string);
287 297
   TERN_(TOUCH_SCREEN, touch.add_control(MOVE_AXIS, 4, y, TFT_WIDTH - 8, FONT_LINE_HEIGHT));
288 298
 
289 299
   y += TERN(HAS_UI_480x272, 38, 48);

Loading…
Annulla
Salva