park CPU savings + fix early shutdown on virtual battery capacity
controlsd: in park+ignition-on, run full step() only every 10th cycle. data_sample still runs every cycle (CAN parse, button detection) and card.controls_update still runs every cycle (CAN TX heartbeat, counter increments). Skipped cycles re-send cached controlsState/carControl so downstream freq_ok stays OK. Button edge handling + display-mode transitions extracted to handle_screen_mode() and called every cycle so debug-button presses aren't dropped. controlsd: 55% → 30% CPU in park. dmonitoringmodeld: subscribe to carState; at standstill, skip model.run and re-publish last inference. driverStateV2 continues flowing at 10Hz with known-good last face data (driver can't become distracted relative to a stopped car). ~5% CPU saved. power_monitoring: remove the `car_battery_capacity_uWh <= 0` shutdown trigger. That virtual capacity counter floor-limits to 3e6 µWh on boot and drains in ~12 min at typical device power, so a short drive (that doesn't fully recharge the 30e6 µWh virtual cap) followed by a quick store stop would trip shutdown well before the 30-min idle timer. The real car-battery-voltage protection (low_voltage_shutdown at 11.8V with 60s debounce) is kept. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -122,7 +122,13 @@ class PowerMonitoring:
|
||||
offroad_time > VOLTAGE_SHUTDOWN_MIN_OFFROAD_TIME_S)
|
||||
should_shutdown |= offroad_time > self.device_shutdown_time
|
||||
should_shutdown |= low_voltage_shutdown
|
||||
should_shutdown |= (self.car_battery_capacity_uWh <= 0)
|
||||
# CLEARPILOT: removed `car_battery_capacity_uWh <= 0` trigger. That's a virtual
|
||||
# capacity counter floor-limited to 3e6 µWh on boot which drains in ~12 min at
|
||||
# typical device power. With a short drive that doesn't fully recharge (charges
|
||||
# at 45W, cap 30e6 µWh = 36 min to full), a quick store stop could trip shutdown
|
||||
# well before the intended 30-min idle timer. The real protection we want here
|
||||
# is the car battery voltage check (kept above) — the virtual counter is now
|
||||
# retained only for telemetry.
|
||||
should_shutdown &= not ignition
|
||||
should_shutdown &= (not self.params.get_bool("DisablePowerDown"))
|
||||
should_shutdown &= in_car
|
||||
|
||||
Reference in New Issue
Block a user