1
Fork 0
mirror of https://github.com/RGBCube/GDUS synced 2025-07-28 13:37:45 +00:00

Fix bug in led closing logic

This commit is contained in:
RGBCube 2023-12-29 15:20:11 +03:00
parent 23d481dc2f
commit af3153b5b3
No known key found for this signature in database

View file

@ -25,12 +25,15 @@ async def toggle(number: int) -> str:
gpio.output(led[0], int(led[1]))
turn_off = leds.copy().remove(led)
del turn_off[0] # ()
turn_off = leds.copy()
turn_off.remove(led)
turn_off.remove(())
for i, led in enumerate(turn_off):
# Horrible code, but time is running out and so is
# my motivation for this project.
for led in turn_off:
gpio.output(led[0], True)
leds[i + 1][1] = True
leds[leds.index(led)][1] = True
return f"TOGGLE OK, NEW STATE: {'ON' if led[1] else 'OFF'}"