diff --git a/common/params_keys.h b/common/params_keys.h index 08f79bf5a..1822ebabb 100644 --- a/common/params_keys.h +++ b/common/params_keys.h @@ -147,6 +147,7 @@ inline static std::unordered_map 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"}}, diff --git a/system/hardware/hardwared.py b/system/hardware/hardwared.py index 8cde33592..d702334fa 100755 --- a/system/hardware/hardwared.py +++ b/system/hardware/hardwared.py @@ -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()) diff --git a/system/manager/process_config.py b/system/manager/process_config.py index a9579546b..67a77caa2 100644 --- a/system/manager/process_config.py +++ b/system/manager/process_config.py @@ -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."""