Skip to content

Commit

Permalink
add explicit call to NTP for Quectel BG600
Browse files Browse the repository at this point in the history
  • Loading branch information
ftylitak committed Jun 14, 2023
1 parent 4bb1fb3 commit 0f255bd
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
2 changes: 2 additions & 0 deletions insighioNode/lib/networking/cellular.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,8 @@ def connect(cfg):
modemInst.connect()

if modemInst.is_connected():
modemInst.force_time_update()
update_rtc_from_network_time(modemInst)
status = MODEM_CONNECTED
connection_duration = utime.ticks_ms() - start_connection_duration
logging.debug('Modem connected')
Expand Down
3 changes: 3 additions & 0 deletions insighioNode/lib/networking/modem/modem_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,9 @@ def disconnect(self):
status_att = self.detach()
return status_att and status_act

def force_time_update(self):
pass

def get_rssi(self):
if self.ppp is None:
regex_rssi = r"\+CSQ:\s*(\d+),\d+"
Expand Down
9 changes: 4 additions & 5 deletions insighioNode/lib/networking/modem/modem_bg600.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,13 @@ def connect(self, timeoutms=30000):
if not status:
return False

# (status, lines) = self.send_at_cmd('ATD*99***1#', 30000, "CONNECT(\\s*\\w+)?")
# if not status:
# return False

(status1, _) = self.send_at_cmd('AT+QICSGP=1,1,"' + self.apn + '","","",0')
(status2, _) = self.send_at_cmd('AT+QIACT=1')

return status1 and status2 # self.connected
return status1 and status2

def force_time_update(self):
self.send_at_cmd('AT+QNTP=1,"pool.ntp.org"', 125000, "\+QNTP")

def is_connected(self):
(status, lines) = self.send_at_cmd('AT+CGACT?')
Expand Down

0 comments on commit 0f255bd

Please sign in to comment.