failed test of NeoPXL8

ethernet-argb-controller
Cole Deck 2 months ago
parent e0249dcadf
commit 632fb9bf82

@ -3,11 +3,11 @@
#define DEBUG
//#define LIGHTTEST
#define LIGHTTEST
// Total LED count
// set to 128*8 for 4 channel, 170*8 for 3 channel
#define MAX_LEDS 170*8
// Total LED count PER CHANNEL
// set to 128 for 4 channel, 170 for 3 channel
#define MAX_LEDS 170
//#define RGBW_MODE
// Amount of color channels per pixel - i.e. RGB = 3, RGBW = 4
@ -20,9 +20,9 @@
// LED driver chip model - depends on strip
#define LED_TYPE WS2812
// RGB pin ordering - RGB, BGR, GBR, etc
//#define RGB_ORDER GBR
#define RGB_ORDER GRB
// RGB pin ordering - NEO_RGB, NEO_BGR, NEO_GBR, etc
//#define RGB_ORDER NEO_GBR
#define RGB_ORDER NEO_GRB
// Max number of LED strips connected
// 8 for ARGB Controller PCB

@ -6,7 +6,8 @@
#include <HTTPUpdateServer.h>
#include <WebServer.h>
#include "e131.h"
#include <Adafruit_NeoPixel.h>
//#include <Adafruit_NeoPixel.h>
#include <Adafruit_NeoPXL8.h>
//#include <FastLED.h>
//#include "FastLED_RGBW.h"
#include "config.h"
@ -16,7 +17,7 @@
// Begin code
bool core1_separate_stack = true;
//bool core1_separate_stack = true;
#ifdef DEBUG
#define PRINTFUNC print
@ -26,23 +27,15 @@ bool core1_separate_stack = true;
#define PRINTLNFUNC
#endif
int calculate[LED_STRIPS * 4];
int calculate[LED_STRIPS * 4];
int universes[LED_STRIPS * 4];
int strips[LED_STRIPS] = {MAX_LEDS, MAX_LEDS, MAX_LEDS, MAX_LEDS, MAX_LEDS, MAX_LEDS, MAX_LEDS, MAX_LEDS}; // for compatibility
int8_t pins[LED_STRIPS] = {STRIP1, STRIP2, STRIP3, STRIP4, STRIP5, STRIP6, STRIP7, STRIP8};
//const int strips[LED_STRIPS] = {170, 170, 170, 170, 170, 170, 170, 170};
//int offsets[(LED_STRIPS+1)];
Adafruit_NeoPXL8 leds(170, pins, RGB_ORDER);
Adafruit_NeoPixel *pixel1;
Adafruit_NeoPixel *pixel2;
Adafruit_NeoPixel *pixel3;
Adafruit_NeoPixel *pixel4;
Adafruit_NeoPixel *pixel5;
Adafruit_NeoPixel *pixel6;
Adafruit_NeoPixel *pixel7;
Adafruit_NeoPixel *pixel8;
const int strips[LED_STRIPS] = {170, 170, 170, 170, 170, 170, 170, 170};
int offsets[(LED_STRIPS+1)];
Adafruit_NeoPixel *strip_list[8] = {pixel1,pixel2,pixel3,pixel4,pixel5,pixel6,pixel7,pixel8};
// #ifdef RGBW_MODE
// // EVIL! hack to support RGBW ICs
@ -53,7 +46,7 @@ Adafruit_NeoPixel *strip_list[8] = {pixel1,pixel2,pixel3,pixel4,pixel5,pixel6,pi
// int strips[LED_STRIPS] = {170, 170, 170, 170, 170, 170, 170, 170};
// CRGB ledstrip[MAX_LEDS];
// #endif
int pins[8];
uint8_t * livedata;
// Networking
@ -94,60 +87,17 @@ float airtemparray[TEMP_SAMPLES];
float cputemp;
float airtemp;
int datapos = 0;
inline void setpixelrgb(int idx, byte r, byte g, byte b, byte w = 0) {
if (idx < offsets[1]) {
pixel1->setPixelColor(idx - offsets[0], pixel1->Color(r,g,b,w));
}
else if (idx < offsets[2]) {
pixel1->setPixelColor(idx - offsets[1], pixel1->Color(r,g,b,w));
}
else if (idx < offsets[3]) {
pixel1->setPixelColor(idx - offsets[2], pixel1->Color(r,g,b,w));
}
else if (idx < offsets[4]) {
pixel1->setPixelColor(idx - offsets[3], pixel1->Color(r,g,b,w));
}
else if (idx < offsets[5]) {
pixel1->setPixelColor(idx - offsets[4], pixel1->Color(r,g,b,w));
}
else if (idx < offsets[6]) {
pixel1->setPixelColor(idx - offsets[5], pixel1->Color(r,g,b,w));
}
else if (idx < offsets[7]) {
pixel1->setPixelColor(idx - offsets[6], pixel1->Color(r,g,b,w));
}
else if (idx < offsets[8]) {
pixel1->setPixelColor(idx - offsets[7], pixel1->Color(r,g,b,w));
}
#ifdef RGBW_MODE
inline void setpixelrgb(int idx, byte r, byte g, byte b, byte w) {
leds.setPixelColor(idx, r, g, b, w);
}
#else
inline void setpixelrgb(int idx, byte r, byte g, byte b) {
leds.setPixelColor(idx, r, g, b);
}
#endif
inline void showpixels() {
#ifdef STRIP1
pixel1->show();
#endif
#ifdef STRIP2
pixel2->show();
#endif
#ifdef STRIP3
pixel3->show();
#endif
#ifdef STRIP4
pixel4->show();
#endif
#ifdef STRIP5
pixel5->show();
#endif
#ifdef STRIP6
pixel6->show();
#endif
#ifdef STRIP7
pixel7->show();
#endif
#ifdef STRIP8
pixel8->show();
#endif
leds.show();
}
template <class T> T print(T in) {
if(Serial)
@ -355,10 +305,10 @@ void setup() {
pinMode(23, HIGH);
Serial.begin(115200);
//rp2040.wdt_begin(8000);
//pinMode(24, INPUT); // VBUS detect - check for USB connection
//if (digitalRead(24)) {
// delay(3000); // Wait for serial
//}
pinMode(24, INPUT); // VBUS detect - check for USB connection
if (digitalRead(24)) {
delay(3000); // Wait for serial
}
pinMode(21, INPUT); // interrupt for W500
Serial.println("");
@ -564,35 +514,8 @@ void setup1() {
pinMode(32+1, OUTPUT);
digitalWrite(LED_BUILTIN, HIGH);
println("Initializing LED outputs and universe mappings...");
offsets[0] = 0;
for (int i = 1; i <= LED_STRIPS; i++) {
offsets[i] = offsets[i-1] + strips[i-1];
}
#ifdef STRIP1
pins[0] = STRIP1;
#endif
#ifdef STRIP2
pins[1] = STRIP2;
#endif
#ifdef STRIP3
pins[2] = STRIP3;
#endif
#ifdef STRIP4
pins[3] = STRIP4;
#endif
#ifdef STRIP5
pins[4] = STRIP5;
#endif
#ifdef STRIP6
pins[5] = STRIP6;
#endif
#ifdef STRIP7
pins[6] = STRIP7;
#endif
#ifdef STRIP8
pins[7] = STRIP8;
#endif
// Populate universes and offsets
int offsetcount = 0;
int currentsize = 0;
@ -639,47 +562,41 @@ void setup1() {
offsetcount += tmp;
currentsize += 1;
}
if (!leds.begin(true)) {
println("Failure to initialize LEDs!");
delay(1000);
//rp2040.reboot();
} else {
println("LED driver initialized.");
}
#ifdef STRIP1
pixel1 = new Adafruit_NeoPixel(strips[0], pins[0], NEO_GRB + NEO_KHZ800);
pixel1->begin();
#endif
#ifdef STRIP2
pixel2 = new Adafruit_NeoPixel(strips[1], pins[1], NEO_GRB + NEO_KHZ800);
pixel2->begin();
#endif
#ifdef STRIP3
pixel3 = new Adafruit_NeoPixel(strips[2], pins[2], NEO_GRB + NEO_KHZ800);
pixel3->begin();
#endif
#ifdef STRIP4
pixel4 = new Adafruit_NeoPixel(strips[3], pins[3], NEO_GRB + NEO_KHZ800);
pixel4->begin();
#endif
#ifdef STRIP5
pixel5 = new Adafruit_NeoPixel(strips[4], pins[4], NEO_GRB + NEO_KHZ800);
pixel5->begin();
#endif
#ifdef STRIP6
pixel6 = new Adafruit_NeoPixel(strips[5], pins[5], NEO_GRB + NEO_KHZ800);
pixel6->begin();
#endif
#ifdef STRIP7
pixel7 = new Adafruit_NeoPixel(strips[6], pins[6], NEO_GRB + NEO_KHZ800);
pixel7->begin();
#endif
#ifdef STRIP8
pixel8 = new Adafruit_NeoPixel(strips[7], pins[7], NEO_GRB + NEO_KHZ800);
pixel8->begin();
#endif
leds.setLatchTime(500);
for (uint32_t color = 0x440000; color > 0; color >>= 8) {
leds.fill(color);
leds.show();
delay(500);
}
for (int i=0; i<8; i++) {
if (pins && (pins[i] < 0)) {
print("No leds on pin ");
Serial.println(pins[i]);
continue; // No pixels on this pin
}
leds.fill(0);
uint32_t color = 0x0000aa;
leds.fill(color, i * MAX_LEDS, MAX_LEDS);
leds.show();
delay(300);
}
for (int i = 0; i < MAX_LEDS; i++) {
setpixelrgb(i, 0, 0, 0);
}
showpixels();
// Test all lights
#ifdef LIGHTTEST
for (int i = 0; i < MAX_LEDS; i++) {

Loading…
Cancel
Save