Browse Source

Apply TERN to status screen

Scott Lahteine 5 years ago
parent
commit
4cdd51cd3a
1 changed files with 7 additions and 32 deletions
  1. 7
    32
      Marlin/src/lcd/dogm/status_screen_DOGM.cpp

+ 7
- 32
Marlin/src/lcd/dogm/status_screen_DOGM.cpp View File

@@ -305,12 +305,7 @@ FORCE_INLINE void _draw_centered_temp(const int16_t temp, const uint8_t tx, cons
305 305
 // Homed and known, display constantly.
306 306
 //
307 307
 FORCE_INLINE void _draw_axis_value(const AxisEnum axis, const char *value, const bool blink) {
308
-  const AxisEnum a = (
309
-    #if ENABLED(LCD_SHOW_E_TOTAL)
310
-      axis == E_AXIS ? X_AXIS :
311
-    #endif
312
-    axis
313
-  );
308
+  const AxisEnum a = TERN(LCD_SHOW_E_TOTAL, axis == E_AXIS ? X_AXIS : axis, axis);
314 309
   const uint8_t offs = (XYZ_SPACING) * a;
315 310
   lcd_put_wchar(X_LABEL_POS + offs, XYZ_BASELINE, axis_codes[axis]);
316 311
   lcd_moveto(X_VALUE_POS + offs, XYZ_BASELINE);
@@ -332,11 +327,7 @@ FORCE_INLINE void _draw_axis_value(const AxisEnum axis, const char *value, const
332 327
 
333 328
 void MarlinUI::draw_status_screen() {
334 329
 
335
-  static char xstring[5
336
-    #if ENABLED(LCD_SHOW_E_TOTAL)
337
-      + 7
338
-    #endif
339
-  ], ystring[5], zstring[8];
330
+  static char xstring[TERN(LCD_SHOW_E_TOTAL, 12, 5)], ystring[5], zstring[8];
340 331
   #if ENABLED(FILAMENT_LCD_DISPLAY)
341 332
     static char wstring[5], mstring[4];
342 333
   #endif
@@ -365,11 +356,7 @@ void MarlinUI::draw_status_screen() {
365 356
     #endif
366 357
   #endif
367 358
 
368
-  const bool showxy = (true
369
-    #if ENABLED(LCD_SHOW_E_TOTAL)
370
-      && !printingIsActive()
371
-    #endif
372
-  );
359
+  const bool showxy = TERN1(LCD_SHOW_E_TOTAL, !printingIsActive());
373 360
 
374 361
   // At the first page, generate new display values
375 362
   if (first_page) {
@@ -411,13 +398,7 @@ void MarlinUI::draw_status_screen() {
411 398
 
412 399
     // Progress / elapsed / estimation updates and string formatting to avoid float math on each LCD draw
413 400
     #if HAS_PRINT_PROGRESS
414
-      const progress_t progress =
415
-        #if HAS_PRINT_PROGRESS_PERMYRIAD
416
-          get_progress_permyriad()
417
-        #else
418
-          get_progress_percent()
419
-        #endif
420
-      ;
401
+      const progress_t progress = TERN(HAS_PRINT_PROGRESS_PERMYRIAD, get_progress_permyriad, get_progress_percent)();
421 402
       duration_t elapsed = print_job_timer.duration();
422 403
       const uint8_t p = progress & 0xFF, ev = elapsed.value & 0xFF;
423 404
       if (p != lastProgress) {
@@ -433,15 +414,9 @@ void MarlinUI::draw_status_screen() {
433 414
               estimation_x_pos = _SD_INFO_X(0);
434 415
             #endif
435 416
           }
436
-          else {
437
-            strcpy(progress_string, (
438
-              #if ENABLED(PRINT_PROGRESS_SHOW_DECIMALS)
439
-                permyriadtostr4(progress)
440
-              #else
441
-                ui8tostr3rj(progress / (PROGRESS_SCALE))
442
-              #endif
443
-            ));
444
-          }
417
+          else
418
+            strcpy(progress_string, TERN(PRINT_PROGRESS_SHOW_DECIMALS, permyriadtostr4(progress), ui8tostr3rj(progress / (PROGRESS_SCALE))));
419
+
445 420
           #if BOTH(SHOW_REMAINING_TIME, ROTATE_PROGRESS_DISPLAY) // Tri-state progress display mode
446 421
             progress_x_pos = _SD_INFO_X(strlen(progress_string) + 1);
447 422
           #endif

Loading…
Cancel
Save