changed static var in activate
This commit is contained in:
parent
0e5085c008
commit
3a93b8a002
@ -283,21 +283,21 @@ void Treppe::set_idle_pwm(uint16_t new_idle_pwm)
|
|||||||
Serial.printf("Treppe: idle_pwm=%d\n", idle_pwm);
|
Serial.printf("Treppe: idle_pwm=%d\n", idle_pwm);
|
||||||
berechne_dimmer();
|
berechne_dimmer();
|
||||||
activate_idle_pwm(true);
|
activate_idle_pwm(true);
|
||||||
activate_idle_pwm(false); // well :)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Treppe::activate_idle_pwm(bool active)
|
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 (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 ?
|
// Dimming Function for all LEDS ?
|
||||||
|
berechne_dimmer();
|
||||||
pwmController.setAllChannelsPWM(idle_pwm_internal);
|
pwmController.setAllChannelsPWM(idle_pwm_internal);
|
||||||
former_active = active;
|
last_pwm = idle_pwm_internal;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user