register clearpilot memory params and seed defaults in manager_init
Scaffolding for the upcoming UI port. Registers the keys the new C++ UI and SpeedState daemon will read/write, and seeds /dev/shm/params defaults at manager start so first-readers don't see missing keys before writers spin up. Keys registered: CarIsMetric, ClearpilotCruiseWarning, ClearpilotCruiseWarningSpeed, ClearpilotHasSpeed, ClearpilotIsMetric, ClearpilotPlayDing, ClearpilotShowHealthMetrics, ClearpilotSpeedDisplay, ClearpilotSpeedLimitDisplay, ClearpilotSpeedUnit, DashcamFrames, DashcamShutdown, DashcamState, IsDaylight, ModelFps, ModelStandby, ModelStandbyTs, ScreenRecorderDebug, ShutdownTouchReset, TelemetryEnabled, VpnEnabled. PERSISTENT registration here is purely a no-op placeholder: the actual storage is /dev/shm/params (tmpfs), which clears on every reboot regardless. Bench-mode keys (Bench*, ClpUiState, LogDirInitialized) not registered yet — they'll come with their respective features.
This commit is contained in:
@@ -243,6 +243,30 @@ std::unordered_map<std::string, uint32_t> keys = {
|
|||||||
|
|
||||||
{"CPTLkasButtonAction", PERSISTENT},
|
{"CPTLkasButtonAction", PERSISTENT},
|
||||||
{"ScreenDisplayMode", PERSISTENT},
|
{"ScreenDisplayMode", PERSISTENT},
|
||||||
|
|
||||||
|
// CLEARPILOT memory params (live at /dev/shm/params; tmpfs is volatile so
|
||||||
|
// these reset on reboot regardless of registration flag).
|
||||||
|
{"CarIsMetric", PERSISTENT},
|
||||||
|
{"ClearpilotCruiseWarning", PERSISTENT},
|
||||||
|
{"ClearpilotCruiseWarningSpeed", PERSISTENT},
|
||||||
|
{"ClearpilotHasSpeed", PERSISTENT},
|
||||||
|
{"ClearpilotIsMetric", PERSISTENT},
|
||||||
|
{"ClearpilotPlayDing", PERSISTENT},
|
||||||
|
{"ClearpilotShowHealthMetrics", PERSISTENT},
|
||||||
|
{"ClearpilotSpeedDisplay", PERSISTENT},
|
||||||
|
{"ClearpilotSpeedLimitDisplay", PERSISTENT},
|
||||||
|
{"ClearpilotSpeedUnit", PERSISTENT},
|
||||||
|
{"DashcamFrames", PERSISTENT},
|
||||||
|
{"DashcamShutdown", PERSISTENT},
|
||||||
|
{"DashcamState", PERSISTENT},
|
||||||
|
{"IsDaylight", PERSISTENT},
|
||||||
|
{"ModelFps", PERSISTENT},
|
||||||
|
{"ModelStandby", PERSISTENT},
|
||||||
|
{"ModelStandbyTs", PERSISTENT},
|
||||||
|
{"ScreenRecorderDebug", PERSISTENT},
|
||||||
|
{"ShutdownTouchReset", PERSISTENT},
|
||||||
|
{"TelemetryEnabled", PERSISTENT},
|
||||||
|
{"VpnEnabled", PERSISTENT},
|
||||||
|
|
||||||
{"RadarDist", PERSISTENT},
|
{"RadarDist", PERSISTENT},
|
||||||
{"ModelDist", PERSISTENT},
|
{"ModelDist", PERSISTENT},
|
||||||
|
|||||||
@@ -301,6 +301,32 @@ def manager_init(frogpilot_functions) -> None:
|
|||||||
else:
|
else:
|
||||||
params_storage.put(k, params.get(k))
|
params_storage.put(k, params.get(k))
|
||||||
|
|
||||||
|
# CLEARPILOT memory-param defaults. /dev/shm/params is on tmpfs so these
|
||||||
|
# reset on every boot anyway; we still set them so first-readers don't see
|
||||||
|
# missing keys before the writer process has spun up.
|
||||||
|
params_memory = Params("/dev/shm/params")
|
||||||
|
for k, v in [
|
||||||
|
("CarIsMetric", "0"),
|
||||||
|
("ClearpilotCruiseWarning", ""),
|
||||||
|
("ClearpilotCruiseWarningSpeed", ""),
|
||||||
|
("ClearpilotHasSpeed", "0"),
|
||||||
|
("ClearpilotIsMetric", "0"),
|
||||||
|
("ClearpilotPlayDing", "0"),
|
||||||
|
("ClearpilotSpeedDisplay", ""),
|
||||||
|
("ClearpilotSpeedLimitDisplay", "0"),
|
||||||
|
("ClearpilotSpeedUnit", "mph"),
|
||||||
|
("DashcamFrames", "0"),
|
||||||
|
("DashcamShutdown", "0"),
|
||||||
|
("DashcamState", "stopped"),
|
||||||
|
("ModelFps", "20"),
|
||||||
|
("ModelStandby", "0"),
|
||||||
|
("ModelStandbyTs", "0"),
|
||||||
|
("ShutdownTouchReset", "0"),
|
||||||
|
("TelemetryEnabled", "0"),
|
||||||
|
("VpnEnabled", "1"),
|
||||||
|
]:
|
||||||
|
params_memory.put(k, v)
|
||||||
|
|
||||||
# Create folders needed for msgq
|
# Create folders needed for msgq
|
||||||
try:
|
try:
|
||||||
os.mkdir("/dev/shm")
|
os.mkdir("/dev/shm")
|
||||||
|
|||||||
Reference in New Issue
Block a user