Parcourir la source

🧑‍💻 Option allowing > 127 Neopixels (#23322)

GHGiampy il y a 3 ans
Parent
révision
ba32391454
Aucun compte lié à l'adresse e-mail de l'auteur

+ 2
- 2
Marlin/src/feature/leds/neopixel.cpp Voir le fichier

@@ -35,7 +35,7 @@
35 35
 #endif
36 36
 
37 37
 Marlin_NeoPixel neo;
38
-int8_t Marlin_NeoPixel::neoindex;
38
+pixel_index_t Marlin_NeoPixel::neoindex;
39 39
 
40 40
 Adafruit_NeoPixel Marlin_NeoPixel::adaneo1(NEOPIXEL_PIXELS, NEOPIXEL_PIN, NEOPIXEL_TYPE + NEO_KHZ800);
41 41
 #if CONJOINED_NEOPIXEL
@@ -116,7 +116,7 @@ void Marlin_NeoPixel::init() {
116 116
 
117 117
   Marlin_NeoPixel2 neo2;
118 118
 
119
-  int8_t Marlin_NeoPixel2::neoindex;
119
+  pixel_index_t Marlin_NeoPixel2::neoindex;
120 120
   Adafruit_NeoPixel Marlin_NeoPixel2::adaneo(NEOPIXEL2_PIXELS, NEOPIXEL2_PIN, NEOPIXEL2_TYPE);
121 121
 
122 122
   void Marlin_NeoPixel2::set_color(const uint32_t color) {

+ 11
- 3
Marlin/src/feature/leds/neopixel.h Voir le fichier

@@ -25,6 +25,8 @@
25 25
  * NeoPixel support
26 26
  */
27 27
 
28
+#define MAX_NEOPIXELS 127
29
+
28 30
 #ifndef _NEOPIXEL_INCLUDE_
29 31
   #error "Always include 'leds.h' and not 'neopixel.h' directly."
30 32
 #endif
@@ -63,7 +65,13 @@
63 65
 #endif
64 66
 
65 67
 // ------------------------
66
-// Function prototypes
68
+// Types
69
+// ------------------------
70
+
71
+typedef IF<(MAX_NEOPIXELS > 127), int16_t, int8_t>::type pixel_index_t;
72
+
73
+// ------------------------
74
+// Classes
67 75
 // ------------------------
68 76
 
69 77
 class Marlin_NeoPixel {
@@ -74,7 +82,7 @@ private:
74 82
   #endif
75 83
 
76 84
 public:
77
-  static int8_t neoindex;
85
+  static pixel_index_t neoindex;
78 86
 
79 87
   static void init();
80 88
   static void set_color_startup(const uint32_t c);
@@ -150,7 +158,7 @@ extern Marlin_NeoPixel neo;
150 158
     static Adafruit_NeoPixel adaneo;
151 159
 
152 160
   public:
153
-    static int8_t neoindex;
161
+    static pixel_index_t neoindex;
154 162
 
155 163
     static void init();
156 164
     static void set_color_startup(const uint32_t c);

+ 1
- 1
Marlin/src/gcode/feature/leds/M150.cpp Voir le fichier

@@ -54,7 +54,7 @@
54 54
  */
55 55
 void GcodeSuite::M150() {
56 56
   #if ENABLED(NEOPIXEL_LED)
57
-    const int8_t index = parser.intval('I', -1);
57
+    const pixel_index_t index = parser.intval('I', -1);
58 58
     #if ENABLED(NEOPIXEL2_SEPARATE)
59 59
       int8_t brightness = neo.brightness(), unit = parser.intval('S', -1);
60 60
       switch (unit) {

Chargement…
Annuler
Enregistrer