mirror of
https://github.com/dragonpilot/dragonpilot.git
synced 2026-07-20 20:32:06 +08:00
device auto shutdown toggle
This commit is contained in:
+2
-1
@@ -2,11 +2,12 @@ dragonpilot [latest]
|
||||
=======================
|
||||
* Up to comma.ai openpilot master branch commit 01c2174d5968266b87f1d1fecefce5affaeaa624 (2024-07-02)
|
||||
* DP HIGHLIGHT:
|
||||
* (TESTING )Tē-Tôo / Map Module
|
||||
* (TESTING) Tē-Tôo / Map Module
|
||||
* Road Name Display (Online OpenStreetMap)
|
||||
* Speed Camera Warning (Online OpenstreetMap: Untested)
|
||||
* Dedicated Speed Camera Warning (Taiwan)
|
||||
* Dynamic End-to-End w/ Toggleable Road Condition Detection.
|
||||
* Device Auto Shutdown Toggle.
|
||||
|
||||
dragonpilot [2024.07.01]
|
||||
=======================
|
||||
|
||||
@@ -243,6 +243,8 @@ std::unordered_map<std::string, uint32_t> keys = {
|
||||
{"dp_tetoo_speed_camera_taiwan", PERSISTENT},
|
||||
{"dp_tetoo_speed_camera_threshold", PERSISTENT},
|
||||
{"dp_long_de2e_road_condition", PERSISTENT},
|
||||
{"dp_device_auto_shutdown", PERSISTENT},
|
||||
{"dp_device_auto_shutdown_in", PERSISTENT},
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
@@ -36,6 +36,9 @@ class PowerMonitoring:
|
||||
# Reset capacity if it's low
|
||||
self.car_battery_capacity_uWh = max((CAR_BATTERY_CAPACITY_uWh / 10), int(car_battery_capacity_uWh))
|
||||
|
||||
self.dp_device_auto_shutdown = self.params.get_bool("dp_device_auto_shutdown")
|
||||
self.dp_device_auto_shutdown_in = int(self.params.get("dp_device_auto_shutdown_in")) * 60
|
||||
|
||||
# Calculation tick
|
||||
def calculate(self, voltage: int | None, ignition: bool):
|
||||
try:
|
||||
@@ -114,6 +117,10 @@ class PowerMonitoring:
|
||||
now = time.monotonic()
|
||||
should_shutdown = False
|
||||
offroad_time = (now - offroad_timestamp)
|
||||
|
||||
if started_seen and self.dp_device_auto_shutdown and offroad_time > self.dp_device_auto_shutdown_in:
|
||||
return True
|
||||
|
||||
low_voltage_shutdown = (self.car_voltage_mV < (VBATT_PAUSE_CHARGING * 1e3) and
|
||||
offroad_time > VOLTAGE_SHUTDOWN_MIN_OFFROAD_TIME_S)
|
||||
should_shutdown |= offroad_time > MAX_TIME_OFFROAD_S
|
||||
|
||||
@@ -81,6 +81,8 @@ def manager_init() -> None:
|
||||
("dp_tetoo_speed_camera_taiwan", "0"),
|
||||
("dp_tetoo_speed_camera_threshold", "0"),
|
||||
("dp_long_de2e_road_condition", "1"), # on by default, depends on dp_long_de2e
|
||||
("dp_device_auto_shutdown", "0"),
|
||||
("dp_device_auto_shutdown_in", "30"),
|
||||
]
|
||||
if not PC:
|
||||
default_params.append(("LastUpdateTime", datetime.datetime.now(datetime.UTC).replace(tzinfo=None).isoformat().encode('utf8')))
|
||||
|
||||
Reference in New Issue
Block a user