From 3504978d0e34ede0f0a1255698f170e37e87d933 Mon Sep 17 00:00:00 2001 From: FrogAi <91348155+FrogAi@users.noreply.github.com> Date: Tue, 27 Feb 2024 16:34:47 -0700 Subject: [PATCH] Device shut down timer Added toggle to shut down the device after being offroad for a specified amount of time. --- common/params.cc | 1 + .../frogpilot/assets/toggle_icons/icon_time.png | Bin 0 -> 19004 bytes selfdrive/frogpilot/ui/control_settings.cc | 8 ++++++++ selfdrive/thermald/power_monitoring.py | 7 +++++-- 4 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 selfdrive/frogpilot/assets/toggle_icons/icon_time.png diff --git a/common/params.cc b/common/params.cc index 866e9ed3..886d314c 100644 --- a/common/params.cc +++ b/common/params.cc @@ -244,6 +244,7 @@ std::unordered_map keys = { {"CustomTheme", PERSISTENT}, {"CydiaTune", PERSISTENT}, {"DecelerationProfile", PERSISTENT}, + {"DeviceShutdown", PERSISTENT}, {"DisengageVolume", PERSISTENT}, {"DriveStats", PERSISTENT}, {"DynamicPathWidth", PERSISTENT}, diff --git a/selfdrive/frogpilot/assets/toggle_icons/icon_time.png b/selfdrive/frogpilot/assets/toggle_icons/icon_time.png new file mode 100644 index 0000000000000000000000000000000000000000..41cfc0ad688f9677db566c350bce93e6a186a503 GIT binary patch literal 19004 zcmd74Wn7f&7d1R|HwGb%42^&^(jC%qq(h{;8$?0@rI7{^5RgzBq$O04?gkMAm6m?? z{NLaE{rULZUk(R{d+xceeeJ#WT5C_NmZlOBJ~ci9fgn;*me)Zb(BNk@d|Yh!&Gr|X z0r(G^r;d^=;{6cq76QS5P?49>^E2Bu#naPOI!Tdu|B`W zTThISkI%)!!_(PIpjf#cDrO||rCo3;gpvA<@-2LhL>ikCcGa~EKva+_R;L6I%Dmhu%NhNvt9?qAEugcmO zUgqUpf2gZFnp!ZVSZMiJSEuc=(Cp0#7q^g*&+~WT??&bCdHztpTxjv#baZe?(AU*H z*COAX8Xq@#)E015tCr5AuQp0o$HSD%~f>+6NZ zeRld^#K*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V~EoM~LkAp07CH!jDRXcG6P^I%w$Ss0;kj@se=S1VvdR@Rk%&)4iL!yKO3l zh9}RV255mHO7E(kqksJf#@+f*b`{XZWZ?@cJn+qV8MfNsyJsRy4vK)K92Nr`*#zoa zUmielefUK1_2A2ATF8rE;O6OqEcO=`!Ut>QdxWM(e% z&kH%*ih&g)z9Sj%@hv}=r}z4G>p2vZXqeM~!o$fa4h@$ULV)0w%0ju@W5z-)M0)t^ zTd+DgmN5BZJzlCki(*6i;%S66QPXiuWJ*dO*Necl`}^|z0^c(g?+$h499Ut|m%tMdu~MiS|a$AgF2dcM&;FY<5(K&~H&-1hdS@7CW%fy0w; zu|pxNx$P7LIy*r93XM-qEv+A%e*2%Rwr_0@gerHS?$S!azL!@F#2`~Tjx2bs!Mi~C zmrBSf;|yF%`vc%Ul%lz3g{d4*@}NjDp8EdHL=Bynm*-$siU;WCE7Q~l+=}obWSLIL z)KB5&&DYDFk%7>Oxj@Iu$r|>bZ8UuU&#CE>A shutdownLabels; + for (int i = 0; i <= 33; ++i) { + shutdownLabels[i] = i == 0 ? "Instant" : i <= 3 ? QString::number(i * 15) + " mins" : QString::number(i - 3) + (i == 4 ? " hour" : " hours"); + } + toggle = new FrogPilotParamValueControl(param, title, desc, icon, 0, 33, shutdownLabels, this, false); + } else if (param == "LateralTune") { FrogPilotParamManageControl *lateralTuneToggle = new FrogPilotParamManageControl(param, title, desc, icon, this); QObject::connect(lateralTuneToggle, &FrogPilotParamManageControl::manageButtonClicked, this, [this]() { diff --git a/selfdrive/thermald/power_monitoring.py b/selfdrive/thermald/power_monitoring.py index 62245bad..1378de53 100644 --- a/selfdrive/thermald/power_monitoring.py +++ b/selfdrive/thermald/power_monitoring.py @@ -38,6 +38,9 @@ class PowerMonitoring: self.car_battery_capacity_uWh = max((CAR_BATTERY_CAPACITY_uWh / 10), int(car_battery_capacity_uWh)) # FrogPilot variables + device_shutdown_setting = self.params.get_int("DeviceShutdown") + # If the toggle is set for < 1 hour, configure by 15 minute increments + self.device_shutdown_time = (device_shutdown_setting - 3) * 3600 if device_shutdown_setting >= 4 else device_shutdown_setting * (60 * 15) # Calculation tick def calculate(self, voltage: Optional[int], ignition: bool): @@ -119,13 +122,13 @@ class PowerMonitoring: offroad_time = (now - offroad_timestamp) 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 + should_shutdown |= offroad_time > self.device_shutdown_time should_shutdown |= low_voltage_shutdown should_shutdown |= (self.car_battery_capacity_uWh <= 0) should_shutdown &= not ignition should_shutdown &= (not self.params.get_bool("DisablePowerDown")) should_shutdown &= in_car - should_shutdown &= offroad_time > DELAY_SHUTDOWN_TIME_S + should_shutdown &= offroad_time > DELAY_SHUTDOWN_TIME_S if self.device_shutdown_time else True # If "Instant" is selected for the timer, shutdown immediately should_shutdown |= self.params.get_bool("ForcePowerDown") should_shutdown &= started_seen or (now > MIN_ON_TIME_S) return should_shutdown