Browse Source

🚸 Vertical Max7219::quantity in portrait orientation (#24415)

tombrazier 2 years ago
parent
commit
a811005ab2
No account linked to committer's email address
2 changed files with 10 additions and 2 deletions
  1. 10
    1
      Marlin/src/feature/max7219.cpp
  2. 0
    1
      Marlin/src/feature/max7219.h

+ 10
- 1
Marlin/src/feature/max7219.cpp View File

@@ -52,6 +52,7 @@
52 52
   #define HAS_SIDE_BY_SIDE 1
53 53
 #endif
54 54
 
55
+#define _ROT ((MAX7219_ROTATE + 360) % 360)
55 56
 #if _ROT == 0 || _ROT == 180
56 57
   #define MAX7219_X_LEDS TERN(HAS_SIDE_BY_SIDE, 8, MAX7219_LINES)
57 58
   #define MAX7219_Y_LEDS TERN(HAS_SIDE_BY_SIDE, MAX7219_LINES, 8)
@@ -597,7 +598,15 @@ void Max7219::range16(const uint8_t y, const uint8_t ot, const uint8_t nt, const
597 598
 // Apply changes to update a quantity
598 599
 void Max7219::quantity(const uint8_t pos, const uint8_t ov, const uint8_t nv, uint8_t * const rcm/*=nullptr*/) {
599 600
   for (uint8_t i = _MIN(nv, ov); i < _MAX(nv, ov); i++)
600
-    led_set(i, pos, nv >= ov, rcm);
601
+    led_set(
602
+      #if MAX7219_X_LEDS >= MAX7219_Y_LEDS
603
+        i, pos  // Single matrix or multiple matrices in Landscape
604
+      #else
605
+        pos, i  // Multiple matrices in Portrait
606
+      #endif
607
+      , nv >= ov
608
+      , rcm
609
+    );
601 610
 }
602 611
 
603 612
 void Max7219::quantity16(const uint8_t pos, const uint8_t ov, const uint8_t nv, uint8_t * const rcm/*=nullptr*/) {

+ 0
- 1
Marlin/src/feature/max7219.h View File

@@ -47,7 +47,6 @@
47 47
 #ifndef MAX7219_ROTATE
48 48
   #define MAX7219_ROTATE 0
49 49
 #endif
50
-#define _ROT ((MAX7219_ROTATE + 360) % 360)
51 50
 
52 51
 #ifndef MAX7219_NUMBER_UNITS
53 52
   #define MAX7219_NUMBER_UNITS 1

Loading…
Cancel
Save