diff --git a/modules/system.py b/modules/system.py index 32f2688..1fcb47f 100644 --- a/modules/system.py +++ b/modules/system.py @@ -255,6 +255,7 @@ if ble_count > 1: logger.debug(f"System: Initializing Interfaces") interface1 = interface2 = interface3 = interface4 = interface5 = interface6 = interface7 = interface8 = interface9 = None retry_int1 = retry_int2 = retry_int3 = retry_int4 = retry_int5 = retry_int6 = retry_int7 = retry_int8 = retry_int9 = False +max_retry_count1 = max_retry_count2 = max_retry_count3 = max_retry_count4 = max_retry_count5 = max_retry_count6 = max_retry_count7 = max_retry_count8 = max_retry_count9 = 3 for i in range(1, 10): interface_type = globals().get(f'interface{i}_type') if not interface_type or interface_type == 'none' or globals().get(f'interface{i}_enabled') == False: @@ -817,6 +818,9 @@ def handleAlertBroadcast(deviceID=1): def onDisconnect(interface): global retry_int1, retry_int2, retry_int3, retry_int4, retry_int5, retry_int6, retry_int7, retry_int8, retry_int9 + if interface is None: + logger.critical("System: Lost Connection to Device None") + exit_handler() rxType = type(interface).__name__ if rxType in ['SerialInterface', 'TCPInterface', 'BLEInterface']: identifier = interface.__dict__.get('devPath', interface.__dict__.get('hostname', 'BLE')) @@ -1128,7 +1132,8 @@ async def handleFileWatcher(): pass async def retry_interface(nodeID): - global max_retry_count + global retry_int1, retry_int2, retry_int3, retry_int4, retry_int5, retry_int6, retry_int7, retry_int8, retry_int9 + global max_retry_count1, max_retry_count2, max_retry_count3, max_retry_count4, max_retry_count5, max_retry_count6, max_retry_count7, max_retry_count8, max_retry_count9 interface = globals()[f'interface{nodeID}'] retry_int = globals()[f'retry_int{nodeID}'] max_retry_count = globals()[f'max_retry_count{nodeID}']