Refactor colorUpdated()
This commit is contained in:
parent
7360b882ac
commit
89f60a0422
@ -109,11 +109,11 @@ build_flags =
|
|||||||
-D PIO_FRAMEWORK_ARDUINO_LWIP_HIGHER_BANDWIDTH
|
-D PIO_FRAMEWORK_ARDUINO_LWIP_HIGHER_BANDWIDTH
|
||||||
-Wl,-Teagle.flash.512k.ld ;;;; Compile with no SPIFFS
|
-Wl,-Teagle.flash.512k.ld ;;;; Compile with no SPIFFS
|
||||||
-D WLED_DISABLE_OTA
|
-D WLED_DISABLE_OTA
|
||||||
; -D WLED_DISABLE_ALEXA
|
-D WLED_DISABLE_ALEXA
|
||||||
-D WLED_DISABLE_BLYNK
|
-D WLED_DISABLE_BLYNK
|
||||||
-D WLED_DISABLE_CRONIXIE
|
-D WLED_DISABLE_CRONIXIE
|
||||||
-D WLED_DISABLE_HUESYNC
|
-D WLED_DISABLE_HUESYNC
|
||||||
; -D WLED_DISABLE_INFRARED
|
-D WLED_DISABLE_INFRARED
|
||||||
lib_ignore = ${common:esp8266.lib_ignore}
|
lib_ignore = ${common:esp8266.lib_ignore}
|
||||||
|
|
||||||
[common:esp32]
|
[common:esp32]
|
||||||
@ -179,7 +179,6 @@ framework = ${common.framework}
|
|||||||
build_flags =
|
build_flags =
|
||||||
${common.build_flags}
|
${common.build_flags}
|
||||||
${common:esp8266_512k.build_flags}
|
${common:esp8266_512k.build_flags}
|
||||||
-D WLED_DISABLE_INFRARED
|
|
||||||
lib_deps =
|
lib_deps =
|
||||||
${common.lib_deps_external}
|
${common.lib_deps_external}
|
||||||
lib_compat_mode = strict
|
lib_compat_mode = strict
|
||||||
|
@ -8,13 +8,13 @@
|
|||||||
#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 NOTIFIER_CALL_MODE_INIT 0 //no updates on init, can be used to disable updates
|
||||||
#define NOTIFIER_CALL_MODE_DIRECT_CHANGE 1
|
#define NOTIFIER_CALL_MODE_DIRECT_CHANGE 1
|
||||||
#define NOTIFIER_CALL_MODE_BUTTON 2
|
#define NOTIFIER_CALL_MODE_BUTTON 2
|
||||||
#define NOTIFIER_CALL_MODE_NOTIFICATION 3
|
#define NOTIFIER_CALL_MODE_NOTIFICATION 3
|
||||||
#define NOTIFIER_CALL_MODE_NIGHTLIGHT 4
|
#define NOTIFIER_CALL_MODE_NIGHTLIGHT 4
|
||||||
#define NOTIFIER_CALL_MODE_NO_NOTIFY 5
|
#define NOTIFIER_CALL_MODE_NO_NOTIFY 5
|
||||||
#define NOTIFIER_CALL_MODE_FX_CHANGED 6
|
#define NOTIFIER_CALL_MODE_FX_CHANGED 6 //no longer used
|
||||||
#define NOTIFIER_CALL_MODE_HUE 7
|
#define NOTIFIER_CALL_MODE_HUE 7
|
||||||
#define NOTIFIER_CALL_MODE_PRESET_CYCLE 8
|
#define NOTIFIER_CALL_MODE_PRESET_CYCLE 8
|
||||||
#define NOTIFIER_CALL_MODE_BLYNK 9
|
#define NOTIFIER_CALL_MODE_BLYNK 9
|
||||||
@ -43,4 +43,17 @@
|
|||||||
#define DMX_MODE_MULTIPLE_RGB 4 //every LED is addressed with its own RGB (ledCount * 3 channels)
|
#define DMX_MODE_MULTIPLE_RGB 4 //every LED is addressed with its own RGB (ledCount * 3 channels)
|
||||||
#define DMX_MODE_MULTIPLE_DRGB 5 //every LED is addressed with its own RGB and share a master dimmer (ledCount * 3 + 1 channels)
|
#define DMX_MODE_MULTIPLE_DRGB 5 //every LED is addressed with its own RGB and share a master dimmer (ledCount * 3 + 1 channels)
|
||||||
|
|
||||||
|
//Light capability byte (unused)
|
||||||
|
#define TYPE_WS2812_RGB 0
|
||||||
|
#define TYPE_SK6812_RGBW 1
|
||||||
|
#define TYPE_WS2812_WWA 2 //amber + warm + cold white
|
||||||
|
#define TYPE_APA102 3
|
||||||
|
#define TYPE_LPD8806 4
|
||||||
|
#define TYPE_WS2801 5
|
||||||
|
#define TYPE_ANALOG_1CH 6 //single channel PWM. Uses value of brightest RGBW channel
|
||||||
|
#define TYPE_ANALOG_2CH 7 //analog WW + CW
|
||||||
|
#define TYPE_ANALOG_3CH 8 //analog RGB
|
||||||
|
#define TYPE_ANALOG_4CH 9 //analog RGBW
|
||||||
|
#define TYPE_ANALOG_5CH 10 //analog RGB + WW + CW
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -111,7 +111,7 @@ DMXESPSerial dmx;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
//version code in format yymmddb (b = daily build)
|
//version code in format yymmddb (b = daily build)
|
||||||
#define VERSION 2002241
|
#define VERSION 2002242
|
||||||
|
|
||||||
char versionString[] = "0.9.1";
|
char versionString[] = "0.9.1";
|
||||||
|
|
||||||
|
@ -15,7 +15,6 @@ void notify(byte callMode, bool followUp=false)
|
|||||||
case NOTIFIER_CALL_MODE_DIRECT_CHANGE: if (!notifyDirect) return; break;
|
case NOTIFIER_CALL_MODE_DIRECT_CHANGE: if (!notifyDirect) return; break;
|
||||||
case NOTIFIER_CALL_MODE_BUTTON: if (!notifyButton) return; break;
|
case NOTIFIER_CALL_MODE_BUTTON: if (!notifyButton) return; break;
|
||||||
case NOTIFIER_CALL_MODE_NIGHTLIGHT: if (!notifyDirect) return; break;
|
case NOTIFIER_CALL_MODE_NIGHTLIGHT: if (!notifyDirect) return; break;
|
||||||
case NOTIFIER_CALL_MODE_FX_CHANGED: if (!notifyDirect) return; break; //fx change
|
|
||||||
case NOTIFIER_CALL_MODE_HUE: if (!notifyHue) return; break;
|
case NOTIFIER_CALL_MODE_HUE: if (!notifyHue) return; break;
|
||||||
case NOTIFIER_CALL_MODE_PRESET_CYCLE: if (!notifyDirect) return; break;
|
case NOTIFIER_CALL_MODE_PRESET_CYCLE: if (!notifyDirect) return; break;
|
||||||
case NOTIFIER_CALL_MODE_BLYNK: if (!notifyDirect) return; break;
|
case NOTIFIER_CALL_MODE_BLYNK: if (!notifyDirect) return; break;
|
||||||
|
@ -95,28 +95,30 @@ void colorUpdated(int callMode)
|
|||||||
callMode != NOTIFIER_CALL_MODE_NO_NOTIFY) strip.applyToAllSelected = true; //if not from JSON api, which directly sets segments
|
callMode != NOTIFIER_CALL_MODE_NO_NOTIFY) strip.applyToAllSelected = true; //if not from JSON api, which directly sets segments
|
||||||
|
|
||||||
bool fxChanged = strip.setEffectConfig(effectCurrent, effectSpeed, effectIntensity, effectPalette);
|
bool fxChanged = strip.setEffectConfig(effectCurrent, effectSpeed, effectIntensity, effectPalette);
|
||||||
if (!colorChanged())
|
bool colChanged = colorChanged();
|
||||||
|
|
||||||
|
if (fxChanged || colChanged)
|
||||||
{
|
{
|
||||||
|
if (realtimeTimeout == UINT32_MAX) realtimeTimeout = 0;
|
||||||
|
if (isPreset) {isPreset = false;}
|
||||||
|
else {currentPreset = -1;}
|
||||||
|
|
||||||
|
notify(callMode);
|
||||||
|
|
||||||
|
//set flag to update blynk and mqtt
|
||||||
|
if (callMode != NOTIFIER_CALL_MODE_PRESET_CYCLE) interfaceUpdateCallMode = callMode;
|
||||||
|
} else {
|
||||||
if (nightlightActive && !nightlightActiveOld &&
|
if (nightlightActive && !nightlightActiveOld &&
|
||||||
callMode != NOTIFIER_CALL_MODE_NOTIFICATION &&
|
callMode != NOTIFIER_CALL_MODE_NOTIFICATION &&
|
||||||
callMode != NOTIFIER_CALL_MODE_NO_NOTIFY)
|
callMode != NOTIFIER_CALL_MODE_NO_NOTIFY)
|
||||||
{
|
{
|
||||||
notify(NOTIFIER_CALL_MODE_NIGHTLIGHT);
|
notify(NOTIFIER_CALL_MODE_NIGHTLIGHT);
|
||||||
interfaceUpdateCallMode = NOTIFIER_CALL_MODE_NIGHTLIGHT;
|
interfaceUpdateCallMode = NOTIFIER_CALL_MODE_NIGHTLIGHT;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
else if (fxChanged) {
|
|
||||||
notify(NOTIFIER_CALL_MODE_FX_CHANGED);
|
|
||||||
if (callMode != NOTIFIER_CALL_MODE_PRESET_CYCLE) interfaceUpdateCallMode = NOTIFIER_CALL_MODE_FX_CHANGED;
|
|
||||||
if (realtimeTimeout == UINT32_MAX) realtimeTimeout = 0;
|
|
||||||
if (isPreset) {isPreset = false;}
|
|
||||||
else {currentPreset = -1;}
|
|
||||||
}
|
}
|
||||||
return; //no change
|
|
||||||
}
|
if (!colChanged) return; //following code is for e.g. initiating transitions
|
||||||
if (realtimeTimeout == UINT32_MAX) realtimeTimeout = 0;
|
|
||||||
if (isPreset) {isPreset = false;}
|
|
||||||
else {currentPreset = -1;}
|
|
||||||
if (callMode != NOTIFIER_CALL_MODE_NO_NOTIFY && nightlightActive && nightlightFade)
|
if (callMode != NOTIFIER_CALL_MODE_NO_NOTIFY && nightlightActive && nightlightFade)
|
||||||
{
|
{
|
||||||
briNlT = bri;
|
briNlT = bri;
|
||||||
@ -137,8 +139,6 @@ void colorUpdated(int callMode)
|
|||||||
briIT = bri;
|
briIT = bri;
|
||||||
if (bri > 0) briLast = bri;
|
if (bri > 0) briLast = bri;
|
||||||
|
|
||||||
notify(callMode);
|
|
||||||
|
|
||||||
if (fadeTransition)
|
if (fadeTransition)
|
||||||
{
|
{
|
||||||
//set correct delay if not using notification delay
|
//set correct delay if not using notification delay
|
||||||
@ -164,10 +164,6 @@ void colorUpdated(int callMode)
|
|||||||
setLedsStandard();
|
setLedsStandard();
|
||||||
strip.trigger();
|
strip.trigger();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (callMode == NOTIFIER_CALL_MODE_PRESET_CYCLE) return;
|
|
||||||
//set flag to update blynk and mqtt
|
|
||||||
interfaceUpdateCallMode = callMode;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user