Compare commits
2 Commits
ad21d73fbb
...
c23b9f2bc6
Author | SHA1 | Date | |
---|---|---|---|
c23b9f2bc6 | |||
31c268487c |
lib/treppe
@ -280,7 +280,10 @@ void Treppe::setup() {
|
||||
// pwmController.init(PCA9685_PhaseBalancer_Linear);
|
||||
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 +297,10 @@ 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,7 +313,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,11 +330,12 @@ 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);
|
||||
}
|
||||
|
||||
void Treppe::set_time_per_stair(uint16_t _time_per_stair) {
|
||||
parameters.time_per_stair = _time_per_stair;
|
||||
Serial.printf("Treppe: time_per_stair=%d\n", parameters.time_per_stair);
|
||||
saveParam();
|
||||
}
|
@ -3,6 +3,7 @@
|
||||
|
||||
#include "FSMTreppe3/FSMTreppe3.h"
|
||||
#include "PCA9685.h"
|
||||
#include <EEPROM.h>
|
||||
|
||||
// #define LDRDEBUG // comment in to override LDR measurement
|
||||
#define LDR_HYS 1 // Hysteresis for switching off FSM [lux]
|
||||
@ -15,6 +16,8 @@
|
||||
|
||||
enum vorgabe_typ_t { VORGABE_PROZENT = 0, VORGABE_12BIT = 1 };
|
||||
|
||||
#define EEP_START_ADDR 100 // define Start Address for "EEPROM" storage -> depends on size of "wifi_data"!
|
||||
|
||||
class Treppe {
|
||||
private:
|
||||
const uint8_t stufen;
|
||||
@ -94,6 +97,7 @@ public:
|
||||
void task(); // call periodically
|
||||
|
||||
// Parameter section
|
||||
void saveParam();
|
||||
void set_idle_pwm_max(const uint16_t value, const vorgabe_typ_t vorgabe_typ);
|
||||
void set_active_pwm(const uint16_t value, const vorgabe_typ_t vorgabe_typ);
|
||||
void set_time_per_stair(uint16_t _time_per_stair);
|
||||
|
Loading…
x
Reference in New Issue
Block a user