mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-07-06 05:52:12 +08:00
hardwared: give stuck LTE connections a kick
This reverts commit e3e694096a3a79e663712797e559e729e6818c7c.
This commit is contained in:
@@ -99,6 +99,7 @@ def touch_thread(end_event):
|
||||
def hw_state_thread(end_event, hw_queue):
|
||||
"""Handles non critical hardware state, and sends over queue"""
|
||||
count = 0
|
||||
registered_count = 0
|
||||
prev_hw_state = None
|
||||
|
||||
modem_version = None
|
||||
@@ -149,6 +150,16 @@ def hw_state_thread(end_event, hw_queue):
|
||||
except queue.Full:
|
||||
pass
|
||||
|
||||
if AGNOS and (hw_state.network_info is not None) and (hw_state.network_info.get('state', None) == "REGISTERED"):
|
||||
registered_count += 1
|
||||
else:
|
||||
registered_count = 0
|
||||
|
||||
if registered_count > 10:
|
||||
cloudlog.warning(f"Modem stuck in registered state {hw_state.network_info}, bringing connection back up")
|
||||
os.system("nmcli conn up esim")
|
||||
registered_count = 0
|
||||
|
||||
if not modem_configured and HARDWARE.get_modem_version() is not None:
|
||||
cloudlog.warning("configuring modem")
|
||||
HARDWARE.configure_modem()
|
||||
|
||||
Reference in New Issue
Block a user