Browse Source

Option to show SD percent on Graphical LCD

Kai 8 years ago
parent
commit
445d8215e4
1 changed files with 16 additions and 1 deletions
  1. 16
    1
      Marlin/ultralcd_impl_DOGM.h

+ 16
- 1
Marlin/ultralcd_impl_DOGM.h View File

@@ -349,6 +349,8 @@ FORCE_INLINE void _draw_axis_label(AxisEnum axis, const char *pstr, bool blink)
349 349
   }
350 350
 }
351 351
 
352
+//#define DOGM_SD_PERCENT
353
+
352 354
 static void lcd_implementation_status_screen() {
353 355
   u8g.setColorIndex(1); // black on white
354 356
 
@@ -380,6 +382,13 @@ static void lcd_implementation_status_screen() {
380 382
     if (IS_SD_PRINTING) {
381 383
       // Progress bar solid part
382 384
       u8g.drawBox(55, 50, (unsigned int)(71 * card.percentDone() * 0.01), 2 - (TALL_FONT_CORRECTION));
385
+    
386
+      #if ENABLED(DOGM_SD_PERCENT)
387
+        // Percent complete
388
+        u8g.setPrintPos(55, 48);
389
+        u8g.print(itostr3(card.percentDone()));
390
+        u8g.print('%');
391
+      #endif
383 392
     }
384 393
 
385 394
     char buffer[10];
@@ -387,7 +396,13 @@ static void lcd_implementation_status_screen() {
387 396
     bool has_days = (elapsed.value > 60*60*24L);
388 397
     elapsed.toDigital(buffer, has_days);
389 398
 
390
-    u8g.setPrintPos(has_days ? 71 : 80, 48);
399
+    #if DISABLED(DOGM_SD_PERCENT)
400
+      #define SD_DURATION_X 71
401
+    #else
402
+      #define SD_DURATION_X 89
403
+    #endif
404
+
405
+    u8g.setPrintPos(SD_DURATION_X + (has_days ? 0 : 9), 48);
391 406
     lcd_print(buffer);
392 407
 
393 408
   #endif

Loading…
Cancel
Save