|
|
|
|
|
|
|
|
pwmController.setPWMFrequency(100); |
|
|
pwmController.setPWMFrequency(100); |
|
|
//pwmController.setAllChannelsPWM(idle_pwm); |
|
|
//pwmController.setAllChannelsPWM(idle_pwm); |
|
|
|
|
|
|
|
|
|
|
|
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_prozent(const int prozent) |
|
|
void Treppe::set_idle_prozent(const int prozent) |
|
|
{ |
|
|
{ |
|
|
// future use: parameters.idle_max_pwm |
|
|
// future use: parameters.idle_max_pwm |
|
|
uint16_t new_pwm = parameters.active_pwm * prozent / 100; |
|
|
uint16_t new_pwm = parameters.active_pwm * prozent / 100; |
|
|
set_idle_pwm_max(new_pwm); |
|
|
set_idle_pwm_max(new_pwm); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void Treppe::set_idle_pwm_max(const uint16_t new_pwm) |
|
|
void Treppe::set_idle_pwm_max(const uint16_t new_pwm) |
|
|
{ |
|
|
{ |
|
|
// future use: parameters.idle_max_pwm |
|
|
// future use: parameters.idle_max_pwm |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Serial.printf("Treppe: idle_pwm_soll=%d\n", idle_pwm_soll); |
|
|
Serial.printf("Treppe: idle_pwm_soll=%d\n", idle_pwm_soll); |
|
|
fsm_pend.ldr_changed = true; |
|
|
fsm_pend.ldr_changed = true; |
|
|
|
|
|
//saveParam(); //uncomment if idle_pwm_max is used |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void Treppe::set_active_pwm(uint16_t _active_pwm) |
|
|
void Treppe::set_active_pwm(uint16_t _active_pwm) |
|
|
{ |
|
|
{ |
|
|
parameters.active_pwm = _active_pwm; |
|
|
parameters.active_pwm = _active_pwm; |
|
|
Serial.printf("Treppe: active_pwm=%d\n", parameters.active_pwm); |
|
|
Serial.printf("Treppe: active_pwm=%d\n", parameters.active_pwm); |
|
|
|
|
|
saveParam(); |
|
|
} |
|
|
} |
|
|
void Treppe::set_time_per_stair(uint16_t _time_per_stair) |
|
|
void Treppe::set_time_per_stair(uint16_t _time_per_stair) |
|
|
{ |
|
|
{ |
|
|
parameters.time_per_stair = _time_per_stair; |
|
|
parameters.time_per_stair = _time_per_stair; |
|
|
Serial.printf("Treppe: time_per_stair=%d\n", parameters.time_per_stair); |
|
|
Serial.printf("Treppe: time_per_stair=%d\n", parameters.time_per_stair); |
|
|
|
|
|
saveParam(); |
|
|
} |
|
|
} |