mirror of
https://github.com/wled/WLED.git
synced 2025-07-25 03:36:45 +00:00
Implemented arls8 and rgb, seems to crash WiFi, revert in next commit
Added trigger function to WS2812FX (from dev branch)
This commit is contained in:
parent
31dd40fa9e
commit
17d60ef9a0
@ -44,17 +44,22 @@ void WS2812FX::init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void WS2812FX::service() {
|
void WS2812FX::service() {
|
||||||
if(_running) {
|
if(_running || _triggered) {
|
||||||
unsigned long now = millis();
|
unsigned long now = millis();
|
||||||
|
|
||||||
if(now - _mode_last_call_time > _mode_delay) {
|
if(now - _mode_last_call_time > _mode_delay || _triggered) {
|
||||||
CALL_MODE(_mode_index);
|
CALL_MODE(_mode_index);
|
||||||
_counter_mode_call++;
|
_counter_mode_call++;
|
||||||
_mode_last_call_time = now;
|
_mode_last_call_time = now;
|
||||||
|
_triggered = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WS2812FX::trigger() {
|
||||||
|
_triggered = true;
|
||||||
|
}
|
||||||
|
|
||||||
void WS2812FX::start() {
|
void WS2812FX::start() {
|
||||||
_counter_mode_call = 0;
|
_counter_mode_call = 0;
|
||||||
_counter_mode_step = 0;
|
_counter_mode_step = 0;
|
||||||
|
@ -244,6 +244,7 @@ class WS2812FX : public Adafruit_NeoPixel {
|
|||||||
unlock(int i),
|
unlock(int i),
|
||||||
unlockRange(int i, int i2),
|
unlockRange(int i, int i2),
|
||||||
unlockAll(void),
|
unlockAll(void),
|
||||||
|
trigger(void),
|
||||||
setFade(int sp);
|
setFade(int sp);
|
||||||
|
|
||||||
boolean
|
boolean
|
||||||
@ -319,6 +320,7 @@ class WS2812FX : public Adafruit_NeoPixel {
|
|||||||
mode_fade_down(void);
|
mode_fade_down(void);
|
||||||
|
|
||||||
boolean
|
boolean
|
||||||
|
_triggered,
|
||||||
_running;
|
_running;
|
||||||
|
|
||||||
boolean*
|
boolean*
|
||||||
|
@ -37,7 +37,7 @@
|
|||||||
* @author Christian Schwinne
|
* @author Christian Schwinne
|
||||||
*/
|
*/
|
||||||
//Hardware-settings (only changeble via code)
|
//Hardware-settings (only changeble via code)
|
||||||
#define LEDCOUNT 84
|
#define LEDCOUNT 9
|
||||||
uint8_t buttonPin = 0; //needs pull-up
|
uint8_t buttonPin = 0; //needs pull-up
|
||||||
uint8_t auxPin = 16; //use e.g. for external relay
|
uint8_t auxPin = 16; //use e.g. for external relay
|
||||||
uint8_t auxDefaultState = 0; //0: input 1: high 2: low
|
uint8_t auxDefaultState = 0; //0: input 1: high 2: low
|
||||||
@ -138,6 +138,7 @@ int overlayPauseDur[6];
|
|||||||
int nixieClockI = -1;
|
int nixieClockI = -1;
|
||||||
boolean nixiePause;
|
boolean nixiePause;
|
||||||
long countdownTime = 1483225200L;
|
long countdownTime = 1483225200L;
|
||||||
|
int arlsTimeoutMillis = 2500;
|
||||||
boolean arlsTimeout = false;
|
boolean arlsTimeout = false;
|
||||||
long arlsTimeoutTime;
|
long arlsTimeoutTime;
|
||||||
uint8_t auxTime = 0;
|
uint8_t auxTime = 0;
|
||||||
|
@ -15,7 +15,7 @@ void notify(uint8_t callMode)
|
|||||||
default: return;
|
default: return;
|
||||||
}
|
}
|
||||||
byte udpOut[16];
|
byte udpOut[16];
|
||||||
udpOut[0] = 0; //0: wled notifier protocol 1: WARLS protocol
|
udpOut[0] = 233; //233: wled notifier protocol 0-7: ARLS8 protocol 253: IRGB protocol 254: RGB protocol
|
||||||
udpOut[1] = callMode;
|
udpOut[1] = callMode;
|
||||||
udpOut[2] = bri;
|
udpOut[2] = bri;
|
||||||
udpOut[3] = col[0];
|
udpOut[3] = col[0];
|
||||||
@ -41,7 +41,7 @@ void handleNotifications()
|
|||||||
if(packetSize && notifierUdp.remoteIP() != WiFi.localIP())
|
if(packetSize && notifierUdp.remoteIP() != WiFi.localIP())
|
||||||
{
|
{
|
||||||
notifierUdp.read(udpIn, packetSize);
|
notifierUdp.read(udpIn, packetSize);
|
||||||
if (udpIn[0] == 0) //wled notifier
|
if (udpIn[0] == 233) //wled notifier
|
||||||
{
|
{
|
||||||
col[0] = udpIn[3];
|
col[0] = udpIn[3];
|
||||||
col[1] = udpIn[4];
|
col[1] = udpIn[4];
|
||||||
@ -62,17 +62,11 @@ void handleNotifications()
|
|||||||
bri = udpIn[2];
|
bri = udpIn[2];
|
||||||
colorUpdated(3);
|
colorUpdated(3);
|
||||||
}
|
}
|
||||||
} else if (udpIn[0] == 1) //warls
|
} else if (udpIn[0] == 253) //irgb
|
||||||
{
|
{
|
||||||
if (packetSize > 1) {
|
|
||||||
if (udpIn[1] == 0)
|
|
||||||
{
|
|
||||||
arlsTimeout = false;
|
|
||||||
} else {
|
|
||||||
arlsTimeout = true;
|
arlsTimeout = true;
|
||||||
arlsTimeoutTime = millis() + 1000*udpIn[1];
|
arlsTimeoutTime = millis() + arlsTimeoutMillis;
|
||||||
}
|
for (int i = 1; i < packetSize -3; i += 4)
|
||||||
for (int i = 2; i < packetSize -3; i += 4)
|
|
||||||
{
|
{
|
||||||
if (udpIn[i] < LEDCOUNT)
|
if (udpIn[i] < LEDCOUNT)
|
||||||
if (useGammaCorrectionRGB)
|
if (useGammaCorrectionRGB)
|
||||||
@ -82,7 +76,24 @@ void handleNotifications()
|
|||||||
strip.setIndividual(udpIn[i], ((uint32_t)udpIn[i+1] << 16) | ((uint32_t)udpIn[i+2] << 8) | udpIn[i+3]);
|
strip.setIndividual(udpIn[i], ((uint32_t)udpIn[i+1] << 16) | ((uint32_t)udpIn[i+2] << 8) | udpIn[i+3]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else if (udpIn[0] == 254) //rgb
|
||||||
|
{
|
||||||
|
arlsTimeout = true;
|
||||||
|
arlsTimeoutTime = millis() + arlsTimeoutMillis;
|
||||||
|
for (int i = 1; i < packetSize -3; i += 3)
|
||||||
|
{
|
||||||
|
strip.setIndividual(udpIn[i/3], ((uint32_t)gamma8[udpIn[i]] << 16) | ((uint32_t)gamma8[udpIn[i]] << 8) | gamma8[udpIn[i]]);
|
||||||
}
|
}
|
||||||
|
} else //ARLS8 for now
|
||||||
|
{
|
||||||
|
if (useGammaCorrectionRGB)
|
||||||
|
{
|
||||||
|
strip.setColor(gamma8[udpIn[13]], gamma8[udpIn[14]], gamma8[udpIn[15]]);
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
strip.setColor(udpIn[13], udpIn[14], udpIn[15]);
|
||||||
|
}
|
||||||
|
strip.trigger();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (arlsTimeout && millis() > arlsTimeoutTime)
|
if (arlsTimeout && millis() > arlsTimeoutTime)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user