Controls - Device Management - Low Voltage Shutdown Threshold

Automatically shut the device down when your battery reaches a specific voltage level to prevent killing your battery.
This commit is contained in:
FrogAi 2024-05-10 11:21:17 -07:00
parent 6a3af731fd
commit b5906a76cd

View File

@ -114,7 +114,7 @@ class PowerMonitoring:
now = time.monotonic() now = time.monotonic()
should_shutdown = False should_shutdown = False
offroad_time = (now - offroad_timestamp) offroad_time = (now - offroad_timestamp)
low_voltage_shutdown = (self.car_voltage_mV < (VBATT_PAUSE_CHARGING * 1e3) and low_voltage_shutdown = (self.car_voltage_mV < (max(frogpilot_toggles.low_voltage_shutdown, VBATT_PAUSE_CHARGING) * 1e3) and
offroad_time > VOLTAGE_SHUTDOWN_MIN_OFFROAD_TIME_S) offroad_time > VOLTAGE_SHUTDOWN_MIN_OFFROAD_TIME_S)
should_shutdown |= offroad_time > frogpilot_toggles.device_shutdown_time should_shutdown |= offroad_time > frogpilot_toggles.device_shutdown_time
should_shutdown |= low_voltage_shutdown should_shutdown |= low_voltage_shutdown