somehow working, starting to refactor
This commit is contained in:
parent
8351a6430c
commit
af40298378
@ -210,17 +210,13 @@ void Treppe::print_state_on_change()
|
||||
void Treppe::task()
|
||||
{
|
||||
//Serial.printf("LDR: %f\n", ((float)analogRead(A0))/1023.*3.68);
|
||||
fsm_inputs.ldr_schwelle = true; // <=== LDR implementierung !!
|
||||
|
||||
if (finish)
|
||||
{
|
||||
direction = switch_direction;
|
||||
state = switch_state;
|
||||
}
|
||||
|
||||
fsm_inputs.ldr_schwelle = true;
|
||||
fsm_inputs.sensor_oben = read_sensor(SENSOR_OBEN);
|
||||
fsm_inputs.sensor_unten = read_sensor(SENSOR_UNTEN);
|
||||
fsm_inputs.anim_beendet = static_cast<bool>(finish);
|
||||
if(finish) // flanke nach finished reicht ?
|
||||
finish = false;
|
||||
|
||||
FSMTreppe_Obj.setExternalInputs(&fsm_inputs);
|
||||
FSMTreppe_Obj.step();
|
||||
@ -230,12 +226,13 @@ void Treppe::task()
|
||||
direction = fsm_outputs.laufrichtung;
|
||||
state = fsm_outputs.dimmrichtung;
|
||||
|
||||
if(fsm_outputs.status > ST_INAKTIV_LDR) {
|
||||
ledsequence();
|
||||
}
|
||||
// setTick(ticks_treppe);
|
||||
// setAnAus(1);
|
||||
// setDirection(0);
|
||||
// setState(0);
|
||||
|
||||
ledsequence();
|
||||
}
|
||||
|
||||
uint16_t Treppe::setIdle(uint16_t _idle_brightness)
|
||||
|
@ -11,11 +11,10 @@
|
||||
|
||||
class Treppe {
|
||||
private:
|
||||
|
||||
uint8_t stairs;
|
||||
uint16_t time_per_stair = 300; // dimmtime per stair [ms]
|
||||
uint16_t idle_brightness = 100;
|
||||
uint16_t active_brightness = 300;
|
||||
uint16_t idle_brightness = 0;
|
||||
uint16_t active_brightness = 500;
|
||||
|
||||
uint8_t direction = 0;
|
||||
uint8_t switch_direction = 0;
|
||||
@ -39,11 +38,16 @@ private:
|
||||
FSMTreppeModelClass::ExtU_FSMTreppe_T fsm_inputs;
|
||||
FSMTreppeModelClass::ExtY_FSMTreppe_T fsm_outputs;
|
||||
void print_state_on_change();
|
||||
|
||||
const uint8_t FSMTreppe_IN_animation_down = 1U;
|
||||
const uint8_t FSMTreppe_IN_animation_up = 2U;
|
||||
const uint8_t FSMTreppe_IN_idle = 3U;
|
||||
|
||||
enum fsm_status_t {
|
||||
ST_INAKTIV_LDR =0,
|
||||
ST_RUHEZUSTAND =1,
|
||||
ST_AUFDIMMEN_HOCH =2,
|
||||
ST_WARTEN_HOCH =3,
|
||||
ST_ABDIMMEN_HOCH =4,
|
||||
ST_AUFDIMMEN_RUNTER =5,
|
||||
ST_WARTEN_RUNTER =6,
|
||||
ST_ABDIMMEN_RUNTER =7
|
||||
};
|
||||
|
||||
uint8_t softstart_led(uint8_t led, uint16_t startval, uint16_t stopval);
|
||||
void ledsequence();
|
||||
|
Loading…
x
Reference in New Issue
Block a user