mirror of
https://github.com/MoreTore/openpilot.git
synced 2026-08-05 00:05:59 +08:00
rawgpsd: fix double setup (#29108)
* rawgpsd: fix double setup * speedup test * update that one * minimal diff --------- Co-authored-by: Comma Device <device@comma.ai>
This commit is contained in:
@@ -162,7 +162,9 @@ def inject_assistance():
|
||||
returncode=e.returncode
|
||||
)
|
||||
|
||||
def setup_quectel(diag: ModemDiag):
|
||||
def setup_quectel(diag: ModemDiag) -> bool:
|
||||
ret = False
|
||||
|
||||
# enable OEMDRE in the NV
|
||||
# TODO: it has to reboot for this to take effect
|
||||
DIAG_NV_READ_F = 38
|
||||
@@ -186,7 +188,9 @@ def setup_quectel(diag: ModemDiag):
|
||||
at_cmd("AT+QGPSXTRA=1")
|
||||
at_cmd("AT+QGPSSUPLURL=\"NULL\"")
|
||||
if os.path.exists(ASSIST_DATA_FILE):
|
||||
ret = True
|
||||
inject_assistance()
|
||||
os.remove(ASSIST_DATA_FILE)
|
||||
#at_cmd("AT+QGPSXTRADATA?")
|
||||
time_str = datetime.utcnow().strftime("%Y/%m/%d,%H:%M:%S")
|
||||
at_cmd(f"AT+QGPSXTRATIME=0,\"{time_str}\",1,1,1000")
|
||||
@@ -213,6 +217,8 @@ def setup_quectel(diag: ModemDiag):
|
||||
0,0
|
||||
))
|
||||
|
||||
return ret
|
||||
|
||||
def teardown_quectel(diag):
|
||||
at_cmd("AT+QGPSCFG=\"outport\",\"none\"")
|
||||
if gps_enabled():
|
||||
@@ -260,8 +266,8 @@ def main() -> NoReturn:
|
||||
|
||||
# connect to modem
|
||||
diag = ModemDiag()
|
||||
setup_quectel(diag)
|
||||
want_assistance = True
|
||||
r = setup_quectel(diag)
|
||||
want_assistance = not r
|
||||
current_gps_time = utc_to_gpst(GPSTime.from_datetime(datetime.utcnow()))
|
||||
cloudlog.warning("quectel setup done")
|
||||
gpio_init(GPIO.UBLOX_PWR_EN, True)
|
||||
@@ -270,12 +276,9 @@ def main() -> NoReturn:
|
||||
pm = messaging.PubMaster(['qcomGnss', 'gpsLocation'])
|
||||
|
||||
while 1:
|
||||
if os.path.exists(ASSIST_DATA_FILE):
|
||||
if want_assistance:
|
||||
setup_quectel(diag)
|
||||
want_assistance = False
|
||||
else:
|
||||
os.remove(ASSIST_DATA_FILE)
|
||||
if os.path.exists(ASSIST_DATA_FILE) and want_assistance:
|
||||
setup_quectel(diag)
|
||||
want_assistance = False
|
||||
|
||||
opcode, payload = diag.recv()
|
||||
if opcode != DIAG_LOG_F:
|
||||
|
||||
@@ -67,7 +67,7 @@ class TestRawgpsd(unittest.TestCase):
|
||||
os.system("sudo systemctl stop systemd-resolved")
|
||||
with self.subTest(internet=internet):
|
||||
managed_processes['rawgpsd'].start()
|
||||
assert self._wait_for_output(10)
|
||||
assert self._wait_for_output(7)
|
||||
managed_processes['rawgpsd'].stop()
|
||||
|
||||
def test_turns_off_gnss(self):
|
||||
|
||||
Reference in New Issue
Block a user