mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-08-23 17:23:44 +08:00
7dd876805f
* make drive stats look nicer * offroad alerts style * rest of alerts * move that * fix up colors Co-authored-by: Comma Device <device@comma.ai> old-commit-hash: ce48d3c91eb66924ca20c0bcbd14a74e88207997
37 lines
957 B
Python
Executable File
37 lines
957 B
Python
Executable File
#!/usr/bin/env python3
|
|
import os
|
|
import sys
|
|
import time
|
|
import json
|
|
|
|
from common.basedir import BASEDIR
|
|
from common.params import Params
|
|
from selfdrive.controls.lib.alertmanager import set_offroad_alert
|
|
|
|
if __name__ == "__main__":
|
|
params = Params()
|
|
|
|
with open(os.path.join(BASEDIR, "selfdrive/controls/lib/alerts_offroad.json")) as f:
|
|
offroad_alerts = json.load(f)
|
|
|
|
t = 10 if len(sys.argv) < 2 else int(sys.argv[1])
|
|
while True:
|
|
print("setting alert update")
|
|
params.put("UpdateAvailable", "1")
|
|
r = open(os.path.join(BASEDIR, "RELEASES.md"), "r").read()
|
|
r = r[:r.find('\n\n')] # Slice latest release notes
|
|
params.put("ReleaseNotes", r + "\n")
|
|
|
|
time.sleep(t)
|
|
params.put("UpdateAvailable", "0")
|
|
|
|
# cycle through normal alerts
|
|
for a in offroad_alerts:
|
|
print("setting alert:", a)
|
|
set_offroad_alert(a, True)
|
|
time.sleep(t)
|
|
set_offroad_alert(a, False)
|
|
|
|
print("no alert")
|
|
time.sleep(t)
|