Galaxy: fix turning Force Offroad back off

Only require Park when enabling.
This commit is contained in:
pharmacomaniac
2026-09-09 08:45:34 -04:00
parent 7f3bd61292
commit 2a01f17b46
3 changed files with 4 additions and 4 deletions
@@ -1292,7 +1292,7 @@ function getSettingLockReason(param) {
if (param?.requires_offroad && state.values.IsOnroad) {
return "This setting can only be changed while parked."
}
if (param?.requires_parked && !state.values.VehicleParked) {
if (param?.requires_parked && !state.values.VehicleParked && !(param.key === "ForceOffroad" && state.values.ForceOffroad)) {
return "This setting can only be changed while the vehicle is in Park."
}
if (param?.disabled_when_key_true && state.values[param.disabled_when_key_true]) {
@@ -98,7 +98,7 @@ export const Settings = {
},
lockReason(param) {
if (param?.requires_offroad && this.values.IsOnroad) return "This setting can only be changed while parked."
if (param?.requires_parked && !this.values.VehicleParked) return "This setting can only be changed while the vehicle is in Park."
if (param?.requires_parked && !this.values.VehicleParked && !(param.key === "ForceOffroad" && this.values.ForceOffroad)) return "This setting can only be changed while the vehicle is in Park."
if (param?.disabled_when_key_true && this.values[param.disabled_when_key_true]) return param.disabled_reason || "Disabled by another setting."
if (param?.requires_nonempty_key) {
const val = this.values[param.requires_nonempty_key]
+2 -2
View File
@@ -5802,10 +5802,10 @@ def setup(app):
}), 200
if key == "ForceOffroad":
if not _get_vehicle_parked():
enabled = str_val.strip() in ("1", "true", "True")
if enabled and not _get_vehicle_parked():
return jsonify({"error": "Force Offroad is only available while the vehicle is in Park."}), 403
enabled = str_val.strip() in ("1", "true", "True")
params.put_bool("ForceOffroad", enabled)
params.put_bool("ForceOnroad", False)
update_starpilot_toggles()