mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-02-25 16:33:57 +08:00
* add openpilot prefix to imports
* more
* more
* fix docs
* fix linter
* bump submodules
* fix patched tests
* update dynamic imports
* debug
* Revert "debug"
This reverts commit db5e13b9911cc74438bee123bc3430da6c31b24b.
* fix pm test
old-commit-hash: a9626f95b6
37 lines
1005 B
Python
Executable File
37 lines
1005 B
Python
Executable File
#!/usr/bin/env python3
|
|
import os
|
|
import sys
|
|
import time
|
|
import json
|
|
|
|
from openpilot.common.basedir import BASEDIR
|
|
from openpilot.common.params import Params
|
|
from openpilot.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_bool("UpdateAvailable", True)
|
|
r = open(os.path.join(BASEDIR, "RELEASES.md")).read()
|
|
r = r[:r.find('\n\n')] # Slice latest release notes
|
|
params.put("UpdaterNewReleaseNotes", r + "\n")
|
|
|
|
time.sleep(t)
|
|
params.put_bool("UpdateAvailable", False)
|
|
|
|
# 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)
|