gpio close on shutdown

This commit is contained in:
marios8543 2025-04-26 20:41:13 +03:00
parent 44a70d3791
commit 8941c60ce5
2 changed files with 5 additions and 8 deletions

View File

@ -40,7 +40,7 @@ async def bluetooth_listener():
async def startup_event():
for i in [
tunerlist.run(),
bluetooth.run(),
# bluetooth.run(),
tunerlist_listener(),
bluetooth_listener()
]:

View File

@ -71,10 +71,6 @@ class TunerList:
self.text = ""
self.preset = None
def __del__(self):
self.pi.bb_serial_read_close(GPIO_PIN)
self.pi.stop()
async def run(self):
try:
while True:
@ -96,12 +92,13 @@ class TunerList:
print(hex(c), " ", end="")
print(" [",self.text,"]", f" [P {self.preset}]")
except CancelledError:
pass
self.pi.bb_serial_read_close(GPIO_PIN)
self.pi.stop()
async def yield_new_state(self):
while True:
yield await self.queue.get()
async def send_button(self, btn):
with ThreadPoolExecutor() as executor:
loop = get_event_loop()