diff --git a/display.py b/display.py index a00aeb3..68b38c6 100644 --- a/display.py +++ b/display.py @@ -8,16 +8,16 @@ class display: self.device = LCD(2, i2c_addr, True) self.contents = [""] * self.height - def redraw(self, row = None): + async def redraw(self, row = None): if row == None: for row, line in enumerate(self.contents): - self.device.async_message(row + 1, line) + await self.device.async_message(row + 1, line) else: - self.device.async_message(row + 1, self.contents[row]) + await self.device.async_message(row + 1, self.contents[row]) - def read(self, row): + async def read(self, row): return self.contents[row] - def write(self, row, data, offset = 0): + async def write(self, row, data, offset = 0): self.contents[row] = f'{self.contents[row][:offset]}{data}{self.contents[row][offset+len(data):]}' self.redraw(row) \ No newline at end of file diff --git a/fancontrol.py b/fancontrol.py index 0086438..e914803 100644 --- a/fancontrol.py +++ b/fancontrol.py @@ -6,8 +6,8 @@ from display import display def wheel_handler(dir): print(f"wheel: {dir}") - disp.write(1, f"wheel: {dir}") - disp.redraw() + loop = asyncio.get_event_loop() + loop.create_task(disp.write(1, f"wheel: {dir}")) def button_test(*args): print(args)