Browse Source

Short time prefixes, no percent prefix

Scott Lahteine 5 years ago
parent
commit
464d98d178
1 changed files with 11 additions and 17 deletions
  1. 11
    17
      Marlin/src/lcd/dogm/status_screen_DOGM.cpp

+ 11
- 17
Marlin/src/lcd/dogm/status_screen_DOGM.cpp View File

335
 
335
 
336
   #if HAS_PRINT_PROGRESS
336
   #if HAS_PRINT_PROGRESS
337
     #if DISABLED(DOGM_SD_PERCENT)
337
     #if DISABLED(DOGM_SD_PERCENT)
338
-      #define _SD_DURATION_X(len) (PROGRESS_BAR_X + (PROGRESS_BAR_WIDTH) / 2 - (len) * (MENU_FONT_WIDTH) / 2)
338
+      #define _SD_INFO_X(len) (PROGRESS_BAR_X + (PROGRESS_BAR_WIDTH) / 2 - (len) * (MENU_FONT_WIDTH) / 2)
339
     #else
339
     #else
340
-      #define _SD_DURATION_X(len) (LCD_PIXEL_WIDTH - (len) * (MENU_FONT_WIDTH))
340
+      #define _SD_INFO_X(len) (LCD_PIXEL_WIDTH - (len) * (MENU_FONT_WIDTH))
341
     #endif
341
     #endif
342
 
342
 
343
     #if ENABLED(DOGM_SD_PERCENT)
343
     #if ENABLED(DOGM_SD_PERCENT)
350
       static u8g_uint_t estimation_x_pos = 0;
350
       static u8g_uint_t estimation_x_pos = 0;
351
       static char estimation_string[10];
351
       static char estimation_string[10];
352
       #if BOTH(DOGM_SD_PERCENT, ROTATE_PROGRESS_DISPLAY)
352
       #if BOTH(DOGM_SD_PERCENT, ROTATE_PROGRESS_DISPLAY)
353
-        #define PROGRESS_TIME_PREFIX "PROG"
354
-        #define ELAPSED_TIME_PREFIX "ELAP"
355
-        #define SHOW_REMAINING_TIME_PREFIX "REM"
356
         static u8g_uint_t progress_x_pos = 0;
353
         static u8g_uint_t progress_x_pos = 0;
357
         static uint8_t progress_state = 0;
354
         static uint8_t progress_state = 0;
358
         static bool prev_blink = 0;
355
         static bool prev_blink = 0;
359
-      #else
360
-        #define SHOW_REMAINING_TIME_PREFIX 'R'
361
       #endif
356
       #endif
362
     #endif
357
     #endif
363
   #endif
358
   #endif
407
             progress_string[0] = '\0';
402
             progress_string[0] = '\0';
408
             #if ENABLED(SHOW_REMAINING_TIME)
403
             #if ENABLED(SHOW_REMAINING_TIME)
409
               estimation_string[0] = '\0';
404
               estimation_string[0] = '\0';
410
-              estimation_x_pos = _SD_DURATION_X(0);
405
+              estimation_x_pos = _SD_INFO_X(0);
411
             #endif
406
             #endif
412
           }
407
           }
413
           else {
408
           else {
420
             ));
415
             ));
421
           }
416
           }
422
           #if BOTH(SHOW_REMAINING_TIME, ROTATE_PROGRESS_DISPLAY) // Tri-state progress display mode
417
           #if BOTH(SHOW_REMAINING_TIME, ROTATE_PROGRESS_DISPLAY) // Tri-state progress display mode
423
-            progress_x_pos = _SD_DURATION_X(strlen(progress_string) + 1);
418
+            progress_x_pos = _SD_INFO_X(strlen(progress_string));
424
           #endif
419
           #endif
425
         #endif
420
         #endif
426
       }
421
       }
429
         lastElapsed = ev;
424
         lastElapsed = ev;
430
         const bool has_days = (elapsed.value >= 60*60*24L);
425
         const bool has_days = (elapsed.value >= 60*60*24L);
431
         const uint8_t len = elapsed.toDigital(elapsed_string, has_days);
426
         const uint8_t len = elapsed.toDigital(elapsed_string, has_days);
432
-        elapsed_x_pos = _SD_DURATION_X(len);
427
+        elapsed_x_pos = _SD_INFO_X(len);
433
 
