Fixed realtime mode not working

This commit is contained in:
cschwinne 2018-10-01 21:31:31 +02:00
parent 92b4b69b3f
commit 473991638c
3 changed files with 15 additions and 8 deletions

View File

@ -45,7 +45,7 @@
//version code in format yymmddb (b = daily build)
#define VERSION 1809292
#define VERSION 1810011
char versionString[] = "0.8.0-a";
@ -474,7 +474,6 @@ void loop() {
yield();
handleButton();
handleNetworkTime();
if (aOtaEnabled) ArduinoOTA.handle();
handleAlexa();
handleOverlays();
@ -484,6 +483,7 @@ void loop() {
if (!realtimeActive) //block stuff if WARLS/Adalight is enabled
{
if (dnsActive) dnsServer.processNextRequest();
if (aOtaEnabled) ArduinoOTA.handle();
handleHue();
handleNightlight();
handleBlynk();

View File

@ -560,6 +560,7 @@ void applyPreset(byte index, bool loadBri, bool loadCol, bool loadFX)
effectCurrent = EEPROM.read(i+10);
effectSpeed = EEPROM.read(i+11);
effectIntensity = EEPROM.read(i+16);
effectPalette = EEPROM.read(i+17);
if (lastfx != effectCurrent) strip.setMode(effectCurrent);
strip.setSpeed(effectSpeed);
strip.setIntensity(effectIntensity);

View File

@ -55,7 +55,10 @@ void notify(byte callMode, bool followUp=false)
void arlsLock(uint32_t timeoutMs)
{
if (!realtimeActive){
strip.setRange(0, ledCount-1, 0);
for (uint16_t i = 0; i < ledCount; i++)
{
strip.setPixelColor(i,0,0,0,0);
}
strip.setMode(0);
}
realtimeActive = true;
@ -112,8 +115,9 @@ void handleNotifications()
if (!packetSize && udpRgbConnected) {
packetSize = rgbUdp.parsePacket();
if (!receiveDirect) return;
realtimeIP = rgbUdp.remoteIP();
if (packetSize > 1026 || packetSize < 3) return;
realtimeIP = rgbUdp.remoteIP();
DEBUG_PRINTLN(rgbUdp.remoteIP());
byte udpIn[packetSize];
rgbUdp.read(udpIn, packetSize);
arlsLock(realtimeTimeoutMs);
@ -185,6 +189,7 @@ void handleNotifications()
} else if (udpIn[0] > 0 && udpIn[0] < 4 && receiveDirect) //1 warls //2 drgb //3 drgbw
{
realtimeIP = notifierUdp.remoteIP();
DEBUG_PRINTLN(notifierUdp.remoteIP());
if (packetSize > 1) {
if (udpIn[1] == 0)
{
@ -224,15 +229,16 @@ void handleNotifications()
}
}
void setRealtimePixel(int i, byte r, byte g, byte b, byte w)
void setRealtimePixel(uint16_t i, byte r, byte g, byte b, byte w)
{
if (i + arlsOffset < ledCount && i + arlsOffset >= 0)
uint16_t pix = i + arlsOffset;
if (pix < ledCount)
{
if (!arlsDisableGammaCorrection && useGammaCorrectionRGB)
{
strip.setPixelColor(i + arlsOffset, gamma8[r], gamma8[g], gamma8[b], gamma8[w]);
strip.setPixelColor(pix, gamma8[r], gamma8[g], gamma8[b], gamma8[w]);
} else {
strip.setPixelColor(i + arlsOffset, r, g, b, w);
strip.setPixelColor(pix, r, g, b, w);
}
}
}