fancontrol/animation.py
2026-09-30 21:01:37 +00:00

81 lines
No EOL
1.2 KiB
Python

import asyncio
# animated tile set
# fan, four frames
FAN = [
[0b00000,
0b00100,
0b00100,
0b11111,
0b00100,
0b00100,
0b00000,
0b00000],
[0b00000,
0b00010,
0b11010,
0b00100,
0b01011,
0b01000,
0b00000,
0b00000],
[0b00000,
0b10001,
0b01010,
0b00100,
0b01010,
0b10001,
0b00000,
0b00000],
[0b00000,
0b01000,
0b01011,
0b00100,
0b11010,
0b00010,
0b00000,
0b00000]
]
# wind, three frames
WIND = [
[0b01101,
0b10010,
0b00000,
0b01101,
0b10010,
0b00000,
0b01101,
0b10010],
[0b10110,
0b01001,
0b00000,
0b10110,
0b01001,
0b00000,
0b10110,
0b01001],
[0b11011,
0b00100,
0b00000,
0b11011,
0b00100,
0b00000,
0b11011,
0b00100]
]
class animator:
def __init__(self, lcd, slot, slides, delay):
self.lcd = lcd
self.slot = slot
self.slides = slides
self.delay = delay
async def start(self):
while True:
for slide in self.slides:
self.lcd.set_char(self.slot, slide)
await asyncio.sleep(self.delay)