|
|
|
|
|
|
|
|
void Treppe::task() |
|
|
void Treppe::task() |
|
|
{ |
|
|
{ |
|
|
//Serial.printf("LDR: %f\n", ((float)analogRead(A0))/1023.*3.68); |
|
|
//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_oben = read_sensor(SENSOR_OBEN); |
|
|
fsm_inputs.sensor_unten = read_sensor(SENSOR_UNTEN); |
|
|
fsm_inputs.sensor_unten = read_sensor(SENSOR_UNTEN); |
|
|
fsm_inputs.anim_beendet = static_cast<bool>(finish); |
|
|
fsm_inputs.anim_beendet = static_cast<bool>(finish); |
|
|
|
|
|
if(finish) // flanke nach finished reicht ? |
|
|
|
|
|
finish = false; |
|
|
|
|
|
|
|
|
FSMTreppe_Obj.setExternalInputs(&fsm_inputs); |
|
|
FSMTreppe_Obj.setExternalInputs(&fsm_inputs); |
|
|
FSMTreppe_Obj.step(); |
|
|
FSMTreppe_Obj.step(); |
|
|
|
|
|
|
|
|
direction = fsm_outputs.laufrichtung; |
|
|
direction = fsm_outputs.laufrichtung; |
|
|
state = fsm_outputs.dimmrichtung; |
|
|
state = fsm_outputs.dimmrichtung; |
|
|
|
|
|
|
|
|
|
|
|
if(fsm_outputs.status > ST_INAKTIV_LDR) { |
|
|
|
|
|
ledsequence(); |
|
|
|
|
|
} |
|
|
// setTick(ticks_treppe); |
|
|
// setTick(ticks_treppe); |
|
|
// setAnAus(1); |
|
|
// setAnAus(1); |
|
|
// setDirection(0); |
|
|
// setDirection(0); |
|
|
// setState(0); |
|
|
// setState(0); |
|
|
|
|
|
|
|
|
ledsequence(); |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
uint16_t Treppe::setIdle(uint16_t _idle_brightness) |
|
|
uint16_t Treppe::setIdle(uint16_t _idle_brightness) |