FastLED 3.9.15
Loading...
Searching...
No Matches

◆ setup()

void setup ( )

Definition at line 167 of file Chromancer.ino.

167 {
168 Serial.begin(115200);
169
170 Serial.println("*** LET'S GOOOOO ***");
171
172 Serial.println("JSON SCREENMAP");
173 Serial.println(JSON_SCREEN_MAP);
174
177
178 printf("Parsed %d segment maps\n", int(segmentMaps.size()));
179 for (auto kv : segmentMaps) {
180 Serial.print(kv.first.c_str());
181 Serial.print(" ");
182 Serial.println(kv.second.getLength());
183 }
184
185
186 // ScreenMap screenmaps[4];
187 ScreenMap red, black, green, blue;
188 bool ok = true;
189 ok = segmentMaps.get("red_segment", &red) && ok;
190 ok = segmentMaps.get("back_segment", &black) && ok;
191 ok = segmentMaps.get("green_segment", &green) && ok;
192 ok = segmentMaps.get("blue_segment", &blue) && ok;
193 if (!ok) {
194 Serial.println("Failed to get all segment maps");
195 return;
196 }
197
198
199 CRGB* red_leds = leds[RedStrip];
200 CRGB* black_leds = leds[BlackStrip];
201 CRGB* green_leds = leds[GreenStrip];
202 CRGB* blue_leds = leds[BlueStrip];
203
204 FastLED.addLeds<WS2812, 2>(black_leds, lengths[BlackStrip]).setScreenMap(black);
205 FastLED.addLeds<WS2812, 3>(green_leds, lengths[GreenStrip]).setScreenMap(green);
206 FastLED.addLeds<WS2812, 1>(red_leds, lengths[RedStrip]).setScreenMap(red);
207 FastLED.addLeds<WS2812, 4>(blue_leds, lengths[BlueStrip]).setScreenMap(blue);
208
209 FastLED.show();
210 net_init();
211}
CRGB leds[NUM_LEDS]
Definition Apa102.ino:11
@ GreenStrip
@ RedStrip
@ BlackStrip
@ BlueStrip
constexpr int lengths[]
CFastLED FastLED
Global LED strip management instance.
Definition FastLED.cpp:58
WS2812 controller class.
Definition FastLED.h:193
constexpr size_t size() const
Definition map.h:226
static bool ParseJson(const char *jsonStrScreenMap, FixedMap< Str, ScreenMap, 16 > *segmentMaps, Str *err=nullptr)
Definition screenmap.cpp:37
void net_init()
Definition net.h:37
const char JSON_SCREEN_MAP[]
Representation of an RGB pixel (Red, Green, Blue)
Definition crgb.h:54

References BlackStrip, BlueStrip, FastLED, fl::FixedMap< Key, Value, N >::get(), GreenStrip, JSON_SCREEN_MAP, leds, lengths, net_init(), fl::ScreenMap::ParseJson(), RedStrip, and fl::FixedMap< Key, Value, N >::size().

+ Here is the call graph for this function: