mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-09-11 10:43:46 +08:00
Galaxy: fix turning Force Offroad back off
Only require Park when enabling.
(cherry picked from commit 2a01f17b46)
This commit is contained in:
committed by
firestar5683
parent
b67bc26763
commit
29dbf8d084
@@ -1586,7 +1586,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]) {
|
||||
|
||||
@@ -121,7 +121,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]
|
||||
|
||||
@@ -6185,10 +6185,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()
|
||||
|
||||
Reference in New Issue
Block a user