Browse Source

changed static var in activate

tags/v1.0.0
Simon Schmidt 2 years ago
parent
commit
3a93b8a002
1 changed files with 5 additions and 5 deletions
  1. 5
    5
      lib/treppe/treppe.cpp

+ 5
- 5
lib/treppe/treppe.cpp View File

@@ -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;
}
}
}

Loading…
Cancel
Save