From 3a93b8a00240029b0d6ed503bd20a3445b81f73a Mon Sep 17 00:00:00 2001 From: Simon Schmidt Date: Tue, 6 Jul 2021 01:06:46 +0200 Subject: [PATCH] changed static var in activate --- lib/treppe/treppe.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/treppe/treppe.cpp b/lib/treppe/treppe.cpp index 06fff63..e8a6839 100644 --- a/lib/treppe/treppe.cpp +++ b/lib/treppe/treppe.cpp @@ -283,21 +283,21 @@ void Treppe::set_idle_pwm(uint16_t new_idle_pwm) Serial.printf("Treppe: idle_pwm=%d\n", idle_pwm); berechne_dimmer(); activate_idle_pwm(true); - activate_idle_pwm(false); // well :) } void Treppe::activate_idle_pwm(bool active) { - static uint8_t former_active = 0; + static uint16_t last_pwm = 0; if (fsm_outputs.status == ST_RUHEZUSTAND || fsm_outputs.status == ST_INAKTIV_LDR) { - if (active != former_active) + idle_pwm_internal = idle_pwm * active; + if (idle_pwm_internal != last_pwm) { - idle_pwm_internal = idle_pwm * active; // Dimming Function for all LEDS ? + berechne_dimmer(); pwmController.setAllChannelsPWM(idle_pwm_internal); - former_active = active; + last_pwm = idle_pwm_internal; } } }