|
|
@@ -64,10 +64,10 @@ void Treppe::start_animation( dimmer_t* dimmer, bool dim_type, |
|
|
|
else |
|
|
|
dimmer->stufe = stufen - 1; |
|
|
|
|
|
|
|
dimmer->ticks = time_per_stair / INT_TIME; // [ms] |
|
|
|
dimmer->ticks = parameters.time_per_stair / INT_TIME; // [ms] |
|
|
|
} |
|
|
|
else { // DIM_LDR |
|
|
|
dimmer->ticks = time_ldr / INT_TIME; // [ms] |
|
|
|
dimmer->ticks = parameters.time_ldr / INT_TIME; // [ms] |
|
|
|
} |
|
|
|
|
|
|
|
if (fsm_outputs.dimmrichtung == DR_AUFDIMMEN) |
|
|
@@ -203,10 +203,10 @@ bool Treppe::check_ldr() |
|
|
|
// follow up: averaging over many samples? |
|
|
|
float ldr = read_ldr(); |
|
|
|
|
|
|
|
if (ldr < ldr_schwelle) { |
|
|
|
if (ldr < parameters.ldr_schwelle) { |
|
|
|
active = 1; |
|
|
|
} |
|
|
|
if (ldr > ldr_schwelle + LDR_HYS) { |
|
|
|
if (ldr > parameters.ldr_schwelle + LDR_HYS) { |
|
|
|
active = 0; |
|
|
|
} |
|
|
|
return active; |
|
|
@@ -260,7 +260,7 @@ void Treppe::task() |
|
|
|
fsm_outputs.status == ST_ABDIMMEN_RUNTER ) |
|
|
|
{ |
|
|
|
if(fsm_pend.anim_beendet) |
|
|
|
start_animation(&dimmer_stufen, DIM_STUFEN, active_pwm, idle_pwm_ist); |
|
|
|
start_animation(&dimmer_stufen, DIM_STUFEN, parameters.active_pwm, idle_pwm_ist); |
|
|
|
else |
|
|
|
fsm_pend.anim_beendet = dimmer_tick(&dimmer_stufen, DIM_STUFEN); |
|
|
|
} |
|
|
@@ -319,14 +319,16 @@ void Treppe::setup() |
|
|
|
|
|
|
|
void Treppe::set_idle_prozent(const int prozent) |
|
|
|
{ |
|
|
|
uint16_t new_pwm = active_pwm * prozent / 100; |
|
|
|
// future use: parameters.idle_max_pwm |
|
|
|
uint16_t new_pwm = parameters.active_pwm * prozent / 100; |
|
|
|
set_idle_pwm_max(new_pwm); |
|
|
|
} |
|
|
|
|
|
|
|
void Treppe::set_idle_pwm_max(const uint16_t new_pwm) |
|
|
|
{ |
|
|
|
if(new_pwm > active_pwm) { |
|
|
|
idle_pwm_soll = active_pwm; |
|
|
|
// future use: parameters.idle_max_pwm |
|
|
|
if(new_pwm > parameters.active_pwm) { |
|
|
|
idle_pwm_soll = parameters.active_pwm; |
|
|
|
} else { |
|
|
|
idle_pwm_soll = new_pwm; |
|
|
|
} |
|
|
@@ -337,11 +339,11 @@ void Treppe::set_idle_pwm_max(const uint16_t new_pwm) |
|
|
|
|
|
|
|
void Treppe::set_active_pwm(uint16_t _active_pwm) |
|
|
|
{ |
|
|
|
active_pwm = _active_pwm; |
|
|
|
Serial.printf("Treppe: active_pwm=%d\n", active_pwm); |
|
|
|
parameters.active_pwm = _active_pwm; |
|
|
|
Serial.printf("Treppe: active_pwm=%d\n", parameters.active_pwm); |
|
|
|
} |
|
|
|
void Treppe::set_time_per_stair(uint16_t _time_per_stair) |
|
|
|
{ |
|
|
|
time_per_stair = _time_per_stair; |
|
|
|
Serial.printf("Treppe: time_per_stair=%d\n", time_per_stair); |
|
|
|
parameters.time_per_stair = _time_per_stair; |
|
|
|
Serial.printf("Treppe: time_per_stair=%d\n", parameters.time_per_stair); |
|
|
|
} |