Remove toggleOnOff() and use setBrightness().
Return state to Off if it was Off when realtime mode started.
This commit is contained in:
parent
c59e792178
commit
baf4a241a2
@ -7,6 +7,8 @@
|
|||||||
#define WLEDPACKETSIZE 29
|
#define WLEDPACKETSIZE 29
|
||||||
#define UDP_IN_MAXSIZE 1472
|
#define UDP_IN_MAXSIZE 1472
|
||||||
|
|
||||||
|
static bool wasOff = false; // flag if strip was Off (bri==0) when realtime started
|
||||||
|
|
||||||
void notify(byte callMode, bool followUp)
|
void notify(byte callMode, bool followUp)
|
||||||
{
|
{
|
||||||
if (!udpConnected) return;
|
if (!udpConnected) return;
|
||||||
@ -83,8 +85,11 @@ void realtimeLock(uint32_t timeoutMs, byte md)
|
|||||||
|
|
||||||
realtimeTimeout = millis() + timeoutMs;
|
realtimeTimeout = millis() + timeoutMs;
|
||||||
if (timeoutMs == 255001 || timeoutMs == 65000) realtimeTimeout = UINT32_MAX;
|
if (timeoutMs == 255001 || timeoutMs == 65000) realtimeTimeout = UINT32_MAX;
|
||||||
if (bri == 0 && realtimeMode == REALTIME_MODE_INACTIVE && md != realtimeMode) {
|
// if strip is off (bri==0) and not already in RTM
|
||||||
toggleOnOff(); // if strip is off (bri==0) and change from inactive RTM
|
if (bri == 0 && !realtimeMode) {
|
||||||
|
wasOff = true;
|
||||||
|
bri = briLast; // global brightness awareness
|
||||||
|
strip.setBrightness(scaledBri(briLast));
|
||||||
}
|
}
|
||||||
realtimeMode = md;
|
realtimeMode = md;
|
||||||
|
|
||||||
@ -120,6 +125,10 @@ void handleNotifications()
|
|||||||
if (realtimeMode && millis() > realtimeTimeout)
|
if (realtimeMode && millis() > realtimeTimeout)
|
||||||
{
|
{
|
||||||
if (realtimeOverride == REALTIME_OVERRIDE_ONCE) realtimeOverride = REALTIME_OVERRIDE_NONE;
|
if (realtimeOverride == REALTIME_OVERRIDE_ONCE) realtimeOverride = REALTIME_OVERRIDE_NONE;
|
||||||
|
if (wasOff) {
|
||||||
|
bri = 0; // if inital state was off turn strip back off
|
||||||
|
wasOff = false;
|
||||||
|
}
|
||||||
strip.setBrightness(scaledBri(bri));
|
strip.setBrightness(scaledBri(bri));
|
||||||
realtimeMode = REALTIME_MODE_INACTIVE;
|
realtimeMode = REALTIME_MODE_INACTIVE;
|
||||||
realtimeIP[0] = 0;
|
realtimeIP[0] = 0;
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// version code in format yymmddb (b = daily build)
|
// version code in format yymmddb (b = daily build)
|
||||||
#define VERSION 2103180
|
#define VERSION 2103190
|
||||||
|
|
||||||
//uncomment this if you have a "my_config.h" file you'd like to use
|
//uncomment this if you have a "my_config.h" file you'd like to use
|
||||||
//#define WLED_USE_MY_CONFIG
|
//#define WLED_USE_MY_CONFIG
|
||||||
|
@ -90,7 +90,7 @@ void handleSerial()
|
|||||||
if (!realtimeOverride) setRealtimePixel(pixel++, red, green, blue, 0);
|
if (!realtimeOverride) setRealtimePixel(pixel++, red, green, blue, 0);
|
||||||
if (--count > 0) state = AdaState::Data_Red;
|
if (--count > 0) state = AdaState::Data_Red;
|
||||||
else {
|
else {
|
||||||
if (!realtimeMode && bri == 0) strip.setBrightness(briLast);
|
// if (!realtimeMode && bri == 0) strip.setBrightness(briLast); //realtimeLock() handles turning strip on/off
|
||||||
realtimeLock(realtimeTimeoutMs, REALTIME_MODE_ADALIGHT);
|
realtimeLock(realtimeTimeoutMs, REALTIME_MODE_ADALIGHT);
|
||||||
|
|
||||||
if (!realtimeOverride) strip.show();
|
if (!realtimeOverride) strip.show();
|
||||||
|
Loading…
Reference in New Issue
Block a user