Each of the buttons should have a row in the rooms table, like led_1, led_2, led_3, with an INTEGER and default to 0 for off.
When a round begins, the LEDs could be lit by the code updating the row for each room and setting the LEDs appropriately in the rooms table.
When a round becomes "active", then maybe we look at how many values there are for that round, and light up the LEDs corresponding to the values that are entered / not NULL.
And maybe we set it so the LEDs are lit while voting is allowed, and for rounds where you only get one vote, the LEDs turn off once you've voted? Or it turns off all the LEDs on the buttons which you didn't press.
We'd probably want some sort of cron job or state machine running that would clean up any missed LED interactions every minute or 5 minutes or something... I can see the button LED state getting out of whack in a crunchy scenario with lots of voting activity, especially if it's like "whoever hits a button the soonest after I open this round of voting!"
There are three steps to this issue:
[x] Add three columns in the rooms table to track LED light status for each button.
[ ] Add functionality in the polling function on the Potato app script to check LED status and set them appropriately via GPIO pins
[ ] Determine how we want LEDs to behave (e.g. on at round start, flashing, change when someone votes, etc...)
Each of the buttons should have a row in the
rooms
table, likeled_1
,led_2
,led_3
, with an INTEGER and default to0
for off.When a round begins, the LEDs could be lit by the code updating the row for each room and setting the LEDs appropriately in the
rooms
table.When a round becomes "active", then maybe we look at how many
value
s there are for that round, and light up the LEDs corresponding to thevalue
s that are entered / notNULL
.And maybe we set it so the LEDs are lit while voting is allowed, and for rounds where you only get one vote, the LEDs turn off once you've voted? Or it turns off all the LEDs on the buttons which you didn't press.
We'd probably want some sort of cron job or state machine running that would clean up any missed LED interactions every minute or 5 minutes or something... I can see the button LED state getting out of whack in a crunchy scenario with lots of voting activity, especially if it's like "whoever hits a button the soonest after I open this round of voting!"
There are three steps to this issue:
rooms
table to track LED light status for each button.