Skip to content
This repository has been archived by the owner on Feb 24, 2024. It is now read-only.

Commit

Permalink
release bridge auto reconnects to calc
Browse files Browse the repository at this point in the history
  • Loading branch information
alessiodam committed Dec 17, 2023
1 parent fbb149b commit 47d9de5
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions tinet-bridge.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
import serial.serialutil
from serial_asyncio import open_serial_connection

# --- bridge config --- #
AUTO_RECONNECT = True
# --- end bridge config --- #


def find_serial_port():
while True:
Expand Down Expand Up @@ -69,9 +73,10 @@ async def bridge(serial_device):


if __name__ == "__main__":
loop = asyncio.new_event_loop()
print("Waiting for a calculator..")
serial_port = find_serial_port()
print(serial_port)
time.sleep(2)
loop.run_until_complete(bridge(serial_port.device))
while AUTO_RECONNECT:
loop = asyncio.new_event_loop()
print("Waiting for a calculator..")
serial_port = find_serial_port()
print(serial_port)
time.sleep(2)
loop.run_until_complete(bridge(serial_port.device))

0 comments on commit 47d9de5

Please sign in to comment.