Browse Source

merge conflicts

tags/v1.0.0
Simon Schmidt 3 years ago
parent
commit
e47cae30a8
2 changed files with 21 additions and 1 deletions
  1. 17
    1
      lib/treppe/treppe.cpp
  2. 4
    0
      lib/treppe/treppe.h

+ 17
- 1
lib/treppe/treppe.cpp View File

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);
}
}

+ 4
- 0
lib/treppe/treppe.h View File



#include "FSMTreppe3/FSMTreppe3.h" #include "FSMTreppe3/FSMTreppe3.h"
#include "PCA9685.h" #include "PCA9685.h"
#include <EEPROM.h>


// #define LDRDEBUG // comment in to override LDR measurement // #define LDRDEBUG // comment in to override LDR measurement
#define LDR_HYS 1 // Hysteresis for switching off FSM [lux] #define LDR_HYS 1 // Hysteresis for switching off FSM [lux]


enum vorgabe_typ_t { VORGABE_PROZENT = 0, VORGABE_12BIT = 1 }; 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 { class Treppe {
private: private:
const uint8_t stufen; const uint8_t stufen;
void task(); // call periodically void task(); // call periodically


// Parameter section // Parameter section
void saveParam();
void set_idle_pwm_max(const uint16_t value, const vorgabe_typ_t vorgabe_typ); 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_active_pwm(const uint16_t value, const vorgabe_typ_t vorgabe_typ);

Loading…
Cancel
Save