|
|
|
|
|
|
|
|
pwmController.setPWMFrequency(100); |
|
|
pwmController.setPWMFrequency(100); |
|
|
// pwmController.setAllChannelsPWM(idle_pwm); |
|
|
// 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(13, OUTPUT); |
|
|
pinMode(0, OUTPUT); |
|
|
pinMode(0, OUTPUT); |
|
|
digitalWrite(13, HIGH); |
|
|
digitalWrite(13, HIGH); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Serial.printf("Treppe: stufen=%d\n", stufen); |
|
|
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, |
|
|
void Treppe::set_idle_pwm_max(const uint16_t value, |
|
|
const vorgabe_typ_t vorgabe_typ) { |
|
|
const vorgabe_typ_t vorgabe_typ) { |
|
|
|
|
|
|
|
|
if (parameters.idle_pwm_max > parameters.active_pwm) { |
|
|
if (parameters.idle_pwm_max > parameters.active_pwm) { |
|
|
parameters.idle_pwm_max = parameters.active_pwm; |
|
|
parameters.idle_pwm_max = parameters.active_pwm; |
|
|
} |
|
|
} |
|
|
|
|
|
saveParam(); |
|
|
|
|
|
|
|
|
Serial.printf("Treppe: parameters.idle_pwm_max=%d\n", |
|
|
Serial.printf("Treppe: parameters.idle_pwm_max=%d\n", |
|
|
parameters.idle_pwm_max); |
|
|
parameters.idle_pwm_max); |
|
|
|
|
|
|
|
|
if (parameters.active_pwm > 4095) { |
|
|
if (parameters.active_pwm > 4095) { |
|
|
parameters.idle_pwm_max = 4095; |
|
|
parameters.idle_pwm_max = 4095; |
|
|
} |
|
|
} |
|
|
|
|
|
saveParam(); |
|
|
|
|
|
|
|
|
Serial.printf("Treppe: parameters.active_pwm=%d\n", parameters.active_pwm); |
|
|
Serial.printf("Treppe: parameters.active_pwm=%d\n", parameters.active_pwm); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
parameters.time_ldr = value; |
|
|
parameters.time_ldr = value; |
|
|
if (parameters.time_ldr > TIME_MS_MAX) |
|
|
if (parameters.time_ldr > TIME_MS_MAX) |
|
|
parameters.time_ldr = TIME_MS_MAX; |
|
|
parameters.time_ldr = TIME_MS_MAX; |
|
|
|
|
|
saveParam(); |
|
|
|
|
|
|
|
|
Serial.printf("Treppe: time_ldr=%d\n", parameters.time_ldr); |
|
|
Serial.printf("Treppe: time_ldr=%d\n", parameters.time_ldr); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
parameters.time_per_stair = value; |
|
|
parameters.time_per_stair = value; |
|
|
if (parameters.time_per_stair > TIME_MS_MAX) |
|
|
if (parameters.time_per_stair > TIME_MS_MAX) |
|
|
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); |
|
|
Serial.printf("Treppe: time_per_stair=%d\n", parameters.time_per_stair); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} else if (vorgabe_typ == VORGABE_12BIT) { |
|
|
} else if (vorgabe_typ == VORGABE_12BIT) { |
|
|
// parameters.ldr_schwelle = value; |
|
|
// parameters.ldr_schwelle = value; |
|
|
} |
|
|
} |
|
|
|
|
|
saveParam(); |
|
|
|
|
|
|
|
|
Serial.printf("Treppe: ldr_schwelle=%d\n", parameters.ldr_schwelle); |
|
|
Serial.printf("Treppe: ldr_schwelle=%d\n", parameters.ldr_schwelle); |
|
|
} |
|
|
|
|
|
|
|
|
} |