Compare commits

...

13 Commits

Author SHA1 Message Date
royjr d44645fc53 Revert "simple for now"
This reverts commit 01420fc08488374ec8fe3d17b757ccd1564d1328.
2026-08-30 22:02:01 -04:00
royjr 2f2692d515 Revert "ignore for now"
This reverts commit f571b2b9201f0a7a5571d3114a317bd9e55d879b.
2026-08-30 22:02:01 -04:00
royjr d7aa0f5002 ignore for now 2026-08-30 22:02:01 -04:00
royjr a763c93496 simple for now 2026-08-30 22:02:01 -04:00
royjr cf0c41af96 AuxPowerSave 2026-08-30 22:02:01 -04:00
royjr 34e35d49e1 Revert "do we need this"
This reverts commit 1daecafee4.
2026-08-30 22:02:01 -04:00
royjr a5ec1b3f16 do we need this 2026-08-30 22:02:01 -04:00
royjr b7c40b4c44 fix ui 2026-08-30 22:02:01 -04:00
royjr 4033119fa0 Revert "ignition"
This reverts commit 304df24970.
2026-08-30 22:02:01 -04:00
royjr 7bb32de4b8 ignition 2026-08-30 22:02:01 -04:00
royjr 7419b2a0b0 perms 2026-08-30 22:02:01 -04:00
royjr aa8a190f5a try this 2026-08-30 22:02:01 -04:00
royjr de197ba6fa chestnut: alert when big model ready (#1947)
egpu: alert when big model ready

Co-authored-by: Jason Wen <haibin.wen3@gmail.com>
2026-08-30 16:20:16 -04:00
8 changed files with 37 additions and 0 deletions
+1
View File
@@ -353,6 +353,7 @@ struct OnroadEventSP @0xda96579883444c35 {
speedLimitPending @22;
e2eChime @23;
laneChangeRoadEdge @24;
bigModelReady @25;
}
}
+1
View File
@@ -132,6 +132,7 @@ inline static std::unordered_map<std::string, ParamKeyAttributes> keys = {
{"UptimeOnroad", {PERSISTENT, FLOAT, "0.0"}},
{"ChestnutActive", {CLEAR_ON_MANAGER_START | CLEAR_ON_OFFROAD_TRANSITION | CLEAR_ON_IGNITION_ON, BOOL}},
{"ChestnutLoading", {CLEAR_ON_MANAGER_START | CLEAR_ON_OFFROAD_TRANSITION | CLEAR_ON_IGNITION_ON, BOOL}},
{"AuxPowerSave", {PERSISTENT | BACKUP, BOOL}},
{"Version", {PERSISTENT, STRING}},
// --- sunnypilot params --- //
@@ -198,6 +198,7 @@ class SelfdriveD(CruiseHelper):
loading = self.params.get_bool("ChestnutLoading")
if self.big_model_loading and not loading:
self.big_model_ready_t = time.monotonic()
self.events_sp.add(custom.OnroadEventSP.EventName.bigModelReady)
self.big_model_loading = loading
if self.big_model_loading:
self.events.add(EventName.bigModelLoading)
+1
View File
@@ -220,6 +220,7 @@ class UIState(UIStateSP):
ChestnutState.UNCOMPILED if detected else ChestnutState.DISCONNECTED)
return
self.chestnut_present = self.chestnut_present or detected
model_seen = self.sm.recv_frame["modelV2"] > self.started_frame
if not self.chestnut_present:
self.chestnut_state = ChestnutState.DISCONNECTED
@@ -252,4 +252,12 @@ EVENTS_SP: dict[int, dict[str, Alert | AlertCallbackType]] = {
AlertStatus.userPrompt, AlertSize.small,
Priority.LOW, VisualAlert.none, AudibleAlert.prompt, 0.1),
},
EventNameSP.bigModelReady: {
ET.PERMANENT: Alert(
"Big Model Ready",
"",
AlertStatus.normal, AlertSize.small,
Priority.LOW, VisualAlert.none, AudibleAlert.prompt, 2.),
},
}
@@ -1675,6 +1675,12 @@
"widget": "toggle",
"title": "Onroad Uploads"
},
{
"key": "AuxPowerSave",
"widget": "toggle",
"title": "Disable Aux Port When Offroad",
"description": "Power off the aux USB-C port while offroad to save power. It powers back on automatically when you go onroad."
},
{
"key": "MaxTimeOffroad",
"widget": "option",
@@ -30,6 +30,10 @@ sections:
- key: OnroadUploads
widget: toggle
title: Onroad Uploads
- key: AuxPowerSave
widget: toggle
title: Disable Aux Port When Offroad
description: Power off the aux USB-C port while offroad to save power. It powers back on automatically when you go onroad.
- key: MaxTimeOffroad
widget: option
title: Max Time Offroad
+15
View File
@@ -21,6 +21,7 @@ from openpilot.selfdrive.selfdrived.alertmanager import set_offroad_alert
from openpilot.common.hardware import HARDWARE, COMMA_HARDWARE
from openpilot.common.basedir import BASEDIR
from openpilot.common.hardware.usb import CHESTNUT_FW_VERSION, CHESTNUT_ROM_USB_IDS, CHESTNUT_USB_IDS, get_usb_state, get_usb_topology, set_usb_state
from openpilot.system.hardware.chestnut.flash import VBUS_PATH
from openpilot.common.linux import LinuxSystemStats
from openpilot.system.loggerd.config import get_available_percent
from openpilot.common.swaglog import cloudlog
@@ -49,6 +50,10 @@ class Chestnut:
self.attempts = 0
self.last_attempt = 0.
self.flashed = False
self.vbus_on = None
self.params = Params()
self.powersave = False
self.last_offroad = None
def flash(self) -> None:
ret = subprocess.run(["sudo", sys.executable, os.path.join(BASEDIR, "openpilot/system/hardware/chestnut/flash.py"), CHESTNUT_FW_VERSION],
@@ -56,9 +61,19 @@ class Chestnut:
cloudlog.event("chestnut flash done", returncode=ret.returncode, output=ret.stdout[-1000:], error=ret.returncode != 0)
self.flashed = ret.returncode == 0
def set_vbus(self, on: bool) -> None:
if on == self.vbus_on:
return
subprocess.run(["sudo", "tee", VBUS_PATH], input=b"1" if on else b"0", stdout=subprocess.DEVNULL, check=False)
self.vbus_on = on
def update(self, offroad: bool, usb_state: list[dict]) -> None:
mismatch = any((d["vendorId"], d["productId"]) in CHESTNUT_USB_IDS + CHESTNUT_ROM_USB_IDS and
d["product"] != f"custom {CHESTNUT_FW_VERSION}-CLEAN" for d in usb_state)
if offroad != self.last_offroad:
self.powersave = self.params.get_bool("AuxPowerSave")
self.last_offroad = offroad
self.set_vbus((not offroad or mismatch) or not self.powersave)
if not mismatch:
self.flashed = False
return