Compare commits
1 Commits
neopixel-s
...
ethernet-a
Author | SHA1 | Date | |
---|---|---|---|
632fb9bf82 |
26
src/config.h
26
src/config.h
@ -5,9 +5,9 @@
|
|||||||
|
|
||||||
#define LIGHTTEST
|
#define LIGHTTEST
|
||||||
|
|
||||||
// Total LED count
|
// Total LED count PER CHANNEL
|
||||||
// set to 128*8 for 4 channel, 170*8 for 3 channel
|
// set to 128 for 4 channel, 170 for 3 channel
|
||||||
#define MAX_LEDS 170*8
|
#define MAX_LEDS 170
|
||||||
|
|
||||||
//#define RGBW_MODE
|
//#define RGBW_MODE
|
||||||
// Amount of color channels per pixel - i.e. RGB = 3, RGBW = 4
|
// Amount of color channels per pixel - i.e. RGB = 3, RGBW = 4
|
||||||
@ -20,9 +20,9 @@
|
|||||||
// LED driver chip model - depends on strip
|
// LED driver chip model - depends on strip
|
||||||
#define LED_TYPE WS2812
|
#define LED_TYPE WS2812
|
||||||
|
|
||||||
// RGB pin ordering - RGB, BGR, GBR, etc
|
// RGB pin ordering - NEO_RGB, NEO_BGR, NEO_GBR, etc
|
||||||
//#define RGB_ORDER GBR
|
//#define RGB_ORDER NEO_GBR
|
||||||
#define RGB_ORDER GRB
|
#define RGB_ORDER NEO_GRB
|
||||||
|
|
||||||
// Max number of LED strips connected
|
// Max number of LED strips connected
|
||||||
// 8 for ARGB Controller PCB
|
// 8 for ARGB Controller PCB
|
||||||
@ -31,13 +31,13 @@
|
|||||||
// Define the data pin connection to each strip
|
// Define the data pin connection to each strip
|
||||||
// 0-7 for ARGB Controller PCB
|
// 0-7 for ARGB Controller PCB
|
||||||
#define STRIP1 0
|
#define STRIP1 0
|
||||||
// #define STRIP2 1
|
#define STRIP2 1
|
||||||
// #define STRIP3 2
|
#define STRIP3 2
|
||||||
// #define STRIP4 3
|
#define STRIP4 3
|
||||||
// #define STRIP5 4
|
#define STRIP5 4
|
||||||
// #define STRIP6 5
|
#define STRIP6 5
|
||||||
// #define STRIP7 6
|
#define STRIP7 6
|
||||||
// #define STRIP8 7
|
#define STRIP8 7
|
||||||
|
|
||||||
// enable pin, if any
|
// enable pin, if any
|
||||||
// 8 on ARGB controller
|
// 8 on ARGB controller
|
||||||
|
176
src/main.cpp
176
src/main.cpp
@ -6,7 +6,8 @@
|
|||||||
#include <HTTPUpdateServer.h>
|
#include <HTTPUpdateServer.h>
|
||||||
#include <WebServer.h>
|
#include <WebServer.h>
|
||||||
#include "e131.h"
|
#include "e131.h"
|
||||||
#include <Adafruit_NeoPixel.h>
|
//#include <Adafruit_NeoPixel.h>
|
||||||
|
#include <Adafruit_NeoPXL8.h>
|
||||||
//#include <FastLED.h>
|
//#include <FastLED.h>
|
||||||
//#include "FastLED_RGBW.h"
|
//#include "FastLED_RGBW.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
@ -16,7 +17,7 @@
|
|||||||
|
|
||||||
|
|
||||||
// Begin code
|
// Begin code
|
||||||
bool core1_separate_stack = true;
|
//bool core1_separate_stack = true;
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
#define PRINTFUNC print
|
#define PRINTFUNC print
|
||||||
@ -29,17 +30,12 @@ bool core1_separate_stack = true;
|
|||||||
int calculate[LED_STRIPS * 4];
|
int calculate[LED_STRIPS * 4];
|
||||||
int universes[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
|
// #ifdef RGBW_MODE
|
||||||
// // EVIL! hack to support RGBW ICs
|
// // EVIL! hack to support RGBW ICs
|
||||||
@ -50,7 +46,7 @@ int offsets[(LED_STRIPS+1)];
|
|||||||
// int strips[LED_STRIPS] = {170, 170, 170, 170, 170, 170, 170, 170};
|
// int strips[LED_STRIPS] = {170, 170, 170, 170, 170, 170, 170, 170};
|
||||||
// CRGB ledstrip[MAX_LEDS];
|
// CRGB ledstrip[MAX_LEDS];
|
||||||
// #endif
|
// #endif
|
||||||
int pins[8];
|
|
||||||
|
|
||||||
uint8_t * livedata;
|
uint8_t * livedata;
|
||||||
// Networking
|
// Networking
|
||||||
@ -91,60 +87,17 @@ float airtemparray[TEMP_SAMPLES];
|
|||||||
float cputemp;
|
float cputemp;
|
||||||
float airtemp;
|
float airtemp;
|
||||||
int datapos = 0;
|
int datapos = 0;
|
||||||
|
#ifdef RGBW_MODE
|
||||||
inline void setpixelrgb(int idx, byte r, byte g, byte b, byte w = 0) {
|
inline void setpixelrgb(int idx, byte r, byte g, byte b, byte w) {
|
||||||
if (idx < offsets[1]) {
|
leds.setPixelColor(idx, r, g, b, w);
|
||||||
pixel1->setPixelColor(idx - offsets[0], pixel1->Color(r,g,b,w));
|
|
||||||
}
|
}
|
||||||
else if (idx < offsets[2]) {
|
#else
|
||||||
pixel2->setPixelColor(idx - offsets[1], pixel2->Color(r,g,b,w));
|
inline void setpixelrgb(int idx, byte r, byte g, byte b) {
|
||||||
|
leds.setPixelColor(idx, r, g, b);
|
||||||
}
|
}
|
||||||
else if (idx < offsets[3]) {
|
#endif
|
||||||
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));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void showpixels() {
|
inline void showpixels() {
|
||||||
#ifdef STRIP1
|
leds.show();
|
||||||
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) {
|
template <class T> T print(T in) {
|
||||||
if(Serial)
|
if(Serial)
|
||||||
@ -352,10 +305,10 @@ void setup() {
|
|||||||
pinMode(23, HIGH);
|
pinMode(23, HIGH);
|
||||||
Serial.begin(115200);
|
Serial.begin(115200);
|
||||||
//rp2040.wdt_begin(8000);
|
//rp2040.wdt_begin(8000);
|
||||||
//pinMode(24, INPUT); // VBUS detect - check for USB connection
|
pinMode(24, INPUT); // VBUS detect - check for USB connection
|
||||||
//if (digitalRead(24)) {
|
if (digitalRead(24)) {
|
||||||
// delay(3000); // Wait for serial
|
delay(3000); // Wait for serial
|
||||||
//}
|
}
|
||||||
|
|
||||||
pinMode(21, INPUT); // interrupt for W500
|
pinMode(21, INPUT); // interrupt for W500
|
||||||
Serial.println("");
|
Serial.println("");
|
||||||
@ -561,35 +514,8 @@ void setup1() {
|
|||||||
pinMode(32+1, OUTPUT);
|
pinMode(32+1, OUTPUT);
|
||||||
digitalWrite(LED_BUILTIN, HIGH);
|
digitalWrite(LED_BUILTIN, HIGH);
|
||||||
println("Initializing LED outputs and universe mappings...");
|
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
|
// Populate universes and offsets
|
||||||
int offsetcount = 0;
|
int offsetcount = 0;
|
||||||
int currentsize = 0;
|
int currentsize = 0;
|
||||||
@ -636,47 +562,41 @@ void setup1() {
|
|||||||
offsetcount += tmp;
|
offsetcount += tmp;
|
||||||
currentsize += 1;
|
currentsize += 1;
|
||||||
}
|
}
|
||||||
|
if (!leds.begin(true)) {
|
||||||
|
println("Failure to initialize LEDs!");
|
||||||
|
delay(1000);
|
||||||
|
//rp2040.reboot();
|
||||||
|
} else {
|
||||||
|
println("LED driver initialized.");
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef STRIP1
|
leds.setLatchTime(500);
|
||||||
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 (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++) {
|
for (int i = 0; i < MAX_LEDS; i++) {
|
||||||
setpixelrgb(i, 0, 0, 0);
|
setpixelrgb(i, 0, 0, 0);
|
||||||
}
|
}
|
||||||
showpixels();
|
showpixels();
|
||||||
|
|
||||||
// Test all lights
|
// Test all lights
|
||||||
#ifdef LIGHTTEST
|
#ifdef LIGHTTEST
|
||||||
for (int i = 0; i < MAX_LEDS; i++) {
|
for (int i = 0; i < MAX_LEDS; i++) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user