Update system.py

This commit is contained in:
SpudGunMan
2024-07-31 15:06:43 -07:00
parent 532f3b0033
commit 6a28f22b21
+16 -16
View File
@@ -327,22 +327,6 @@ def exit_handler():
asyncLoop.close()
exit (0)
# this is a workaround because .localNode.getMetadata spits out a lot of debug info which cant be suppressed
from contextlib import contextmanager
import os
import sys
@contextmanager
def suppress_stdout():
with open(os.devnull, "w") as devnull:
old_stdout = sys.stdout
sys.stdout = devnull
try:
yield
finally:
sys.stdout = old_stdout
async def retry_interface(nodeID=1):
global interface1, interface2
# retry the interface
@@ -365,6 +349,22 @@ async def retry_interface(nodeID=1):
interface2 = meshtastic.ble_interface.BLEInterface(mac2)
print(f"{log_timestamp()} System: Interface2 Opened")
# this is a workaround because .localNode.getMetadata spits out a lot of debug info which cant be suppressed
from contextlib import contextmanager
import os
import sys
@contextmanager
def suppress_stdout():
with open(os.devnull, "w") as devnull:
old_stdout = sys.stdout
sys.stdout = devnull
try:
yield
finally:
sys.stdout = old_stdout
async def watchdog():
# watchdog for connection to the interface
while True: