update preset based on toggledOnOff bool

This commit is contained in:
R1DEN 2023-10-24 15:56:06 +03:00 committed by GitHub
parent 0b857cba8d
commit c2fe15a6cf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -63,6 +63,8 @@ void toggleOnOff()
briLast = bri;
bri = 0;
}
stateChanged = true;
toggledOnOff = true;
}
@ -100,7 +102,7 @@ void stateUpdated(byte callMode) {
setValuesFromFirstSelectedSeg();
if (bri != briOld || stateChanged) {
if (stateChanged) currentPreset = 0; //something changed, so we are no longer in the preset
if (stateChanged && !toggledOnOff) currentPreset = 0; //something changed, so we are no longer in the preset, except for turning the LEDs on/off
if (callMode != CALL_MODE_NOTIFICATION && callMode != CALL_MODE_NO_NOTIFY) notify(callMode);
if (bri != briOld && nodeBroadcastEnabled) sendSysInfoUDP(); // update on state
@ -108,6 +110,7 @@ void stateUpdated(byte callMode) {
//set flag to update ws and mqtt
interfaceUpdateCallMode = callMode;
stateChanged = false;
toggledOnOff = false;
} else {
if (nightlightActive && !nightlightActiveOld && callMode != CALL_MODE_NOTIFICATION && callMode != CALL_MODE_NO_NOTIFY) {
notify(CALL_MODE_NIGHTLIGHT);