mirror of
https://github.com/infiniteCable2/openpilot.git
synced 2026-08-05 08:16:03 +08:00
ci: enforce runner cutoff above 9.0V threshold (#1156)
* ci: github runner auto off when voltage is above 9.0v . This ensures that a runner in vehicle doesn't accidentally break everything lol. * suggestion for clarity. * refactor: rename and update handling of `GithubRunnerVoltage` parameter - Improve clarity by renaming to `GithubRunnerSufficientVoltage`. - Changed attribute to `CLEAR_ON_MANAGER_START` for improved runtime state management. - No need for this value to be backed up! * refactor: streamline voltage check for GithubRunnerSufficientVoltage --------- Co-authored-by: DevTekVE <devtekve@gmail.com>
This commit is contained in:
committed by
GitHub
parent
3cf81c081c
commit
34f4aadca5
@@ -147,6 +147,7 @@ inline static std::unordered_map<std::string, ParamKeyAttributes> keys = {
|
||||
{"CustomAccShortPressIncrement", {PERSISTENT | BACKUP, INT, "1"}},
|
||||
{"DeviceBootMode", {PERSISTENT | BACKUP, INT, "0"}},
|
||||
{"EnableGithubRunner", {PERSISTENT | BACKUP, BOOL}},
|
||||
{"GithubRunnerSufficientVoltage", {CLEAR_ON_MANAGER_START , BOOL}},
|
||||
{"InteractivityTimeout", {PERSISTENT | BACKUP, INT, "0"}},
|
||||
{"IsDevelopmentBranch", {CLEAR_ON_MANAGER_START, BOOL}},
|
||||
{"MaxTimeOffroad", {PERSISTENT | BACKUP, INT, "1800"}},
|
||||
|
||||
@@ -382,6 +382,11 @@ def hardware_thread(end_event, hw_queue) -> None:
|
||||
|
||||
# Offroad power monitoring
|
||||
voltage = None if peripheralState.pandaType == log.PandaState.PandaType.unknown else peripheralState.voltage
|
||||
|
||||
# GitHub runner auto off: 9V is used as the threshold because most desktop runners
|
||||
# will rarely exceed 5V so 9V is set as our buffer between desk use and car use.
|
||||
params.put_bool_nonblocking("GithubRunnerSufficientVoltage", ((voltage or 0) and voltage > 9000))
|
||||
|
||||
power_monitor.calculate(voltage, onroad_conditions["ignition"])
|
||||
msg.deviceState.offroadPowerUsageUwh = power_monitor.get_power_used()
|
||||
msg.deviceState.carBatteryCapacityUwh = max(0, power_monitor.get_car_battery_capacity())
|
||||
|
||||
@@ -62,7 +62,8 @@ def only_offroad(started: bool, params: Params, CP: car.CarParams) -> bool:
|
||||
return not started
|
||||
|
||||
def use_github_runner(started, params, CP: car.CarParams) -> bool:
|
||||
return not PC and params.get_bool("EnableGithubRunner") and not params.get_bool("NetworkMetered")
|
||||
return not PC and params.get_bool("EnableGithubRunner") and (
|
||||
not params.get_bool("NetworkMetered") and not params.get_bool("GithubRunnerSufficientVoltage"))
|
||||
|
||||
def sunnylink_ready_shim(started, params, CP: car.CarParams) -> bool:
|
||||
"""Shim for sunnylink_ready to match the process manager signature."""
|
||||
|
||||
Reference in New Issue
Block a user