mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-07-24 02:32:22 +08:00
Galaxy radar gate fix
Previously showed radartakeoffs and Human like lane changes to non-radar cars.
This commit is contained in:
@@ -42,6 +42,7 @@ const VEHICLE_SETTING_MAKES = {
|
||||
SNGHack: ["Lexus", "Toyota"],
|
||||
ToyotaAutoHold: ["Lexus", "Toyota"],
|
||||
}
|
||||
const RADAR_REQUIRED_KEYS = new Set(["HumanLaneChanges", "RadarTakeoffs"])
|
||||
|
||||
// Plain variables — scheduling/routing flags that must NOT be reactive
|
||||
let syncScheduled = false
|
||||
@@ -103,6 +104,7 @@ function isVehicleSettingVisible(section, param) {
|
||||
function isSettingVisible(section, param) {
|
||||
// This policy controls Galaxy rendering only; hidden params retain their stored values.
|
||||
if (HIDDEN_SETTING_KEYS.has(param.key) || !isVehicleSettingVisible(section, param)) return false
|
||||
if (RADAR_REQUIRED_KEYS.has(param.key) && !state.values.HasRadar) return false
|
||||
if (state.values[GALAXY_DEVELOPER_MODE_KEY]) return true
|
||||
return section.name === "Favorites" || param.settings_tier === "simple"
|
||||
}
|
||||
|
||||
@@ -3075,6 +3075,17 @@ def _get_starpilot_toggles_snapshot():
|
||||
except Exception:
|
||||
return {}
|
||||
|
||||
def _get_has_radar():
|
||||
cp_bytes = _safe_params_get_live_raw("CarParamsPersistent")
|
||||
if not cp_bytes:
|
||||
return False
|
||||
|
||||
try:
|
||||
with car.CarParams.from_bytes(cp_bytes) as cp:
|
||||
return not bool(getattr(cp, "radarUnavailable", False))
|
||||
except Exception:
|
||||
return False
|
||||
|
||||
def _get_hardware_snapshot_items():
|
||||
starpilot_toggles = _get_starpilot_toggles_snapshot()
|
||||
|
||||
@@ -4697,6 +4708,8 @@ def setup(app):
|
||||
except Exception:
|
||||
result[key] = None
|
||||
|
||||
result["HasRadar"] = _get_has_radar()
|
||||
|
||||
return jsonify(_sanitize_json_value(result)), 200
|
||||
|
||||
@app.route("/api/params/defaults", methods=["GET"])
|
||||
|
||||
Reference in New Issue
Block a user