Compare commits

..

2 Commits

@ -5,9 +5,9 @@
#define LIGHTTEST
// Total LED count PER CHANNEL
// set to 128 for 4 channel, 170 for 3 channel
#define MAX_LEDS 170
// Total LED count
// set to 128*8 for 4 channel, 170*8 for 3 channel
#define MAX_LEDS 170*8
//#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 - NEO_RGB, NEO_BGR, NEO_GBR, etc
//#define RGB_ORDER NEO_GBR
#define RGB_ORDER NEO_GRB
// RGB pin ordering - RGB, BGR, GBR, etc
//#define RGB_ORDER GBR
#define RGB_ORDER GRB
// Max number of LED strips connected
// 8 for ARGB Controller PCB
@ -31,13 +31,13 @@
// Define the data pin connection to each strip
// 0-7 for ARGB Controller PCB
#define STRIP1 0
#define STRIP2 1
#define STRIP3 2
#define STRIP4 3
#define STRIP5 4
#define STRIP6 5
#define STRIP7 6
#define STRIP8 7
// #define STRIP2 1
// #define STRIP3 2
// #define STRIP4 3
// #define STRIP5 4
// #define STRIP6 5
// #define STRIP7 6
// #define STRIP8 7
// enable pin, if any
// 8 on ARGB controller

@ -6,8 +6,7 @@
#include <HTTPUpdateServer.h>
#include <WebServer.h>
#include "e131.h"
//#include <Adafruit_NeoPixel.h>
#include <Adafruit_NeoPXL8.h>
#include <Adafruit_NeoPixel.h>
//#include <FastLED.h>
//#include "FastLED_RGBW.h"
#include "config.h"
@ -17,7 +16,7 @@
// Begin code
//bool core1_separate_stack = true;
bool core1_separate_stack = true;
#ifdef DEBUG
#define PRINTFUNC print
@ -27,15 +26,20 @@
#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)];
// #ifdef RGBW_MODE
// // EVIL! hack to support RGBW ICs
@ -46,7 +50,7 @@ Adafruit_NeoPXL8 leds(170, pins, RGB_ORDER);
// int strips[LED_STRIPS] = {170, 170, 170, 170, 170, 170, 170, 170};
// CRGB ledstrip[MAX_LEDS];
// #endif
int pins[8];
uint8_t * livedata;
// Networking
@ -87,17 +91,60 @@ float airtemparray[TEMP_SAMPLES];
float cputemp;
float airtemp;
int datapos = 0;
#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);
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]) {
pixel2->setPixelColor(idx - offsets[1], pixel2->Color(r,g,b,w));
}
else if (idx < offsets[3]) {
pixel3->setPixelColor(idx - offsets[2], pixel3->Color(r,g,b,w));
}
else if (idx < offsets[4]) {
pixel4->setPixelColor(idx - offsets[3], pixel4->Color(r,g,b,w));
}
else if (idx < offsets[5]) {
pixel5->setPixelColor(idx - offsets[4], pixel5->Color(r,g,b,w));
}
else if (idx < offsets[6]) {
pixel6->setPixelColor(idx - offsets[5], pixel6->Color(r,g,b,w));
}
else if (idx < offsets[7]) {
pixel7->setPixelColor(idx - offsets[6], pixel7->Color(r,g,b,w));
}
else if (idx < offsets[8]) {
pixel8->setPixelColor(idx - offsets[7], pixel8->Color(r,g,b,w));
}
}
#endif
inline void showpixels() {
leds.show();
#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
}
template <class T> T print(T in) {
if(Serial)
@ -305,10 +352,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("");
@ -514,8 +561,35 @@ 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;
@ -562,41 +636,47 @@ void setup1() {
offsetcount += tmp;
currentsize += 1;
}
if (!leds.begin(true)) {
println("Failure to initialize LEDs!");
delay(1000);
//rp2040.reboot();
} else {
println("LED driver initialized.");
}
leds.setLatchTime(500);
for (uint32_t color = 0x440000; color > 0; color >>= 8) {
leds.fill(color);
leds.show();
delay(500);
}
#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
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