Browse Source

MarlinUI percent methods for all

Scott Lahteine 3 years ago
parent
commit
56ed55ddba
1 changed files with 31 additions and 31 deletions
  1. 31
    31
      Marlin/src/lcd/ultralcd.h

+ 31
- 31
Marlin/src/lcd/ultralcd.h View File

@@ -328,6 +328,37 @@ public:
328 328
     static inline void init_lcd() {}
329 329
   #endif
330 330
 
331
+  #if HAS_PRINT_PROGRESS
332
+    #if HAS_PRINT_PROGRESS_PERMYRIAD
333
+      typedef uint16_t progress_t;
334
+      #define PROGRESS_SCALE 100U
335
+      #define PROGRESS_MASK 0x7FFF
336
+    #else
337
+      typedef uint8_t progress_t;
338
+      #define PROGRESS_SCALE 1U
339
+      #define PROGRESS_MASK 0x7F
340
+    #endif
341
+    #if ENABLED(LCD_SET_PROGRESS_MANUALLY)
342
+      static progress_t progress_override;
343
+      static void set_progress(const progress_t p) { progress_override = _MIN(p, 100U * (PROGRESS_SCALE)); }
344
+      static void set_progress_done() { progress_override = (PROGRESS_MASK + 1U) + 100U * (PROGRESS_SCALE); }
345
+      static void progress_reset() { if (progress_override & (PROGRESS_MASK + 1U)) set_progress(0); }
346
+      #if BOTH(LCD_SET_PROGRESS_MANUALLY, USE_M73_REMAINING_TIME)
347
+        static uint32_t remaining_time;
348
+        FORCE_INLINE static void set_remaining_time(const uint32_t r) { remaining_time = r; }
349
+        FORCE_INLINE static uint32_t get_remaining_time() { return remaining_time; }
350
+        FORCE_INLINE static void reset_remaining_time() { set_remaining_time(0); }
351
+      #endif
352
+    #endif
353
+    static progress_t _get_progress();
354
+    #if HAS_PRINT_PROGRESS_PERMYRIAD
355
+      FORCE_INLINE static uint16_t get_progress_permyriad() { return _get_progress(); }
356
+    #endif
357
+    static uint8_t get_progress_percent() { return uint8_t(_get_progress() / (PROGRESS_SCALE)); }
358
+  #else
359
+    static constexpr uint8_t get_progress_percent() { return 0; }
360
+  #endif
361
+
331 362
   #if HAS_DISPLAY
332 363
 
333 364
     static void init();
@@ -350,37 +381,6 @@ public:
350 381
     static void pause_print();
351 382
     static void resume_print();
352 383
 
353
-    #if HAS_PRINT_PROGRESS
354
-      #if HAS_PRINT_PROGRESS_PERMYRIAD
355
-        typedef uint16_t progress_t;
356
-        #define PROGRESS_SCALE 100U
357
-        #define PROGRESS_MASK 0x7FFF
358
-      #else
359
-        typedef uint8_t progress_t;
360
-        #define PROGRESS_SCALE 1U
361
-        #define PROGRESS_MASK 0x7F
362
-      #endif
363
-      #if ENABLED(LCD_SET_PROGRESS_MANUALLY)
364
-        static progress_t progress_override;
365
-        static void set_progress(const progress_t p) { progress_override = _MIN(p, 100U * (PROGRESS_SCALE)); }
366
-        static void set_progress_done() { progress_override = (PROGRESS_MASK + 1U) + 100U * (PROGRESS_SCALE); }
367
-        static void progress_reset() { if (progress_override & (PROGRESS_MASK + 1U)) set_progress(0); }
368
-        #if BOTH(LCD_SET_PROGRESS_MANUALLY, USE_M73_REMAINING_TIME)
369
-          static uint32_t remaining_time;
370
-          FORCE_INLINE static void set_remaining_time(const uint32_t r) { remaining_time = r; }
371
-          FORCE_INLINE static uint32_t get_remaining_time() { return remaining_time; }
372
-          FORCE_INLINE static void reset_remaining_time() { set_remaining_time(0); }
373
-        #endif
374
-      #endif
375
-      static progress_t _get_progress();
376
-      #if HAS_PRINT_PROGRESS_PERMYRIAD
377
-        FORCE_INLINE static uint16_t get_progress_permyriad() { return _get_progress(); }
378
-      #endif
379
-      static uint8_t get_progress_percent() { return uint8_t(_get_progress() / (PROGRESS_SCALE)); }
380
-    #else
381
-      static constexpr uint8_t get_progress_percent() { return 0; }
382
-    #endif
383
-
384 384
     #if HAS_SPI_LCD
385 385
 
386 386
       static millis_t next_button_update_ms;

Loading…
Cancel
Save