Renamed NOTIFIER_CALL_MODE_
to CALL_MODE_
This commit is contained in:
parent
2c6850f6e4
commit
a17f83cedd
@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
- Fixed presets using wrong call mode (e.g. causing buttons to send UDP under direct change type)
|
- Fixed presets using wrong call mode (e.g. causing buttons to send UDP under direct change type)
|
||||||
- Increased hue buffer
|
- Increased hue buffer
|
||||||
|
- Renamed `NOTIFIER_CALL_MODE_` to `CALL_MODE_`
|
||||||
|
|
||||||
#### Build 2107090
|
#### Build 2107090
|
||||||
|
|
||||||
|
@ -123,7 +123,7 @@ class Animated_Staircase : public Usermod {
|
|||||||
// Always mark segments as "transitional", we are animating the staircase
|
// Always mark segments as "transitional", we are animating the staircase
|
||||||
segments->setOption(SEG_OPTION_TRANSITIONAL, 1, 1);
|
segments->setOption(SEG_OPTION_TRANSITIONAL, 1, 1);
|
||||||
}
|
}
|
||||||
colorUpdated(NOTIFIER_CALL_MODE_DIRECT_CHANGE);
|
colorUpdated(CALL_MODE_DIRECT_CHANGE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -298,7 +298,7 @@ class Animated_Staircase : public Usermod {
|
|||||||
}
|
}
|
||||||
segments->setOption(SEG_OPTION_ON, 1, 1);
|
segments->setOption(SEG_OPTION_ON, 1, 1);
|
||||||
}
|
}
|
||||||
colorUpdated(NOTIFIER_CALL_MODE_DIRECT_CHANGE);
|
colorUpdated(CALL_MODE_DIRECT_CHANGE);
|
||||||
DEBUG_PRINTLN(F("Animated Staircase disabled."));
|
DEBUG_PRINTLN(F("Animated Staircase disabled."));
|
||||||
}
|
}
|
||||||
enabled = enable;
|
enabled = enable;
|
||||||
|
@ -62,7 +62,7 @@ class PIRsensorSwitch : public Usermod {
|
|||||||
// PIR sensor pin
|
// PIR sensor pin
|
||||||
const uint8_t PIRsensorPin = 13; // D7 on D1 mini
|
const uint8_t PIRsensorPin = 13; // D7 on D1 mini
|
||||||
// notification mode for colorUpdated()
|
// notification mode for colorUpdated()
|
||||||
const byte NotifyUpdateMode = NOTIFIER_CALL_MODE_NO_NOTIFY; // NOTIFIER_CALL_MODE_DIRECT_CHANGE
|
const byte NotifyUpdateMode = CALL_MODE_NO_NOTIFY; // CALL_MODE_DIRECT_CHANGE
|
||||||
// 1 min delay before switch off after the sensor state goes LOW
|
// 1 min delay before switch off after the sensor state goes LOW
|
||||||
uint32_t m_switchOffDelay = 60000;
|
uint32_t m_switchOffDelay = 60000;
|
||||||
// off timer start time
|
// off timer start time
|
||||||
|
@ -58,7 +58,7 @@ private:
|
|||||||
// PIR sensor pin
|
// PIR sensor pin
|
||||||
int8_t PIRsensorPin = PIR_SENSOR_PIN;
|
int8_t PIRsensorPin = PIR_SENSOR_PIN;
|
||||||
// notification mode for colorUpdated()
|
// notification mode for colorUpdated()
|
||||||
const byte NotifyUpdateMode = NOTIFIER_CALL_MODE_NO_NOTIFY; // NOTIFIER_CALL_MODE_DIRECT_CHANGE
|
const byte NotifyUpdateMode = CALL_MODE_NO_NOTIFY; // CALL_MODE_DIRECT_CHANGE
|
||||||
// delay before switch off after the sensor state goes LOW
|
// delay before switch off after the sensor state goes LOW
|
||||||
uint32_t m_switchOffDelay = 600000; // 10min
|
uint32_t m_switchOffDelay = 600000; // 10min
|
||||||
// off timer start time
|
// off timer start time
|
||||||
|
@ -54,46 +54,46 @@ void userLoop()
|
|||||||
switch (myKey) {
|
switch (myKey) {
|
||||||
case '1':
|
case '1':
|
||||||
applyPreset(1);
|
applyPreset(1);
|
||||||
colorUpdated(NOTIFIER_CALL_MODE_FX_CHANGED);
|
colorUpdated(CALL_MODE_FX_CHANGED);
|
||||||
break;
|
break;
|
||||||
case '2':
|
case '2':
|
||||||
applyPreset(2);
|
applyPreset(2);
|
||||||
colorUpdated(NOTIFIER_CALL_MODE_FX_CHANGED);
|
colorUpdated(CALL_MODE_FX_CHANGED);
|
||||||
break;
|
break;
|
||||||
case '3':
|
case '3':
|
||||||
applyPreset(3);
|
applyPreset(3);
|
||||||
colorUpdated(NOTIFIER_CALL_MODE_FX_CHANGED);
|
colorUpdated(CALL_MODE_FX_CHANGED);
|
||||||
break;
|
break;
|
||||||
case '4':
|
case '4':
|
||||||
applyPreset(4);
|
applyPreset(4);
|
||||||
colorUpdated(NOTIFIER_CALL_MODE_FX_CHANGED);
|
colorUpdated(CALL_MODE_FX_CHANGED);
|
||||||
break;
|
break;
|
||||||
case '5':
|
case '5':
|
||||||
applyPreset(5);
|
applyPreset(5);
|
||||||
colorUpdated(NOTIFIER_CALL_MODE_FX_CHANGED);
|
colorUpdated(CALL_MODE_FX_CHANGED);
|
||||||
break;
|
break;
|
||||||
case '6':
|
case '6':
|
||||||
applyPreset(6);
|
applyPreset(6);
|
||||||
colorUpdated(NOTIFIER_CALL_MODE_FX_CHANGED);
|
colorUpdated(CALL_MODE_FX_CHANGED);
|
||||||
break;
|
break;
|
||||||
case 'A':
|
case 'A':
|
||||||
applyPreset(7);
|
applyPreset(7);
|
||||||
colorUpdated(NOTIFIER_CALL_MODE_FX_CHANGED);
|
colorUpdated(CALL_MODE_FX_CHANGED);
|
||||||
break;
|
break;
|
||||||
case 'B':
|
case 'B':
|
||||||
applyPreset(8);
|
applyPreset(8);
|
||||||
colorUpdated(NOTIFIER_CALL_MODE_FX_CHANGED);
|
colorUpdated(CALL_MODE_FX_CHANGED);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '7':
|
case '7':
|
||||||
effectCurrent += 1;
|
effectCurrent += 1;
|
||||||
if (effectCurrent >= MODE_COUNT) effectCurrent = 0;
|
if (effectCurrent >= MODE_COUNT) effectCurrent = 0;
|
||||||
colorUpdated(NOTIFIER_CALL_MODE_FX_CHANGED);
|
colorUpdated(CALL_MODE_FX_CHANGED);
|
||||||
break;
|
break;
|
||||||
case '*':
|
case '*':
|
||||||
effectCurrent -= 1;
|
effectCurrent -= 1;
|
||||||
if (effectCurrent < 0) effectCurrent = (MODE_COUNT-1);
|
if (effectCurrent < 0) effectCurrent = (MODE_COUNT-1);
|
||||||
colorUpdated(NOTIFIER_CALL_MODE_FX_CHANGED);
|
colorUpdated(CALL_MODE_FX_CHANGED);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '8':
|
case '8':
|
||||||
@ -102,7 +102,7 @@ void userLoop()
|
|||||||
} else if (effectSpeed < 255) {
|
} else if (effectSpeed < 255) {
|
||||||
effectSpeed += 1;
|
effectSpeed += 1;
|
||||||
}
|
}
|
||||||
colorUpdated(NOTIFIER_CALL_MODE_FX_CHANGED);
|
colorUpdated(CALL_MODE_FX_CHANGED);
|
||||||
break;
|
break;
|
||||||
case '0':
|
case '0':
|
||||||
if (effectSpeed > 15) {
|
if (effectSpeed > 15) {
|
||||||
@ -110,7 +110,7 @@ void userLoop()
|
|||||||
} else if (effectSpeed > 0) {
|
} else if (effectSpeed > 0) {
|
||||||
effectSpeed -= 1;
|
effectSpeed -= 1;
|
||||||
}
|
}
|
||||||
colorUpdated(NOTIFIER_CALL_MODE_FX_CHANGED);
|
colorUpdated(CALL_MODE_FX_CHANGED);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '9':
|
case '9':
|
||||||
@ -119,7 +119,7 @@ void userLoop()
|
|||||||
} else if (effectIntensity < 255) {
|
} else if (effectIntensity < 255) {
|
||||||
effectIntensity += 1;
|
effectIntensity += 1;
|
||||||
}
|
}
|
||||||
colorUpdated(NOTIFIER_CALL_MODE_FX_CHANGED);
|
colorUpdated(CALL_MODE_FX_CHANGED);
|
||||||
break;
|
break;
|
||||||
case '#':
|
case '#':
|
||||||
if (effectIntensity > 15) {
|
if (effectIntensity > 15) {
|
||||||
@ -127,18 +127,18 @@ void userLoop()
|
|||||||
} else if (effectIntensity > 0) {
|
} else if (effectIntensity > 0) {
|
||||||
effectIntensity -= 1;
|
effectIntensity -= 1;
|
||||||
}
|
}
|
||||||
colorUpdated(NOTIFIER_CALL_MODE_FX_CHANGED);
|
colorUpdated(CALL_MODE_FX_CHANGED);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'C':
|
case 'C':
|
||||||
effectPalette += 1;
|
effectPalette += 1;
|
||||||
if (effectPalette >= 50) effectPalette = 0;
|
if (effectPalette >= 50) effectPalette = 0;
|
||||||
colorUpdated(NOTIFIER_CALL_MODE_FX_CHANGED);
|
colorUpdated(CALL_MODE_FX_CHANGED);
|
||||||
break;
|
break;
|
||||||
case 'D':
|
case 'D':
|
||||||
effectPalette -= 1;
|
effectPalette -= 1;
|
||||||
if (effectPalette <= 0) effectPalette = 50;
|
if (effectPalette <= 0) effectPalette = 50;
|
||||||
colorUpdated(NOTIFIER_CALL_MODE_FX_CHANGED);
|
colorUpdated(CALL_MODE_FX_CHANGED);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,7 @@ void userLoop() {
|
|||||||
|
|
||||||
//call for notifier -> 0: init 1: direct change 2: button 3: notification 4: nightlight 5: other (No notification)
|
//call for notifier -> 0: init 1: direct change 2: button 3: notification 4: nightlight 5: other (No notification)
|
||||||
// 6: fx changed 7: hue 8: preset cycle 9: blynk 10: alexa
|
// 6: fx changed 7: hue 8: preset cycle 9: blynk 10: alexa
|
||||||
colorUpdated(NOTIFIER_CALL_MODE_FX_CHANGED);
|
colorUpdated(CALL_MODE_FX_CHANGED);
|
||||||
lastTime = millis();
|
lastTime = millis();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -42,7 +42,7 @@ class StairwayWipeUsermod : public Usermod {
|
|||||||
if (millis() + strip.timebase > (cycleTime - 25)) { //wipe complete
|
if (millis() + strip.timebase > (cycleTime - 25)) { //wipe complete
|
||||||
effectCurrent = FX_MODE_STATIC;
|
effectCurrent = FX_MODE_STATIC;
|
||||||
timeStaticStart = millis();
|
timeStaticStart = millis();
|
||||||
colorUpdated(NOTIFIER_CALL_MODE_NOTIFICATION);
|
colorUpdated(CALL_MODE_NOTIFICATION);
|
||||||
wipeState = 2;
|
wipeState = 2;
|
||||||
}
|
}
|
||||||
} else if (wipeState == 2) { //static
|
} else if (wipeState == 2) { //static
|
||||||
@ -54,7 +54,7 @@ class StairwayWipeUsermod : public Usermod {
|
|||||||
#ifdef STAIRCASE_WIPE_OFF
|
#ifdef STAIRCASE_WIPE_OFF
|
||||||
effectCurrent = FX_MODE_COLOR_WIPE;
|
effectCurrent = FX_MODE_COLOR_WIPE;
|
||||||
strip.timebase = 360 + (255 - effectSpeed)*75 - millis(); //make sure wipe starts fully lit
|
strip.timebase = 360 + (255 - effectSpeed)*75 - millis(); //make sure wipe starts fully lit
|
||||||
colorUpdated(NOTIFIER_CALL_MODE_NOTIFICATION);
|
colorUpdated(CALL_MODE_NOTIFICATION);
|
||||||
wipeState = 4;
|
wipeState = 4;
|
||||||
#else
|
#else
|
||||||
turnOff();
|
turnOff();
|
||||||
@ -100,7 +100,7 @@ class StairwayWipeUsermod : public Usermod {
|
|||||||
bool doReverse = (userVar0 == 2);
|
bool doReverse = (userVar0 == 2);
|
||||||
seg.setOption(1, doReverse);
|
seg.setOption(1, doReverse);
|
||||||
|
|
||||||
colorUpdated(NOTIFIER_CALL_MODE_NOTIFICATION);
|
colorUpdated(CALL_MODE_NOTIFICATION);
|
||||||
}
|
}
|
||||||
|
|
||||||
void turnOff()
|
void turnOff()
|
||||||
@ -111,7 +111,7 @@ class StairwayWipeUsermod : public Usermod {
|
|||||||
transitionDelayTemp = 4000; //fade out slowly
|
transitionDelayTemp = 4000; //fade out slowly
|
||||||
#endif
|
#endif
|
||||||
bri = 0;
|
bri = 0;
|
||||||
colorUpdated(NOTIFIER_CALL_MODE_NOTIFICATION);
|
colorUpdated(CALL_MODE_NOTIFICATION);
|
||||||
wipeState = 0;
|
wipeState = 0;
|
||||||
userVar0 = 0;
|
userVar0 = 0;
|
||||||
previousUserVar0 = 0;
|
previousUserVar0 = 0;
|
||||||
|
@ -47,7 +47,7 @@ void userLoop()
|
|||||||
if (millis() + strip.timebase > (cycleTime - 25)) { //wipe complete
|
if (millis() + strip.timebase > (cycleTime - 25)) { //wipe complete
|
||||||
effectCurrent = FX_MODE_STATIC;
|
effectCurrent = FX_MODE_STATIC;
|
||||||
timeStaticStart = millis();
|
timeStaticStart = millis();
|
||||||
colorUpdated(NOTIFIER_CALL_MODE_NOTIFICATION);
|
colorUpdated(CALL_MODE_NOTIFICATION);
|
||||||
wipeState = 2;
|
wipeState = 2;
|
||||||
}
|
}
|
||||||
} else if (wipeState == 2) { //static
|
} else if (wipeState == 2) { //static
|
||||||
@ -59,7 +59,7 @@ void userLoop()
|
|||||||
#ifdef STAIRCASE_WIPE_OFF
|
#ifdef STAIRCASE_WIPE_OFF
|
||||||
effectCurrent = FX_MODE_COLOR_WIPE;
|
effectCurrent = FX_MODE_COLOR_WIPE;
|
||||||
strip.timebase = 360 + (255 - effectSpeed)*75 - millis(); //make sure wipe starts fully lit
|
strip.timebase = 360 + (255 - effectSpeed)*75 - millis(); //make sure wipe starts fully lit
|
||||||
colorUpdated(NOTIFIER_CALL_MODE_NOTIFICATION);
|
colorUpdated(CALL_MODE_NOTIFICATION);
|
||||||
wipeState = 4;
|
wipeState = 4;
|
||||||
#else
|
#else
|
||||||
turnOff();
|
turnOff();
|
||||||
@ -93,7 +93,7 @@ void startWipe()
|
|||||||
bool doReverse = (userVar0 == 2);
|
bool doReverse = (userVar0 == 2);
|
||||||
seg.setOption(1, doReverse);
|
seg.setOption(1, doReverse);
|
||||||
|
|
||||||
colorUpdated(NOTIFIER_CALL_MODE_NOTIFICATION);
|
colorUpdated(CALL_MODE_NOTIFICATION);
|
||||||
}
|
}
|
||||||
|
|
||||||
void turnOff()
|
void turnOff()
|
||||||
@ -104,7 +104,7 @@ void turnOff()
|
|||||||
transitionDelayTemp = 4000; //fade out slowly
|
transitionDelayTemp = 4000; //fade out slowly
|
||||||
#endif
|
#endif
|
||||||
bri = 0;
|
bri = 0;
|
||||||
colorUpdated(NOTIFIER_CALL_MODE_NOTIFICATION);
|
colorUpdated(CALL_MODE_NOTIFICATION);
|
||||||
wipeState = 0;
|
wipeState = 0;
|
||||||
userVar0 = 0;
|
userVar0 = 0;
|
||||||
previousUserVar0 = 0;
|
previousUserVar0 = 0;
|
||||||
|
@ -138,8 +138,8 @@ public:
|
|||||||
}
|
}
|
||||||
//call for notifier -> 0: init 1: direct change 2: button 3: notification 4: nightlight 5: other (No notification)
|
//call for notifier -> 0: init 1: direct change 2: button 3: notification 4: nightlight 5: other (No notification)
|
||||||
// 6: fx changed 7: hue 8: preset cycle 9: blynk 10: alexa
|
// 6: fx changed 7: hue 8: preset cycle 9: blynk 10: alexa
|
||||||
colorUpdated(NOTIFIER_CALL_MODE_BUTTON);
|
colorUpdated(CALL_MODE_BUTTON);
|
||||||
updateInterfaces(NOTIFIER_CALL_MODE_BUTTON);
|
updateInterfaces(CALL_MODE_BUTTON);
|
||||||
}
|
}
|
||||||
Enc_A_prev = Enc_A; // Store value of A for next time
|
Enc_A_prev = Enc_A; // Store value of A for next time
|
||||||
loopTime = currentTime; // Updates loopTime
|
loopTime = currentTime; // Updates loopTime
|
||||||
|
@ -267,8 +267,8 @@ public:
|
|||||||
|
|
||||||
//call for notifier -> 0: init 1: direct change 2: button 3: notification 4: nightlight 5: other (No notification)
|
//call for notifier -> 0: init 1: direct change 2: button 3: notification 4: nightlight 5: other (No notification)
|
||||||
// 6: fx changed 7: hue 8: preset cycle 9: blynk 10: alexa
|
// 6: fx changed 7: hue 8: preset cycle 9: blynk 10: alexa
|
||||||
colorUpdated(NOTIFIER_CALL_MODE_DIRECT_CHANGE);
|
colorUpdated(CALL_MODE_DIRECT_CHANGE);
|
||||||
updateInterfaces(NOTIFIER_CALL_MODE_DIRECT_CHANGE);
|
updateInterfaces(CALL_MODE_DIRECT_CHANGE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void changeBrightness(bool increase) {
|
void changeBrightness(bool increase) {
|
||||||
|
@ -64,13 +64,13 @@ void hourChime()
|
|||||||
{
|
{
|
||||||
//strip.resetSegments();
|
//strip.resetSegments();
|
||||||
selectWordSegments(true);
|
selectWordSegments(true);
|
||||||
colorUpdated(NOTIFIER_CALL_MODE_FX_CHANGED);
|
colorUpdated(CALL_MODE_FX_CHANGED);
|
||||||
savePreset(13, false);
|
savePreset(13, false);
|
||||||
selectWordSegments(false);
|
selectWordSegments(false);
|
||||||
//strip.getSegment(0).setOption(0, true);
|
//strip.getSegment(0).setOption(0, true);
|
||||||
strip.getSegment(0).setOption(2, true);
|
strip.getSegment(0).setOption(2, true);
|
||||||
applyPreset(12);
|
applyPreset(12);
|
||||||
colorUpdated(NOTIFIER_CALL_MODE_FX_CHANGED);
|
colorUpdated(CALL_MODE_FX_CHANGED);
|
||||||
}
|
}
|
||||||
|
|
||||||
void displayTime(byte hour, byte minute)
|
void displayTime(byte hour, byte minute)
|
||||||
|
@ -44,10 +44,10 @@ void onAlexaChange(EspalexaDevice* dev)
|
|||||||
if (bri == 0)
|
if (bri == 0)
|
||||||
{
|
{
|
||||||
bri = briLast;
|
bri = briLast;
|
||||||
colorUpdated(NOTIFIER_CALL_MODE_ALEXA);
|
colorUpdated(CALL_MODE_ALEXA);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
applyPreset(macroAlexaOn, NOTIFIER_CALL_MODE_ALEXA);
|
applyPreset(macroAlexaOn, CALL_MODE_ALEXA);
|
||||||
if (bri == 0) espalexaDevice->setValue(briLast); //stop Alexa from complaining if macroAlexaOn does not actually turn on
|
if (bri == 0) espalexaDevice->setValue(briLast); //stop Alexa from complaining if macroAlexaOn does not actually turn on
|
||||||
}
|
}
|
||||||
} else if (m == EspalexaDeviceProperty::off)
|
} else if (m == EspalexaDeviceProperty::off)
|
||||||
@ -58,16 +58,16 @@ void onAlexaChange(EspalexaDevice* dev)
|
|||||||
{
|
{
|
||||||
briLast = bri;
|
briLast = bri;
|
||||||
bri = 0;
|
bri = 0;
|
||||||
colorUpdated(NOTIFIER_CALL_MODE_ALEXA);
|
colorUpdated(CALL_MODE_ALEXA);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
applyPreset(macroAlexaOff, NOTIFIER_CALL_MODE_ALEXA);
|
applyPreset(macroAlexaOff, CALL_MODE_ALEXA);
|
||||||
if (bri != 0) espalexaDevice->setValue(0); //stop Alexa from complaining if macroAlexaOff does not actually turn off
|
if (bri != 0) espalexaDevice->setValue(0); //stop Alexa from complaining if macroAlexaOff does not actually turn off
|
||||||
}
|
}
|
||||||
} else if (m == EspalexaDeviceProperty::bri)
|
} else if (m == EspalexaDeviceProperty::bri)
|
||||||
{
|
{
|
||||||
bri = espalexaDevice->getValue();
|
bri = espalexaDevice->getValue();
|
||||||
colorUpdated(NOTIFIER_CALL_MODE_ALEXA);
|
colorUpdated(CALL_MODE_ALEXA);
|
||||||
} else //color
|
} else //color
|
||||||
{
|
{
|
||||||
if (espalexaDevice->getColorMode() == EspalexaColorMode::ct) //shade of white
|
if (espalexaDevice->getColorMode() == EspalexaColorMode::ct) //shade of white
|
||||||
@ -93,7 +93,7 @@ void onAlexaChange(EspalexaDevice* dev)
|
|||||||
col[2] = ( color & 0xFF);
|
col[2] = ( color & 0xFF);
|
||||||
col[3] = 0;
|
col[3] = 0;
|
||||||
}
|
}
|
||||||
colorUpdated(NOTIFIER_CALL_MODE_ALEXA);
|
colorUpdated(CALL_MODE_ALEXA);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,45 +44,45 @@ void updateBlynk()
|
|||||||
BLYNK_WRITE(V0)
|
BLYNK_WRITE(V0)
|
||||||
{
|
{
|
||||||
bri = param.asInt();//bri
|
bri = param.asInt();//bri
|
||||||
colorUpdated(NOTIFIER_CALL_MODE_BLYNK);
|
colorUpdated(CALL_MODE_BLYNK);
|
||||||
}
|
}
|
||||||
|
|
||||||
BLYNK_WRITE(V1)
|
BLYNK_WRITE(V1)
|
||||||
{
|
{
|
||||||
blHue = param.asInt();//hue
|
blHue = param.asInt();//hue
|
||||||
colorHStoRGB(blHue*10,blSat,(false)? colSec:col);
|
colorHStoRGB(blHue*10,blSat,(false)? colSec:col);
|
||||||
colorUpdated(NOTIFIER_CALL_MODE_BLYNK);
|
colorUpdated(CALL_MODE_BLYNK);
|
||||||
}
|
}
|
||||||
|
|
||||||
BLYNK_WRITE(V2)
|
BLYNK_WRITE(V2)
|
||||||
{
|
{
|
||||||
blSat = param.asInt();//sat
|
blSat = param.asInt();//sat
|
||||||
colorHStoRGB(blHue*10,blSat,(false)? colSec:col);
|
colorHStoRGB(blHue*10,blSat,(false)? colSec:col);
|
||||||
colorUpdated(NOTIFIER_CALL_MODE_BLYNK);
|
colorUpdated(CALL_MODE_BLYNK);
|
||||||
}
|
}
|
||||||
|
|
||||||
BLYNK_WRITE(V3)
|
BLYNK_WRITE(V3)
|
||||||
{
|
{
|
||||||
bool on = (param.asInt()>0);
|
bool on = (param.asInt()>0);
|
||||||
if (!on != !bri) {toggleOnOff(); colorUpdated(NOTIFIER_CALL_MODE_BLYNK);}
|
if (!on != !bri) {toggleOnOff(); colorUpdated(CALL_MODE_BLYNK);}
|
||||||
}
|
}
|
||||||
|
|
||||||
BLYNK_WRITE(V4)
|
BLYNK_WRITE(V4)
|
||||||
{
|
{
|
||||||
effectCurrent = param.asInt()-1;//fx
|
effectCurrent = param.asInt()-1;//fx
|
||||||
colorUpdated(NOTIFIER_CALL_MODE_BLYNK);
|
colorUpdated(CALL_MODE_BLYNK);
|
||||||
}
|
}
|
||||||
|
|
||||||
BLYNK_WRITE(V5)
|
BLYNK_WRITE(V5)
|
||||||
{
|
{
|
||||||
effectSpeed = param.asInt();//sx
|
effectSpeed = param.asInt();//sx
|
||||||
colorUpdated(NOTIFIER_CALL_MODE_BLYNK);
|
colorUpdated(CALL_MODE_BLYNK);
|
||||||
}
|
}
|
||||||
|
|
||||||
BLYNK_WRITE(V6)
|
BLYNK_WRITE(V6)
|
||||||
{
|
{
|
||||||
effectIntensity = param.asInt();//ix
|
effectIntensity = param.asInt();//ix
|
||||||
colorUpdated(NOTIFIER_CALL_MODE_BLYNK);
|
colorUpdated(CALL_MODE_BLYNK);
|
||||||
}
|
}
|
||||||
|
|
||||||
BLYNK_WRITE(V7)
|
BLYNK_WRITE(V7)
|
||||||
|
@ -13,9 +13,9 @@ void shortPressAction(uint8_t b)
|
|||||||
if (!macroButton[b])
|
if (!macroButton[b])
|
||||||
{
|
{
|
||||||
toggleOnOff();
|
toggleOnOff();
|
||||||
colorUpdated(NOTIFIER_CALL_MODE_BUTTON);
|
colorUpdated(CALL_MODE_BUTTON);
|
||||||
} else {
|
} else {
|
||||||
applyPreset(macroButton[b], NOTIFIER_CALL_MODE_BUTTON);
|
applyPreset(macroButton[b], CALL_MODE_BUTTON);
|
||||||
}
|
}
|
||||||
|
|
||||||
// publish MQTT message
|
// publish MQTT message
|
||||||
@ -62,14 +62,14 @@ void handleSwitch(uint8_t b)
|
|||||||
|
|
||||||
if (millis() - buttonPressedTime[b] > WLED_DEBOUNCE_THRESHOLD) { //fire edge event only after 50ms without change (debounce)
|
if (millis() - buttonPressedTime[b] > WLED_DEBOUNCE_THRESHOLD) { //fire edge event only after 50ms without change (debounce)
|
||||||
if (!buttonPressedBefore[b]) { // on -> off
|
if (!buttonPressedBefore[b]) { // on -> off
|
||||||
if (macroButton[b]) applyPreset(macroButton[b], NOTIFIER_CALL_MODE_BUTTON);
|
if (macroButton[b]) applyPreset(macroButton[b], CALL_MODE_BUTTON);
|
||||||
else { //turn on
|
else { //turn on
|
||||||
if (!bri) {toggleOnOff(); colorUpdated(NOTIFIER_CALL_MODE_BUTTON);}
|
if (!bri) {toggleOnOff(); colorUpdated(CALL_MODE_BUTTON);}
|
||||||
}
|
}
|
||||||
} else { // off -> on
|
} else { // off -> on
|
||||||
if (macroLongPress[b]) applyPreset(macroLongPress[b], NOTIFIER_CALL_MODE_BUTTON);
|
if (macroLongPress[b]) applyPreset(macroLongPress[b], CALL_MODE_BUTTON);
|
||||||
else { //turn off
|
else { //turn off
|
||||||
if (bri) {toggleOnOff(); colorUpdated(NOTIFIER_CALL_MODE_BUTTON);}
|
if (bri) {toggleOnOff(); colorUpdated(CALL_MODE_BUTTON);}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -154,14 +154,14 @@ void handleAnalog(uint8_t b)
|
|||||||
seg.setOption(SEG_OPTION_ON, 1);
|
seg.setOption(SEG_OPTION_ON, 1);
|
||||||
}
|
}
|
||||||
// this will notify clients of update (websockets,mqtt,etc)
|
// this will notify clients of update (websockets,mqtt,etc)
|
||||||
updateInterfaces(NOTIFIER_CALL_MODE_BUTTON);
|
updateInterfaces(CALL_MODE_BUTTON);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
//TODO:
|
//TODO:
|
||||||
// we can either trigger a preset depending on the level (between short and long entries)
|
// we can either trigger a preset depending on the level (between short and long entries)
|
||||||
// or use it for RGBW direct control
|
// or use it for RGBW direct control
|
||||||
}
|
}
|
||||||
colorUpdated(NOTIFIER_CALL_MODE_BUTTON);
|
colorUpdated(CALL_MODE_BUTTON);
|
||||||
}
|
}
|
||||||
|
|
||||||
void handleButton()
|
void handleButton()
|
||||||
@ -195,7 +195,7 @@ void handleButton()
|
|||||||
{
|
{
|
||||||
if (!buttonLongPressed[b])
|
if (!buttonLongPressed[b])
|
||||||
{
|
{
|
||||||
if (macroLongPress[b]) {applyPreset(macroLongPress[b], NOTIFIER_CALL_MODE_BUTTON);}
|
if (macroLongPress[b]) {applyPreset(macroLongPress[b], CALL_MODE_BUTTON);}
|
||||||
else _setRandomColor(false,true);
|
else _setRandomColor(false,true);
|
||||||
|
|
||||||
// publish MQTT message
|
// publish MQTT message
|
||||||
@ -224,7 +224,7 @@ void handleButton()
|
|||||||
if (macroDoublePress[b])
|
if (macroDoublePress[b])
|
||||||
{
|
{
|
||||||
if (doublePress) {
|
if (doublePress) {
|
||||||
applyPreset(macroDoublePress[b], NOTIFIER_CALL_MODE_BUTTON);
|
applyPreset(macroDoublePress[b], CALL_MODE_BUTTON);
|
||||||
|
|
||||||
// publish MQTT message
|
// publish MQTT message
|
||||||
if (buttonPublishMqtt && WLED_MQTT_CONNECTED) {
|
if (buttonPublishMqtt && WLED_MQTT_CONNECTED) {
|
||||||
|
@ -66,18 +66,18 @@
|
|||||||
#define AP_BEHAVIOR_BUTTON_ONLY 3 //Only when button pressed for 6 sec
|
#define AP_BEHAVIOR_BUTTON_ONLY 3 //Only when button pressed for 6 sec
|
||||||
|
|
||||||
//Notifier callMode
|
//Notifier callMode
|
||||||
#define NOTIFIER_CALL_MODE_INIT 0 //no updates on init, can be used to disable updates
|
#define CALL_MODE_INIT 0 //no updates on init, can be used to disable updates
|
||||||
#define NOTIFIER_CALL_MODE_DIRECT_CHANGE 1
|
#define CALL_MODE_DIRECT_CHANGE 1
|
||||||
#define NOTIFIER_CALL_MODE_BUTTON 2
|
#define CALL_MODE_BUTTON 2
|
||||||
#define NOTIFIER_CALL_MODE_NOTIFICATION 3
|
#define CALL_MODE_NOTIFICATION 3
|
||||||
#define NOTIFIER_CALL_MODE_NIGHTLIGHT 4
|
#define CALL_MODE_NIGHTLIGHT 4
|
||||||
#define NOTIFIER_CALL_MODE_NO_NOTIFY 5
|
#define CALL_MODE_NO_NOTIFY 5
|
||||||
#define NOTIFIER_CALL_MODE_FX_CHANGED 6 //no longer used
|
#define CALL_MODE_FX_CHANGED 6 //no longer used
|
||||||
#define NOTIFIER_CALL_MODE_HUE 7
|
#define CALL_MODE_HUE 7
|
||||||
#define NOTIFIER_CALL_MODE_PRESET_CYCLE 8
|
#define CALL_MODE_PRESET_CYCLE 8
|
||||||
#define NOTIFIER_CALL_MODE_BLYNK 9
|
#define CALL_MODE_BLYNK 9
|
||||||
#define NOTIFIER_CALL_MODE_ALEXA 10
|
#define CALL_MODE_ALEXA 10
|
||||||
#define NOTIFIER_CALL_MODE_WS_SEND 11 //special call mode, not for notifier, updates websocket only
|
#define CALL_MODE_WS_SEND 11 //special call mode, not for notifier, updates websocket only
|
||||||
|
|
||||||
//RGB to RGBW conversion mode
|
//RGB to RGBW conversion mode
|
||||||
#define RGBW_MODE_MANUAL_ONLY 0 //No automatic white channel calculation. Manual white channel slider
|
#define RGBW_MODE_MANUAL_ONLY 0 //No automatic white channel calculation. Manual white channel slider
|
||||||
|
@ -157,7 +157,7 @@ void handleE131Packet(e131_packet_t* p, IPAddress clientIP, byte protocol){
|
|||||||
colSec[3] = e131_data[DMXAddress+12];
|
colSec[3] = e131_data[DMXAddress+12];
|
||||||
}
|
}
|
||||||
transitionDelayTemp = 0; // act fast
|
transitionDelayTemp = 0; // act fast
|
||||||
colorUpdated(NOTIFIER_CALL_MODE_NOTIFICATION); // don't send UDP
|
colorUpdated(CALL_MODE_NOTIFICATION); // don't send UDP
|
||||||
return; // don't activate realtime live mode
|
return; // don't activate realtime live mode
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -120,7 +120,7 @@ void handleIR();
|
|||||||
#include "FX.h"
|
#include "FX.h"
|
||||||
|
|
||||||
void deserializeSegment(JsonObject elem, byte it, byte presetId = 0);
|
void deserializeSegment(JsonObject elem, byte it, byte presetId = 0);
|
||||||
bool deserializeState(JsonObject root, byte callMode = NOTIFIER_CALL_MODE_DIRECT_CHANGE, byte presetId = 0);
|
bool deserializeState(JsonObject root, byte callMode = CALL_MODE_DIRECT_CHANGE, byte presetId = 0);
|
||||||
void serializeSegment(JsonObject& root, WS2812FX::Segment& seg, byte id, bool forPreset = false, bool segmentBounds = true);
|
void serializeSegment(JsonObject& root, WS2812FX::Segment& seg, byte id, bool forPreset = false, bool segmentBounds = true);
|
||||||
void serializeState(JsonObject root, bool forPreset = false, bool includeBri = true, bool segmentBounds = true);
|
void serializeState(JsonObject root, bool forPreset = false, bool includeBri = true, bool segmentBounds = true);
|
||||||
void serializeInfo(JsonObject root);
|
void serializeInfo(JsonObject root);
|
||||||
@ -181,7 +181,7 @@ void loadPlaylist(JsonObject playlistObject, byte presetId = 0);
|
|||||||
void handlePlaylist();
|
void handlePlaylist();
|
||||||
|
|
||||||
//presets.cpp
|
//presets.cpp
|
||||||
bool applyPreset(byte index, byte callMode = NOTIFIER_CALL_MODE_DIRECT_CHANGE);
|
bool applyPreset(byte index, byte callMode = CALL_MODE_DIRECT_CHANGE);
|
||||||
void savePreset(byte index, bool persist = true, const char* pname = nullptr, JsonObject saveobj = JsonObject());
|
void savePreset(byte index, bool persist = true, const char* pname = nullptr, JsonObject saveobj = JsonObject());
|
||||||
void deletePreset(byte index);
|
void deletePreset(byte index);
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ void handleHue()
|
|||||||
{
|
{
|
||||||
if (hueReceived)
|
if (hueReceived)
|
||||||
{
|
{
|
||||||
colorUpdated(NOTIFIER_CALL_MODE_HUE); hueReceived = false;
|
colorUpdated(CALL_MODE_HUE); hueReceived = false;
|
||||||
if (hueStoreAllowed && hueNewKey)
|
if (hueStoreAllowed && hueNewKey)
|
||||||
{
|
{
|
||||||
serializeConfigSec(); //save api key
|
serializeConfigSec(); //save api key
|
||||||
|
@ -71,7 +71,7 @@ void decBrightness()
|
|||||||
// apply preset or fallback to a effect and palette if it doesn't exist
|
// apply preset or fallback to a effect and palette if it doesn't exist
|
||||||
void presetFallback(uint8_t presetID, uint8_t effectID, uint8_t paletteID)
|
void presetFallback(uint8_t presetID, uint8_t effectID, uint8_t paletteID)
|
||||||
{
|
{
|
||||||
if (!applyPreset(presetID, NOTIFIER_CALL_MODE_BUTTON)) {
|
if (!applyPreset(presetID, CALL_MODE_BUTTON)) {
|
||||||
effectCurrent = effectID;
|
effectCurrent = effectID;
|
||||||
effectPalette = paletteID;
|
effectPalette = paletteID;
|
||||||
}
|
}
|
||||||
@ -85,11 +85,11 @@ bool decodeIRCustom(uint32_t code)
|
|||||||
{
|
{
|
||||||
//just examples, feel free to modify or remove
|
//just examples, feel free to modify or remove
|
||||||
case IRCUSTOM_ONOFF : toggleOnOff(); break;
|
case IRCUSTOM_ONOFF : toggleOnOff(); break;
|
||||||
case IRCUSTOM_MACRO1 : applyPreset(1, NOTIFIER_CALL_MODE_BUTTON); break;
|
case IRCUSTOM_MACRO1 : applyPreset(1, CALL_MODE_BUTTON); break;
|
||||||
|
|
||||||
default: return false;
|
default: return false;
|
||||||
}
|
}
|
||||||
if (code != IRCUSTOM_MACRO1) colorUpdated(NOTIFIER_CALL_MODE_BUTTON); //don't update color again if we apply macro, it already does it
|
if (code != IRCUSTOM_MACRO1) colorUpdated(CALL_MODE_BUTTON); //don't update color again if we apply macro, it already does it
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -183,51 +183,51 @@ void decodeIR(uint32_t code)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (nightlightActive && bri == 0) nightlightActive = false;
|
if (nightlightActive && bri == 0) nightlightActive = false;
|
||||||
colorUpdated(NOTIFIER_CALL_MODE_BUTTON); //for notifier, IR is considered a button input
|
colorUpdated(CALL_MODE_BUTTON); //for notifier, IR is considered a button input
|
||||||
}
|
}
|
||||||
|
|
||||||
void applyRepeatActions(){
|
void applyRepeatActions(){
|
||||||
|
|
||||||
if (lastRepeatableAction == ACTION_BRIGHT_UP)
|
if (lastRepeatableAction == ACTION_BRIGHT_UP)
|
||||||
{
|
{
|
||||||
incBrightness(); colorUpdated(NOTIFIER_CALL_MODE_BUTTON);
|
incBrightness(); colorUpdated(CALL_MODE_BUTTON);
|
||||||
}
|
}
|
||||||
else if (lastRepeatableAction == ACTION_BRIGHT_DOWN )
|
else if (lastRepeatableAction == ACTION_BRIGHT_DOWN )
|
||||||
{
|
{
|
||||||
decBrightness(); colorUpdated(NOTIFIER_CALL_MODE_BUTTON);
|
decBrightness(); colorUpdated(CALL_MODE_BUTTON);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lastRepeatableAction == ACTION_SPEED_UP)
|
if (lastRepeatableAction == ACTION_SPEED_UP)
|
||||||
{
|
{
|
||||||
changeEffectSpeed(lastRepeatableValue); colorUpdated(NOTIFIER_CALL_MODE_BUTTON);
|
changeEffectSpeed(lastRepeatableValue); colorUpdated(CALL_MODE_BUTTON);
|
||||||
}
|
}
|
||||||
else if (lastRepeatableAction == ACTION_SPEED_DOWN )
|
else if (lastRepeatableAction == ACTION_SPEED_DOWN )
|
||||||
{
|
{
|
||||||
changeEffectSpeed(lastRepeatableValue); colorUpdated(NOTIFIER_CALL_MODE_BUTTON);
|
changeEffectSpeed(lastRepeatableValue); colorUpdated(CALL_MODE_BUTTON);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lastRepeatableAction == ACTION_INTENSITY_UP)
|
if (lastRepeatableAction == ACTION_INTENSITY_UP)
|
||||||
{
|
{
|
||||||
changeEffectIntensity(lastRepeatableValue); colorUpdated(NOTIFIER_CALL_MODE_BUTTON);
|
changeEffectIntensity(lastRepeatableValue); colorUpdated(CALL_MODE_BUTTON);
|
||||||
}
|
}
|
||||||
else if (lastRepeatableAction == ACTION_INTENSITY_DOWN )
|
else if (lastRepeatableAction == ACTION_INTENSITY_DOWN )
|
||||||
{
|
{
|
||||||
changeEffectIntensity(lastRepeatableValue); colorUpdated(NOTIFIER_CALL_MODE_BUTTON);
|
changeEffectIntensity(lastRepeatableValue); colorUpdated(CALL_MODE_BUTTON);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lastValidCode == IR40_WPLUS)
|
if (lastValidCode == IR40_WPLUS)
|
||||||
{
|
{
|
||||||
relativeChangeWhite(10); colorUpdated(NOTIFIER_CALL_MODE_BUTTON);
|
relativeChangeWhite(10); colorUpdated(CALL_MODE_BUTTON);
|
||||||
}
|
}
|
||||||
else if (lastValidCode == IR40_WMINUS)
|
else if (lastValidCode == IR40_WMINUS)
|
||||||
{
|
{
|
||||||
relativeChangeWhite(-10, 5); colorUpdated(NOTIFIER_CALL_MODE_BUTTON);
|
relativeChangeWhite(-10, 5); colorUpdated(CALL_MODE_BUTTON);
|
||||||
}
|
}
|
||||||
else if ((lastValidCode == IR24_ON || lastValidCode == IR40_ON) && irTimesRepeated > 7 )
|
else if ((lastValidCode == IR24_ON || lastValidCode == IR40_ON) && irTimesRepeated > 7 )
|
||||||
{
|
{
|
||||||
nightlightActive = true;
|
nightlightActive = true;
|
||||||
nightlightStartTime = millis();
|
nightlightStartTime = millis();
|
||||||
colorUpdated(NOTIFIER_CALL_MODE_BUTTON);
|
colorUpdated(CALL_MODE_BUTTON);
|
||||||
}
|
}
|
||||||
else if (irEnabled == 8)
|
else if (irEnabled == 8)
|
||||||
{
|
{
|
||||||
@ -612,7 +612,7 @@ void decodeIRJson(uint32_t code)
|
|||||||
// command is JSON object
|
// command is JSON object
|
||||||
//allow applyPreset() to reuse JSON buffer, or it would alloc. a second buffer and run out of mem.
|
//allow applyPreset() to reuse JSON buffer, or it would alloc. a second buffer and run out of mem.
|
||||||
fileDoc = &irDoc;
|
fileDoc = &irDoc;
|
||||||
deserializeState(jsonCmdObj, NOTIFIER_CALL_MODE_BUTTON);
|
deserializeState(jsonCmdObj, CALL_MODE_BUTTON);
|
||||||
fileDoc = nullptr;
|
fileDoc = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -312,10 +312,10 @@ bool deserializeState(JsonObject root, byte callMode, byte presetId)
|
|||||||
loadPlaylist(playlist, presetId);
|
loadPlaylist(playlist, presetId);
|
||||||
noNotification = true; //do not notify both for this request and the first playlist entry
|
noNotification = true; //do not notify both for this request and the first playlist entry
|
||||||
} else {
|
} else {
|
||||||
interfaceUpdateCallMode = NOTIFIER_CALL_MODE_WS_SEND;
|
interfaceUpdateCallMode = CALL_MODE_WS_SEND;
|
||||||
}
|
}
|
||||||
|
|
||||||
colorUpdated(noNotification ? NOTIFIER_CALL_MODE_NO_NOTIFY : callMode);
|
colorUpdated(noNotification ? CALL_MODE_NO_NOTIFY : callMode);
|
||||||
|
|
||||||
return stateResponse;
|
return stateResponse;
|
||||||
}
|
}
|
||||||
|
@ -88,13 +88,13 @@ void colorUpdated(int callMode)
|
|||||||
{
|
{
|
||||||
//call for notifier -> 0: init 1: direct change 2: button 3: notification 4: nightlight 5: other (No notification)
|
//call for notifier -> 0: init 1: direct change 2: button 3: notification 4: nightlight 5: other (No notification)
|
||||||
// 6: fx changed 7: hue 8: preset cycle 9: blynk 10: alexa
|
// 6: fx changed 7: hue 8: preset cycle 9: blynk 10: alexa
|
||||||
if (callMode != NOTIFIER_CALL_MODE_INIT &&
|
if (callMode != CALL_MODE_INIT &&
|
||||||
callMode != NOTIFIER_CALL_MODE_DIRECT_CHANGE &&
|
callMode != CALL_MODE_DIRECT_CHANGE &&
|
||||||
callMode != NOTIFIER_CALL_MODE_NO_NOTIFY) strip.applyToAllSelected = true; //if not from JSON api, which directly sets segments
|
callMode != CALL_MODE_NO_NOTIFY) strip.applyToAllSelected = true; //if not from JSON api, which directly sets segments
|
||||||
|
|
||||||
bool someSel = false;
|
bool someSel = false;
|
||||||
|
|
||||||
if (callMode == NOTIFIER_CALL_MODE_NOTIFICATION) {
|
if (callMode == CALL_MODE_NOTIFICATION) {
|
||||||
someSel = (receiveNotificationBrightness || receiveNotificationColor || receiveNotificationEffects);
|
someSel = (receiveNotificationBrightness || receiveNotificationColor || receiveNotificationEffects);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -119,17 +119,17 @@ void colorUpdated(int callMode)
|
|||||||
interfaceUpdateCallMode = callMode;
|
interfaceUpdateCallMode = callMode;
|
||||||
} else {
|
} else {
|
||||||
if (nightlightActive && !nightlightActiveOld &&
|
if (nightlightActive && !nightlightActiveOld &&
|
||||||
callMode != NOTIFIER_CALL_MODE_NOTIFICATION &&
|
callMode != CALL_MODE_NOTIFICATION &&
|
||||||
callMode != NOTIFIER_CALL_MODE_NO_NOTIFY)
|
callMode != CALL_MODE_NO_NOTIFY)
|
||||||
{
|
{
|
||||||
notify(NOTIFIER_CALL_MODE_NIGHTLIGHT);
|
notify(CALL_MODE_NIGHTLIGHT);
|
||||||
interfaceUpdateCallMode = NOTIFIER_CALL_MODE_NIGHTLIGHT;
|
interfaceUpdateCallMode = CALL_MODE_NIGHTLIGHT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!colChanged) return; //following code is for e.g. initiating transitions
|
if (!colChanged) return; //following code is for e.g. initiating transitions
|
||||||
|
|
||||||
if (callMode != NOTIFIER_CALL_MODE_NO_NOTIFY && nightlightActive && (nightlightMode == NL_MODE_FADE || nightlightMode == NL_MODE_COLORFADE))
|
if (callMode != CALL_MODE_NO_NOTIFY && nightlightActive && (nightlightMode == NL_MODE_FADE || nightlightMode == NL_MODE_COLORFADE))
|
||||||
{
|
{
|
||||||
briNlT = bri;
|
briNlT = bri;
|
||||||
nightlightDelayMs -= (millis() - nightlightStartTime);
|
nightlightDelayMs -= (millis() - nightlightStartTime);
|
||||||
@ -143,19 +143,19 @@ void colorUpdated(int callMode)
|
|||||||
if (briT == 0)
|
if (briT == 0)
|
||||||
{
|
{
|
||||||
//setLedsStandard(true); //do not color transition if starting from off!
|
//setLedsStandard(true); //do not color transition if starting from off!
|
||||||
if (callMode != NOTIFIER_CALL_MODE_NOTIFICATION) resetTimebase(); //effect start from beginning
|
if (callMode != CALL_MODE_NOTIFICATION) resetTimebase(); //effect start from beginning
|
||||||
}
|
}
|
||||||
|
|
||||||
briIT = bri;
|
briIT = bri;
|
||||||
if (bri > 0) briLast = bri;
|
if (bri > 0) briLast = bri;
|
||||||
|
|
||||||
//deactivate nightlight if target brightness is reached
|
//deactivate nightlight if target brightness is reached
|
||||||
if (bri == nightlightTargetBri && callMode != NOTIFIER_CALL_MODE_NO_NOTIFY && nightlightMode != NL_MODE_SUN) nightlightActive = false;
|
if (bri == nightlightTargetBri && callMode != CALL_MODE_NO_NOTIFY && nightlightMode != NL_MODE_SUN) nightlightActive = false;
|
||||||
|
|
||||||
if (fadeTransition)
|
if (fadeTransition)
|
||||||
{
|
{
|
||||||
//set correct delay if not using notification delay
|
//set correct delay if not using notification delay
|
||||||
if (callMode != NOTIFIER_CALL_MODE_NOTIFICATION && !jsonTransitionOnce) transitionDelayTemp = transitionDelay;
|
if (callMode != CALL_MODE_NOTIFICATION && !jsonTransitionOnce) transitionDelayTemp = transitionDelay;
|
||||||
jsonTransitionOnce = false;
|
jsonTransitionOnce = false;
|
||||||
strip.setTransition(transitionDelayTemp);
|
strip.setTransition(transitionDelayTemp);
|
||||||
if (transitionDelayTemp == 0) {setLedsStandard(); strip.trigger(); return;}
|
if (transitionDelayTemp == 0) {setLedsStandard(); strip.trigger(); return;}
|
||||||
@ -180,19 +180,19 @@ void colorUpdated(int callMode)
|
|||||||
void updateInterfaces(uint8_t callMode)
|
void updateInterfaces(uint8_t callMode)
|
||||||
{
|
{
|
||||||
sendDataWs();
|
sendDataWs();
|
||||||
if (callMode == NOTIFIER_CALL_MODE_WS_SEND) {
|
if (callMode == CALL_MODE_WS_SEND) {
|
||||||
lastInterfaceUpdate = millis();
|
lastInterfaceUpdate = millis();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef WLED_DISABLE_ALEXA
|
#ifndef WLED_DISABLE_ALEXA
|
||||||
if (espalexaDevice != nullptr && callMode != NOTIFIER_CALL_MODE_ALEXA) {
|
if (espalexaDevice != nullptr && callMode != CALL_MODE_ALEXA) {
|
||||||
espalexaDevice->setValue(bri);
|
espalexaDevice->setValue(bri);
|
||||||
espalexaDevice->setColor(col[0], col[1], col[2]);
|
espalexaDevice->setColor(col[0], col[1], col[2]);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (callMode != NOTIFIER_CALL_MODE_BLYNK &&
|
if (callMode != CALL_MODE_BLYNK &&
|
||||||
callMode != NOTIFIER_CALL_MODE_NO_NOTIFY) updateBlynk();
|
callMode != CALL_MODE_NO_NOTIFY) updateBlynk();
|
||||||
doPublishMqtt = true;
|
doPublishMqtt = true;
|
||||||
lastInterfaceUpdate = millis();
|
lastInterfaceUpdate = millis();
|
||||||
}
|
}
|
||||||
@ -254,7 +254,7 @@ void handleNightlight()
|
|||||||
if (bri) effectSpeed += 60; //sunset if currently on
|
if (bri) effectSpeed += 60; //sunset if currently on
|
||||||
briNlT = !bri; //true == sunrise, false == sunset
|
briNlT = !bri; //true == sunrise, false == sunset
|
||||||
if (!bri) bri = briLast;
|
if (!bri) bri = briLast;
|
||||||
colorUpdated(NOTIFIER_CALL_MODE_NO_NOTIFY);
|
colorUpdated(CALL_MODE_NO_NOTIFY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
float nper = (millis() - nightlightStartTime)/((float)nightlightDelayMs);
|
float nper = (millis() - nightlightStartTime)/((float)nightlightDelayMs);
|
||||||
@ -265,7 +265,7 @@ void handleNightlight()
|
|||||||
{
|
{
|
||||||
for (byte i=0; i<4; i++) col[i] = colNlT[i]+ ((colSec[i] - colNlT[i])*nper); // fading from actual color to secondary color
|
for (byte i=0; i<4; i++) col[i] = colNlT[i]+ ((colSec[i] - colNlT[i])*nper); // fading from actual color to secondary color
|
||||||
}
|
}
|
||||||
colorUpdated(NOTIFIER_CALL_MODE_NO_NOTIFY);
|
colorUpdated(CALL_MODE_NO_NOTIFY);
|
||||||
}
|
}
|
||||||
if (nper >= 1) //nightlight duration over
|
if (nper >= 1) //nightlight duration over
|
||||||
{
|
{
|
||||||
@ -273,7 +273,7 @@ void handleNightlight()
|
|||||||
if (nightlightMode == NL_MODE_SET)
|
if (nightlightMode == NL_MODE_SET)
|
||||||
{
|
{
|
||||||
bri = nightlightTargetBri;
|
bri = nightlightTargetBri;
|
||||||
colorUpdated(NOTIFIER_CALL_MODE_NO_NOTIFY);
|
colorUpdated(CALL_MODE_NO_NOTIFY);
|
||||||
}
|
}
|
||||||
if (bri == 0) briLast = briNlT;
|
if (bri == 0) briLast = briNlT;
|
||||||
if (nightlightMode == NL_MODE_SUN)
|
if (nightlightMode == NL_MODE_SUN)
|
||||||
@ -297,7 +297,7 @@ void handleNightlight()
|
|||||||
effectCurrent = colNlT[0];
|
effectCurrent = colNlT[0];
|
||||||
effectSpeed = colNlT[1];
|
effectSpeed = colNlT[1];
|
||||||
effectPalette = colNlT[2];
|
effectPalette = colNlT[2];
|
||||||
colorUpdated(NOTIFIER_CALL_MODE_NO_NOTIFY);
|
colorUpdated(CALL_MODE_NO_NOTIFY);
|
||||||
}
|
}
|
||||||
nightlightActiveOld = false;
|
nightlightActiveOld = false;
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,7 @@ void parseMQTTBriPayload(char* payload)
|
|||||||
uint8_t in = strtoul(payload, NULL, 10);
|
uint8_t in = strtoul(payload, NULL, 10);
|
||||||
if (in == 0 && bri > 0) briLast = bri;
|
if (in == 0 && bri > 0) briLast = bri;
|
||||||
bri = in;
|
bri = in;
|
||||||
colorUpdated(NOTIFIER_CALL_MODE_DIRECT_CHANGE);
|
colorUpdated(CALL_MODE_DIRECT_CHANGE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -88,7 +88,7 @@ void onMqttMessage(char* topic, char* payload, AsyncMqttClientMessageProperties
|
|||||||
|
|
||||||
if (strcmp_P(topic, PSTR("/col")) == 0) {
|
if (strcmp_P(topic, PSTR("/col")) == 0) {
|
||||||
colorFromDecOrHexString(col, (char*)payloadStr);
|
colorFromDecOrHexString(col, (char*)payloadStr);
|
||||||
colorUpdated(NOTIFIER_CALL_MODE_DIRECT_CHANGE);
|
colorUpdated(CALL_MODE_DIRECT_CHANGE);
|
||||||
} else if (strcmp_P(topic, PSTR("/api")) == 0) {
|
} else if (strcmp_P(topic, PSTR("/api")) == 0) {
|
||||||
if (payload[0] == '{') { //JSON API
|
if (payload[0] == '{') { //JSON API
|
||||||
DynamicJsonDocument doc(JSON_BUFFER_SIZE);
|
DynamicJsonDocument doc(JSON_BUFFER_SIZE);
|
||||||
|
@ -919,7 +919,7 @@ bool handleSet(AsyncWebServerRequest *request, const String& req, bool apply)
|
|||||||
strip.applyToAllSelected = false;
|
strip.applyToAllSelected = false;
|
||||||
|
|
||||||
pos = req.indexOf(F("&NN")); //do not send UDP notifications this time
|
pos = req.indexOf(F("&NN")); //do not send UDP notifications this time
|
||||||
colorUpdated((pos > 0) ? NOTIFIER_CALL_MODE_NO_NOTIFY : NOTIFIER_CALL_MODE_DIRECT_CHANGE);
|
colorUpdated((pos > 0) ? CALL_MODE_NO_NOTIFY : CALL_MODE_DIRECT_CHANGE);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -13,14 +13,14 @@ void notify(byte callMode, bool followUp)
|
|||||||
if (!udpConnected) return;
|
if (!udpConnected) return;
|
||||||
switch (callMode)
|
switch (callMode)
|
||||||
{
|
{
|
||||||
case NOTIFIER_CALL_MODE_INIT: return;
|
case CALL_MODE_INIT: return;
|
||||||
case NOTIFIER_CALL_MODE_DIRECT_CHANGE: if (!notifyDirect) return; break;
|
case CALL_MODE_DIRECT_CHANGE: if (!notifyDirect) return; break;
|
||||||
case NOTIFIER_CALL_MODE_BUTTON: if (!notifyButton) return; break;
|
case CALL_MODE_BUTTON: if (!notifyButton) return; break;
|
||||||
case NOTIFIER_CALL_MODE_NIGHTLIGHT: if (!notifyDirect) return; break;
|
case CALL_MODE_NIGHTLIGHT: if (!notifyDirect) return; break;
|
||||||
case NOTIFIER_CALL_MODE_HUE: if (!notifyHue) return; break;
|
case CALL_MODE_HUE: if (!notifyHue) return; break;
|
||||||
case NOTIFIER_CALL_MODE_PRESET_CYCLE: if (!notifyDirect) return; break;
|
case CALL_MODE_PRESET_CYCLE: if (!notifyDirect) return; break;
|
||||||
case NOTIFIER_CALL_MODE_BLYNK: if (!notifyDirect) return; break;
|
case CALL_MODE_BLYNK: if (!notifyDirect) return; break;
|
||||||
case NOTIFIER_CALL_MODE_ALEXA: if (!notifyAlexa) return; break;
|
case CALL_MODE_ALEXA: if (!notifyAlexa) return; break;
|
||||||
default: return;
|
default: return;
|
||||||
}
|
}
|
||||||
byte udpOut[WLEDPACKETSIZE];
|
byte udpOut[WLEDPACKETSIZE];
|
||||||
@ -296,7 +296,7 @@ void handleNotifications()
|
|||||||
if (nightlightActive) nightlightDelayMins = udpIn[7];
|
if (nightlightActive) nightlightDelayMins = udpIn[7];
|
||||||
|
|
||||||
if (receiveNotificationBrightness || !someSel) bri = udpIn[2];
|
if (receiveNotificationBrightness || !someSel) bri = udpIn[2];
|
||||||
colorUpdated(NOTIFIER_CALL_MODE_NOTIFICATION);
|
colorUpdated(CALL_MODE_NOTIFICATION);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -387,14 +387,14 @@ void WLED::beginStrip()
|
|||||||
strip.setShowCallback(handleOverlayDraw);
|
strip.setShowCallback(handleOverlayDraw);
|
||||||
|
|
||||||
if (bootPreset > 0) {
|
if (bootPreset > 0) {
|
||||||
applyPreset(bootPreset, NOTIFIER_CALL_MODE_INIT);
|
applyPreset(bootPreset, CALL_MODE_INIT);
|
||||||
} else if (turnOnAtBoot) {
|
} else if (turnOnAtBoot) {
|
||||||
if (briS > 0) bri = briS;
|
if (briS > 0) bri = briS;
|
||||||
else if (bri == 0) bri = 128;
|
else if (bri == 0) bri = 128;
|
||||||
} else {
|
} else {
|
||||||
briLast = briS; bri = 0;
|
briLast = briS; bri = 0;
|
||||||
}
|
}
|
||||||
colorUpdated(NOTIFIER_CALL_MODE_INIT);
|
colorUpdated(CALL_MODE_INIT);
|
||||||
|
|
||||||
// init relay pin
|
// init relay pin
|
||||||
if (rlyPin>=0)
|
if (rlyPin>=0)
|
||||||
|
@ -453,7 +453,7 @@ WLED_GLOBAL byte touchThreshold _INIT(TOUCH_THRESH
|
|||||||
WLED_GLOBAL bool notifyDirectDefault _INIT(notifyDirect);
|
WLED_GLOBAL bool notifyDirectDefault _INIT(notifyDirect);
|
||||||
WLED_GLOBAL bool receiveNotifications _INIT(true);
|
WLED_GLOBAL bool receiveNotifications _INIT(true);
|
||||||
WLED_GLOBAL unsigned long notificationSentTime _INIT(0);
|
WLED_GLOBAL unsigned long notificationSentTime _INIT(0);
|
||||||
WLED_GLOBAL byte notificationSentCallMode _INIT(NOTIFIER_CALL_MODE_INIT);
|
WLED_GLOBAL byte notificationSentCallMode _INIT(CALL_MODE_INIT);
|
||||||
WLED_GLOBAL bool notificationTwoRequired _INIT(false);
|
WLED_GLOBAL bool notificationTwoRequired _INIT(false);
|
||||||
|
|
||||||
// effects
|
// effects
|
||||||
@ -519,7 +519,7 @@ WLED_GLOBAL uint16_t tpmPayloadFrameSize _INIT(0);
|
|||||||
// mqtt
|
// mqtt
|
||||||
WLED_GLOBAL unsigned long lastMqttReconnectAttempt _INIT(0);
|
WLED_GLOBAL unsigned long lastMqttReconnectAttempt _INIT(0);
|
||||||
WLED_GLOBAL unsigned long lastInterfaceUpdate _INIT(0);
|
WLED_GLOBAL unsigned long lastInterfaceUpdate _INIT(0);
|
||||||
WLED_GLOBAL byte interfaceUpdateCallMode _INIT(NOTIFIER_CALL_MODE_INIT);
|
WLED_GLOBAL byte interfaceUpdateCallMode _INIT(CALL_MODE_INIT);
|
||||||
WLED_GLOBAL char mqttStatusTopic[40] _INIT(""); // this must be global because of async handlers
|
WLED_GLOBAL char mqttStatusTopic[40] _INIT(""); // this must be global because of async handlers
|
||||||
|
|
||||||
// alexa udp
|
// alexa udp
|
||||||
|
Loading…
Reference in New Issue
Block a user