add slow dimming at hold if in sleep mode

This commit is contained in:
interfisch 2019-10-10 20:30:34 +02:00
parent c93a8b7eab
commit ddc99facfb
1 changed files with 17 additions and 2 deletions

View File

@ -206,13 +206,22 @@ void loopHandler() {
sleep = !sleep; //switch on/off sleep = !sleep; //switch on/off
flag_updatePWM=true; //update pwm values flag_updatePWM=true; //update pwm values
} }
if (sleep && flag_btnAholdstart ) { //in sleep mode and brightness button held down
sleep=false; //enabled light
set_brightness=0; //reset brightness
brightness=set_brightness; //immediately
}
if (!sleep) { //only change values if not in sleep mode if (!sleep) { //only change values if not in sleep mode
// Button A Longpress Handling // Button A Longpress Handling
if (flag_btnAholdstart) { if (flag_btnAholdstart) {
if (set_brightness>=BRIGHTNESS_MAX || set_brightness<=BRIGHTNESS_MIN) { //if hold started with brightness at one extreme if (set_brightness>=BRIGHTNESS_MAX) { //if hold started with brightness at one extreme
holdDirection_brightness=!holdDirection_brightness; //invert direction holdDirection_brightness=false; //direction decrease
} }
if (set_brightness<=BRIGHTNESS_MIN) { //if hold started with brightness at one extreme
holdDirection_brightness=true; //direction increase
}
} }
if (flag_btnAhold) { //brightness if (flag_btnAhold) { //brightness
if (holdDirection_brightness) { if (holdDirection_brightness) {
@ -234,6 +243,12 @@ void loopHandler() {
if (set_temperature>=TEMPERATURE_MAX || set_temperature<=TEMPERATURE_MIN) { //if hold started with brightness at one extreme if (set_temperature>=TEMPERATURE_MAX || set_temperature<=TEMPERATURE_MIN) { //if hold started with brightness at one extreme
holdDirection_temperature=!holdDirection_temperature; //invert direction holdDirection_temperature=!holdDirection_temperature; //invert direction
} }
if (set_temperature>=TEMPERATURE_MAX) { //if hold started with brightness at one extreme
holdDirection_temperature=false; //direction decrease
}
if (set_temperature<=TEMPERATURE_MIN) { //if hold started with brightness at one extreme
holdDirection_temperature=true; //direction increase
}
} }
if (flag_btnBhold) { //brightness if (flag_btnBhold) { //brightness
if (holdDirection_temperature) { if (holdDirection_temperature) {