ElektraInitiative / opensesame

3 stars 5 forks source link

lights as module #126

Open markus2330 opened 11 months ago

markus2330 commented 11 months ago

Hi,

what I actually wanted to change is the delay between switching on the different lights (if they are switched too fast, it creates electrical disturbance).

I stumbled upon handle_wrong_input, which I did not really understand, a comment there would be needed.

Looking further, I saw that the main logic for the buttons is now very nice&clear but the lights (and bell) logic is still in the old non-async way (which is very hard to read). So I was thinking that it probably makes more sense to rewrite that code to an extra async lights module, similar to how Garage works, which will maybe also let us get rid of hacks like handle_wrong_input?

Having a lights/enable would be a nice side-effect, as probably not every installation has lights at every entrance? @fel115 how about your situation? Can you maybe help out here?

fel115 commented 11 months ago

I stumbled upon handle_wrong_input, which I did not really understand, a comment there would be needed.

I think the handle_wrong_input sets the buttons LEDs, if the input pin is wrong or a input timeout occurs.

Looking further, I saw that the main logic for the buttons is now very nice&clear but the lights (and bell) logic is still in the old non-async way (which is very hard to read). So I was thinking that it probably makes more sense to rewrite that code to an extra async lights module, similar to how Garage works, which will maybe also let us get rid of hacks like handle_wrong_input?

Yes, the idea was to do the reflector to async and then take a closer look into the modules, to remove non-async operations.

Having a lights/enable would be a nice side-effect, as probably not every installation has lights at every entrance? @fel115 how about your situation? Can you maybe help out here?

Yes I thinks so.