mirror of
https://github.com/wled/WLED.git
synced 2025-07-23 18:56:41 +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() {
|
||||
if(_running) {
|
||||
if(_running || _triggered) {
|
||||
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);
|
||||
_counter_mode_call++;
|
||||
_mode_last_call_time = now;
|
||||
_triggered = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void WS2812FX::trigger() {
|
||||
_triggered = true;
|
||||
}
|
||||
|
||||
void WS2812FX::start() {
|
||||
_counter_mode_call = 0;
|
||||
_counter_mode_step = 0;
|
||||
|
@ -244,6 +244,7 @@ class WS2812FX : public Adafruit_NeoPixel {
|
||||
unlock(int i),
|
||||
unlockRange(int i, int i2),
|
||||
unlockAll(void),
|
||||
trigger(void),
|
||||
setFade(int sp);
|
||||
|
||||
boolean
|
||||
@ -319,6 +320,7 @@ class WS2812FX : public Adafruit_NeoPixel {
|
||||
mode_fade_down(void);
|
||||
|
||||
boolean
|
||||
_triggered,
|
||||
_running;
|
||||
|
||||
boolean*
|
||||
|
@ -37,7 +37,7 @@
|
||||
* @author Christian Schwinne
|
||||
*/
|
||||
//Hardware-settings (only changeble via code)
|
||||
#define LEDCOUNT 84
|
||||
#define LEDCOUNT 9
|
||||
uint8_t buttonPin = 0; //needs pull-up
|
||||
uint8_t auxPin = 16; //use e.g. for external relay
|
||||
uint8_t auxDefaultState = 0; //0: input 1: high 2: low
|
||||
@ -138,6 +138,7 @@ int overlayPauseDur[6];
|
||||
int nixieClockI = -1;
|
||||
boolean nixiePause;
|
||||
long countdownTime = 1483225200L;
|
||||
int arlsTimeoutMillis = 2500;
|
||||
boolean arlsTimeout = false;
|
||||
long arlsTimeoutTime;
|
||||
uint8_t auxTime = 0;
|
||||
|
@ -15,7 +15,7 @@ void notify(uint8_t callMode)
|
||||
default: return;
|
||||
}
|
||||
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[2] = bri;
|
||||
udpOut[3] = col[0];
|
||||
@ -41,7 +41,7 @@ void handleNotifications()
|
||||
if(packetSize && notifierUdp.remoteIP() != WiFi.localIP())
|
||||
{
|
||||
notifierUdp.read(udpIn, packetSize);
|
||||
if (udpIn[0] == 0) //wled notifier
|
||||
if (udpIn[0] == 233) //wled notifier
|
||||
{
|
||||
col[0] = udpIn[3];
|
||||
col[1] = udpIn[4];
|
||||
@ -62,27 +62,38 @@ void handleNotifications()
|
||||
bri = udpIn[2];
|
||||
colorUpdated(3);
|
||||
}
|
||||
} else if (udpIn[0] == 1) //warls
|
||||
} else if (udpIn[0] == 253) //irgb
|
||||
{
|
||||
if (packetSize > 1) {
|
||||
if (udpIn[1] == 0)
|
||||
arlsTimeout = true;
|
||||
arlsTimeoutTime = millis() + arlsTimeoutMillis;
|
||||
for (int i = 1; i < packetSize -3; i += 4)
|
||||
{
|
||||
if (udpIn[i] < LEDCOUNT)
|
||||
if (useGammaCorrectionRGB)
|
||||
{
|
||||
arlsTimeout = false;
|
||||
strip.setIndividual(udpIn[i], ((uint32_t)gamma8[udpIn[i+1]] << 16) | ((uint32_t)gamma8[udpIn[i+2]] << 8) | gamma8[udpIn[i+3]]);
|
||||
} else {
|
||||
arlsTimeout = true;
|
||||
arlsTimeoutTime = millis() + 1000*udpIn[1];
|
||||
}
|
||||
for (int i = 2; i < packetSize -3; i += 4)
|
||||
{
|
||||
if (udpIn[i] < LEDCOUNT)
|
||||
if (useGammaCorrectionRGB)
|
||||
{
|
||||
strip.setIndividual(udpIn[i], ((uint32_t)gamma8[udpIn[i+1]] << 16) | ((uint32_t)gamma8[udpIn[i+2]] << 8) | gamma8[udpIn[i+3]]);
|
||||
} else {
|
||||
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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user