Skip to content

Commit

Permalink
reset uart at the begining of each modem usage to ensure access to mo…
Browse files Browse the repository at this point in the history
…dem uart
  • Loading branch information
ftylitak committed May 17, 2023
1 parent 44eb0d5 commit d173e26
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 2 additions & 0 deletions insighioNode/apps/demo_console/cellular.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ def prepareForConnectAndUpload():
modem_instance = cellular.get_modem_instance()
if modem_instance is None:
return

modem_instance.reset_uart()
modem_instance.prioritizeWWAN()

def prepareForGPS():
Expand Down
9 changes: 7 additions & 2 deletions insighioNode/lib/networking/modem/modem_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,19 @@ def __init__(self, power_on=None, power_key=None, modem_tx=None, modem_rx=None):
self.gps_timestamp = None
self.gps_date = None
self.data_over_ppp = True
self.modem_tx = modem_tx
self.modem_rx = modem_rx

if modem_tx is not None and modem_rx is not None:
self.uart = UART(1, 115200, tx=modem_tx, rx=modem_rx)
self.uart.init(115200, bits=8, parity=None, stop=1, tx=modem_tx, rx=modem_rx, timeout=500, timeout_char=1000)
self.reset_uart()

self.modem_power_on = power_on
self.modem_power_key = power_key

def reset_uart(self):
self.uart = UART(1, 115200, tx=self.modem_tx, rx=self.modem_rx)
self.uart.init(115200, bits=8, parity=None, stop=1, tx=self.modem_tx, rx=self.modem_rx, timeout=500, timeout_char=1000)

def has_data_over_ppp(self):
return self.data_over_ppp

Expand Down

0 comments on commit d173e26

Please sign in to comment.