428
 
434
         #if ENABLED(SHOW_REMAINING_TIME)
429
         #if ENABLED(SHOW_REMAINING_TIME)
435
           if (!(ev & 0x3)) {
430
           if (!(ev & 0x3)) {
436
             duration_t estimation = elapsed.value * (100 * (PROGRESS_SCALE) - progress) / progress;
431
             duration_t estimation = elapsed.value * (100 * (PROGRESS_SCALE) - progress) / progress;
437
             if (estimation.value == 0) {
432
             if (estimation.value == 0) {
438
               estimation_string[0] = '\0';
433
               estimation_string[0] = '\0';
439
-              estimation_x_pos = _SD_DURATION_X(0);
434
+              estimation_x_pos = _SD_INFO_X(0);
440
             }
435
             }
441
             else {
436
             else {
442
               const bool has_days = (estimation.value >= 60*60*24L);
437
               const bool has_days = (estimation.value >= 60*60*24L);
443
               const uint8_t len = estimation.toDigital(estimation_string, has_days);
438
               const uint8_t len = estimation.toDigital(estimation_string, has_days);
444
               #if BOTH(DOGM_SD_PERCENT, ROTATE_PROGRESS_DISPLAY)
439
               #if BOTH(DOGM_SD_PERCENT, ROTATE_PROGRESS_DISPLAY)
445
-                estimation_x_pos = _SD_DURATION_X(len);
440
+                estimation_x_pos = _SD_INFO_X(len);
446
               #else
441
               #else
447
-                estimation_x_pos = _SD_DURATION_X(len + 1);
442
+                estimation_x_pos = _SD_INFO_X(len + 1);
448
               #endif
443
               #endif
449
             }
444
             }
450
           }
445
           }
605
 
600
 
606
         if (progress_state == 0) {
601
         if (progress_state == 0) {
607
           if (progress_string[0]) {
602
           if (progress_string[0]) {
608
-            lcd_put_u8str(PROGRESS_BAR_X, EXTRAS_BASELINE, PROGRESS_TIME_PREFIX);
609
             lcd_put_u8str(progress_x_pos, EXTRAS_BASELINE, progress_string);
603
             lcd_put_u8str(progress_x_pos, EXTRAS_BASELINE, progress_string);
610
             lcd_put_wchar('%');
604
             lcd_put_wchar('%');
611
           }
605
           }
612
         }
606
         }
613
         else if (progress_state == 2 && estimation_string[0]) {
607
         else if (progress_state == 2 && estimation_string[0]) {
614
-          lcd_put_u8str(PROGRESS_BAR_X, EXTRAS_BASELINE, SHOW_REMAINING_TIME_PREFIX);
608
+          lcd_put_u8str(PROGRESS_BAR_X, EXTRAS_BASELINE, "R:");
615
           lcd_put_u8str(estimation_x_pos, EXTRAS_BASELINE, estimation_string);
609
           lcd_put_u8str(estimation_x_pos, EXTRAS_BASELINE, estimation_string);
616
         }
610
         }
617
         else if (elapsed_string[0]) {
611
         else if (elapsed_string[0]) {
618
-          lcd_put_u8str(PROGRESS_BAR_X, EXTRAS_BASELINE, ELAPSED_TIME_PREFIX);
612
+          lcd_put_u8str(PROGRESS_BAR_X, EXTRAS_BASELINE, "E:");
619
           lcd_put_u8str(elapsed_x_pos, EXTRAS_BASELINE, elapsed_string);
613
           lcd_put_u8str(elapsed_x_pos, EXTRAS_BASELINE, elapsed_string);
620
         }
614
         }
621
 
615
 
638
 
632
 
639
         #if ENABLED(SHOW_REMAINING_TIME)
633
         #if ENABLED(SHOW_REMAINING_TIME)
640
           if (blink && estimation_string[0]) {
634
           if (blink && estimation_string[0]) {
641
-            lcd_put_wchar(estimation_x_pos, EXTRAS_BASELINE, SHOW_REMAINING_TIME_PREFIX);
635
+            lcd_put_wchar(estimation_x_pos, EXTRAS_BASELINE, 'R');
642
             lcd_put_u8str(estimation_string);
636
             lcd_put_u8str(estimation_string);
643
           }
637
           }
644
           else
638
           else

Loading…
Cancel
Save