This commit is contained in:
Your Name
2024-06-09 17:27:31 -05:00
parent 9172cb85ee
commit cee8330928

View File

@@ -136,11 +136,11 @@ def downloader_loop(event):
except KeyboardInterrupt:
pass
@retry(attempts=5, delay=0.2, ignore_failure=True)
def inject_assistance():
cmd = f"mmcli -m any --timeout 30 --location-inject-assistance-data={ASSIST_DATA_FILE}"
subprocess.check_output(cmd, stderr=subprocess.PIPE, shell=True)
cloudlog.info("successfully loaded assistance data")
# @retry(attempts=5, delay=0.2, ignore_failure=True)
# def inject_assistance():
# cmd = f"mmcli -m any --timeout 30 --location-inject-assistance-data={ASSIST_DATA_FILE}"
# subprocess.check_output(cmd, stderr=subprocess.PIPE, shell=True)
# cloudlog.info("successfully loaded assistance data")
@retry(attempts=5, delay=1.0)
def setup_quectel(diag: ModemDiag) -> bool:
@@ -174,10 +174,10 @@ def setup_quectel(diag: ModemDiag) -> bool:
# Do internet assistance
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)
# if os.path.exists(ASSIST_DATA_FILE):
# ret = True
# inject_assistance()
# os.remove(ASSIST_DATA_FILE)
#at_cmd("AT+QGPSXTRADATA?")
time_str = datetime.datetime.utcnow().strftime("%Y/%m/%d,%H:%M:%S")
at_cmd(f"AT+QGPSXTRATIME=0,\"{time_str}\",1,1,1000")
@@ -389,14 +389,12 @@ def main() -> NoReturn:
should_report = True
# Execute reporting if conditions are met
if should_report:
last_reported_time = current_time
last_reported_latitude = gps.latitude
last_reported_longitude = gps.longitude
if os.path.exists("/data/brian/gps_tracking.sh"):
# Update the last reported time and location
last_reported_time = current_time
last_reported_latitude = gps.latitude
last_reported_longitude = gps.longitude
# Call the script
subprocess.run(["bash", "/data/brian/gps_tracking.sh", gps.latitude, gps.longitude, gps.speed], check=True)
subprocess.run(["bash", "/data/brian/gps_tracking.sh", str(gps.latitude), str(gps.longitude), str(gps.speed)], check=True)
elif log_type == LOG_GNSS_OEMDRE_SVPOLY_REPORT: