|
|
@@ -281,6 +281,10 @@ void Treppe::setup() { |
|
|
|
pwmController.setPWMFrequency(100); |
|
|
|
// pwmController.setAllChannelsPWM(idle_pwm); |
|
|
|
|
|
|
|
// WARNING: before getting Parameters of Flash, make sure plausible parameters |
|
|
|
// are written in flash! |
|
|
|
EEPROM.get(EEP_START_ADDR, parameters); // get Parameters of flash |
|
|
|
|
|
|
|
pinMode(13, OUTPUT); |
|
|
|
pinMode(0, OUTPUT); |
|
|
|
digitalWrite(13, HIGH); |
|
|
@@ -294,6 +298,11 @@ void Treppe::setup() { |
|
|
|
|
|
|
|
Serial.printf("Treppe: stufen=%d\n", stufen); |
|
|
|
} |
|
|
|
void Treppe::saveParam() { |
|
|
|
EEPROM.put(EEP_START_ADDR, |
|
|
|
parameters); // copy Parameters so "EEPROM"-section in RAM |
|
|
|
EEPROM.commit(); // write "EEPROM"-section to flash |
|
|
|
} |
|
|
|
|
|
|
|
void Treppe::set_idle_pwm_max(const uint16_t value, |
|
|
|
const vorgabe_typ_t vorgabe_typ) { |
|
|
@@ -306,6 +315,7 @@ void Treppe::set_idle_pwm_max(const uint16_t value, |
|
|
|
if (parameters.idle_pwm_max > parameters.active_pwm) { |
|
|
|
parameters.idle_pwm_max = parameters.active_pwm; |
|
|
|
} |
|
|
|
saveParam(); |
|
|
|
|
|
|
|
Serial.printf("Treppe: parameters.idle_pwm_max=%d\n", |
|
|
|
parameters.idle_pwm_max); |
|
|
@@ -323,6 +333,7 @@ void Treppe::set_active_pwm(const uint16_t value, |
|
|
|
if (parameters.active_pwm > 4095) { |
|
|
|
parameters.idle_pwm_max = 4095; |
|
|
|
} |
|
|
|
saveParam(); |
|
|
|
|
|
|
|
Serial.printf("Treppe: parameters.active_pwm=%d\n", parameters.active_pwm); |
|
|
|
} |
|
|
@@ -331,6 +342,8 @@ void Treppe::set_time_ldr(const uint16_t value) { |
|
|
|
parameters.time_ldr = value; |
|
|
|
if (parameters.time_ldr > TIME_MS_MAX) |
|
|
|
parameters.time_ldr = TIME_MS_MAX; |
|
|
|
saveParam(); |
|
|
|
|
|
|
|
Serial.printf("Treppe: time_ldr=%d\n", parameters.time_ldr); |
|
|
|
} |
|
|
|
|
|
|
@@ -338,6 +351,8 @@ void Treppe::set_time_per_stair(const uint16_t value) { |
|
|
|
parameters.time_per_stair = value; |
|
|
|
if (parameters.time_per_stair > TIME_MS_MAX) |
|
|
|
parameters.time_per_stair = TIME_MS_MAX; |
|
|
|
saveParam(); |
|
|
|
|
|
|
|
Serial.printf("Treppe: time_per_stair=%d\n", parameters.time_per_stair); |
|
|
|
} |
|
|
|
|
|
|
@@ -349,6 +364,7 @@ void Treppe::set_ldr_schwelle(const uint16_t value, |
|
|
|
} else if (vorgabe_typ == VORGABE_12BIT) { |
|
|
|
// parameters.ldr_schwelle = value; |
|
|
|
} |
|
|
|
saveParam(); |
|
|
|
|
|
|
|
Serial.printf("Treppe: ldr_schwelle=%d\n", parameters.ldr_schwelle); |
|
|
|
} |
|
|
|
} |