mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-06-22 18:52:07 +08:00
Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 58d57f7e1a | |||
| 9cbc91d129 | |||
| 764ff0db6a | |||
| 8faedaa062 | |||
| 4cc43ae6f5 | |||
| 578e80855a | |||
| 66c335113e | |||
| a0c10be1ff | |||
| a58db66a98 |
@@ -88,3 +88,22 @@ class DeviceSP:
|
||||
def _set_awake(self, on: bool):
|
||||
if on and self._params.get("DeviceBootMode", return_default=True) == 1:
|
||||
self._params.put_bool("OffroadMode", True)
|
||||
|
||||
@staticmethod
|
||||
def update_max_global_brightness(brightness_override: int) -> float:
|
||||
"""
|
||||
Updates the max global brightness by constraining the value to a predefined range.
|
||||
|
||||
The method takes an integer `brightness` value, adjusts it to ensure it is within the
|
||||
range of 30 to 100, inclusive, and returns the adjusted value as a float.
|
||||
|
||||
This method only runs if 0 (Auto) is not selected.
|
||||
|
||||
:param brightness_override: The desired brightness level. It is constrained between
|
||||
a minimum of 30 and a maximum of 100.
|
||||
:type brightness_override: int
|
||||
:return: The brightness value adjusted to fit within the allowable range,
|
||||
converted to a float.
|
||||
:rtype: float
|
||||
"""
|
||||
return float(min(max(brightness_override, 30), 100))
|
||||
|
||||
@@ -258,17 +258,12 @@ class Device(DeviceSP):
|
||||
else:
|
||||
clipped_brightness = ((clipped_brightness + 16.0) / 116.0) ** 3.0
|
||||
|
||||
if gui_app.sunnypilot_ui():
|
||||
if ui_state.global_brightness_override <= 0:
|
||||
min_global_brightness = 1 if ui_state.global_brightness_override < 0 else 30
|
||||
clipped_brightness = float(np.interp(clipped_brightness, [0, 1], [min_global_brightness, 100]))
|
||||
else:
|
||||
clipped_brightness = float(np.interp(clipped_brightness, [0, 1], [30, 100]))
|
||||
clipped_brightness = float(np.interp(clipped_brightness, [0, 1], [30, 100]))
|
||||
|
||||
brightness = round(self._brightness_filter.update(clipped_brightness))
|
||||
|
||||
if gui_app.sunnypilot_ui() and ui_state.global_brightness_override > 0:
|
||||
brightness = ui_state.global_brightness_override
|
||||
if gui_app.sunnypilot_ui() and ui_state.global_brightness_override != 0:
|
||||
brightness = DeviceSP.update_max_global_brightness(ui_state.global_brightness_override)
|
||||
|
||||
if not self._awake:
|
||||
brightness = 0
|
||||
|
||||
@@ -126,11 +126,13 @@
|
||||
"description": "Virtually shift camera's perspective to move model's center to Left(+ values) or Right (- values)",
|
||||
"min": -0.35,
|
||||
"max": 0.35,
|
||||
"step": 0.01
|
||||
"step": 0.01,
|
||||
"unit": "meters"
|
||||
},
|
||||
"CarBatteryCapacity": {
|
||||
"title": "Car Battery Capacity",
|
||||
"description": ""
|
||||
"description": "Battery Size",
|
||||
"unit": "kWh"
|
||||
},
|
||||
"CarList": {
|
||||
"title": "Supported Car List",
|
||||
@@ -396,7 +398,8 @@
|
||||
},
|
||||
"InteractivityTimeout": {
|
||||
"title": "Interactivity Timeout",
|
||||
"description": ""
|
||||
"description": "",
|
||||
"unit": "seconds"
|
||||
},
|
||||
"IsDevelopmentBranch": {
|
||||
"title": "Is Development Branch",
|
||||
@@ -630,7 +633,8 @@
|
||||
},
|
||||
"MaxTimeOffroad": {
|
||||
"title": "Max Time Offroad",
|
||||
"description": ""
|
||||
"description": "",
|
||||
"unit": "seconds"
|
||||
},
|
||||
"ModelManager_ActiveBundle": {
|
||||
"title": "Model Manager Active Bundle",
|
||||
@@ -784,9 +788,56 @@
|
||||
"OnroadScreenOffTimer": {
|
||||
"title": "Onroad Brightness Delay",
|
||||
"description": "",
|
||||
"min": 0,
|
||||
"max": 60,
|
||||
"step": 1
|
||||
"options": [
|
||||
{
|
||||
"value": 15,
|
||||
"label": "15s"
|
||||
},
|
||||
{
|
||||
"value": 30,
|
||||
"label": "30s"
|
||||
},
|
||||
{
|
||||
"value": 60,
|
||||
"label": "1m"
|
||||
},
|
||||
{
|
||||
"value": 120,
|
||||
"label": "2m"
|
||||
},
|
||||
{
|
||||
"value": 180,
|
||||
"label": "3m"
|
||||
},
|
||||
{
|
||||
"value": 240,
|
||||
"label": "4m"
|
||||
},
|
||||
{
|
||||
"value": 300,
|
||||
"label": "5m"
|
||||
},
|
||||
{
|
||||
"value": 360,
|
||||
"label": "6m"
|
||||
},
|
||||
{
|
||||
"value": 420,
|
||||
"label": "7m"
|
||||
},
|
||||
{
|
||||
"value": 480,
|
||||
"label": "8m"
|
||||
},
|
||||
{
|
||||
"value": 540,
|
||||
"label": "9m"
|
||||
},
|
||||
{
|
||||
"value": 600,
|
||||
"label": "10m"
|
||||
}
|
||||
]
|
||||
},
|
||||
"OnroadUploads": {
|
||||
"title": "Onroad Uploads",
|
||||
@@ -1060,7 +1111,8 @@
|
||||
"description": "",
|
||||
"min": 0.1,
|
||||
"max": 5.0,
|
||||
"step": 0.1
|
||||
"step": 0.1,
|
||||
"unit": "m/s²"
|
||||
},
|
||||
"ToyotaEnforceStockLongitudinal": {
|
||||
"title": "Toyota: Enforce Factory Longitudinal Control",
|
||||
|
||||
Reference in New Issue
Block a user