Skip to content

Commit 750661a

Browse files
committed
Add a slightly better test in the main.cpp
1 parent 33f0f05 commit 750661a

File tree

2 files changed

+21
-13
lines changed

2 files changed

+21
-13
lines changed

components/FastLED-idf/platforms/esp/32/clockless_rmt_esp32.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,8 @@ class ClocklessController : public CPixelLEDController<RGB_ORDER>
408408
// -- Convert all pixels to RMT pulses
409409
// This function is only used when the user chooses to use the
410410
// built-in RMT driver, which needs all of the RMT pulses
411-
// up-front.
411+
// up-front. TODO: this has a large memory allocation which
412+
// could fail, should return an error if so
412413
void convertAllPixelData(PixelController<RGB_ORDER> & pixels)
413414
{
414415
// -- Make sure the data buffer is allocated

main/main.cpp

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,16 @@ extern const TProgmemPalette16 IRAM_ATTR myRedWhiteBluePalette_p;
2424

2525
#include "palettes.h"
2626

27+
//#define NUM_LEDS 512
2728
#define NUM_LEDS 40
28-
#define DATA_PIN 13
29+
#define DATA_PIN_1 13
30+
#define DATA_PIN_2 18
2931
#define BRIGHTNESS 80
3032
#define LED_TYPE WS2811
3133
#define COLOR_ORDER RGB
3234

33-
CRGB leds[NUM_LEDS];
34-
35+
CRGB leds1[NUM_LEDS];
36+
CRGB leds2[NUM_LEDS];
3537

3638
extern "C" {
3739
void app_main();
@@ -47,7 +49,7 @@ static void blinkWithFx(void *pvParameters) {
4749

4850
WS2812FX ws2812fx;
4951

50-
ws2812fx.init(NUM_LEDS, leds, false); // type was configured before
52+
ws2812fx.init(NUM_LEDS, leds1, false); // type was configured before
5153
ws2812fx.setBrightness(255);
5254
ws2812fx.setMode(0 /*segid*/, mode);
5355

@@ -103,7 +105,8 @@ void blinkLeds_interesting(void *pvParameters){
103105
startIndex = startIndex + 1; /* motion speed */
104106

105107
for( int i = 0; i < NUM_LEDS; i++) {
106-
leds[i] = ColorFromPalette( currentPalette, startIndex, 64, currentBlending);
108+
leds1[i] = ColorFromPalette( currentPalette, startIndex, 64, currentBlending);
109+
leds2[i] = ColorFromPalette( currentPalette, startIndex, 64, currentBlending);
107110
startIndex += 3;
108111
}
109112
printf("show leds\n");
@@ -135,7 +138,8 @@ static void _fastfade_cb(void *param){
135138
printf("fast hsv fade h: %d s: %d v: %d\n",ff->color.hue,ff->color.s, ff->color.v);
136139
}
137140

138-
fill_solid(leds,NUM_LEDS,ff->color);
141+
fill_solid(leds1,NUM_LEDS,ff->color);
142+
fill_solid(leds2,NUM_LEDS,ff->color);
139143

140144
FastLED.show();
141145

@@ -198,7 +202,8 @@ void blinkLeds_simple(void *pvParameters){
198202
printf("blink leds\n");
199203

200204
for (int i=0;i<NUM_LEDS;i++) {
201-
leds[i] = colors[j];
205+
leds1[i] = colors[j];
206+
leds2[i] = colors[j];
202207
}
203208
FastLED.show();
204209
delay(1000);
@@ -225,11 +230,12 @@ void blinkLeds_chase(void *pvParameters) {
225230

226231
// do it the dumb way - blank the leds
227232
for (int i=0;i<NUM_LEDS;i++) {
228-
leds[i] = CRGB::Black;
233+
leds1[i] = CRGB::Black;
234+
leds2[i] = CRGB::Black;
229235
}
230236

231237
// set the one LED to the right color
232-
leds[pos] = colors_chase[led_color];
238+
leds1[pos] = leds2[pos] = colors_chase[led_color];
233239
pos = (pos + 1) % NUM_LEDS;
234240

235241
// use a new color
@@ -249,7 +255,8 @@ void blinkLeds_chase(void *pvParameters) {
249255
void app_main() {
250256
printf(" entering app main, call add leds\n");
251257
// the WS2811 family uses the RMT driver
252-
FastLED.addLeds<LED_TYPE, DATA_PIN>(leds, NUM_LEDS);
258+
FastLED.addLeds<LED_TYPE, DATA_PIN_1>(leds1, NUM_LEDS);
259+
FastLED.addLeds<LED_TYPE, DATA_PIN_2>(leds2, NUM_LEDS);
253260

254261
// this is a good test because it uses the GPIO ports, these are 4 wire not 3 wire
255262
//FastLED.addLeds<APA102, 13, 15>(leds, NUM_LEDS);
@@ -262,6 +269,6 @@ void app_main() {
262269
printf("create task for led blinking\n");
263270

264271
//xTaskCreatePinnedToCore(&blinkLeds_simple, "blinkLeds", 4000, NULL, 5, NULL, 0);
265-
//xTaskCreatePinnedToCore(&fastfade, "blinkLeds", 4000, NULL, 5, NULL, 0);
266-
xTaskCreatePinnedToCore(&blinkWithFx, "blinkLeds", 4000, NULL, 5, NULL, 0);
272+
xTaskCreatePinnedToCore(&fastfade, "blinkLeds", 4000, NULL, 5, NULL, 0);
273+
//xTaskCreatePinnedToCore(&blinkWithFx, "blinkLeds", 4000, NULL, 5, NULL, 0);
267274
}

0 commit comments

Comments
 (0)