5-state display mode: auto day/night, nightrider, screen off
New ScreenDisplayMode param (fixes ScreenDisaplayMode typo): 0=auto-normal, 1=auto-nightrider, 2=normal, 3=screen-off, 4=nightrider Nightrider mode: black background (no camera feed), path/lane lines drawn as 2px outlines only. Auto mode uses NOAA solar position calc in gpsd to switch between day/night based on GPS lat/lon and UTC time. First calc on GPS fix, then every 30 seconds. Button cycle onroad: 0→4, 1→2, 2→3, 3→4, 4→2 (never back to auto). Offroad: any→3, 3→0. bench_cmd debugbutton simulates the button press. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -8,6 +8,7 @@ Usage:
|
||||
python3 -m selfdrive.clearpilot.bench_cmd speedlimit 45
|
||||
python3 -m selfdrive.clearpilot.bench_cmd cruise 55
|
||||
python3 -m selfdrive.clearpilot.bench_cmd engaged 1
|
||||
python3 -m selfdrive.clearpilot.bench_cmd debugbutton (simulate LKAS debug button press)
|
||||
python3 -m selfdrive.clearpilot.bench_cmd dump
|
||||
python3 -m selfdrive.clearpilot.bench_cmd wait_ready
|
||||
"""
|
||||
@@ -105,6 +106,23 @@ def main():
|
||||
elif cmd == "wait_ready":
|
||||
wait_ready()
|
||||
|
||||
elif cmd == "debugbutton":
|
||||
# Simulate LKAS debug button — same state machine as controlsd.clearpilot_state_control()
|
||||
current = params.get_int("ScreenDisplayMode")
|
||||
gear = (params.get("BenchGear") or b"P").decode().strip().upper()
|
||||
in_drive = gear in ("D", "S", "L")
|
||||
|
||||
if in_drive:
|
||||
transitions = {0: 4, 1: 2, 2: 3, 3: 4, 4: 2}
|
||||
new_mode = transitions.get(current, 0)
|
||||
else:
|
||||
new_mode = 0 if current == 3 else 3
|
||||
|
||||
params.put_int("ScreenDisplayMode", new_mode)
|
||||
mode_names = {0: "auto-normal", 1: "auto-nightrider", 2: "normal", 3: "screen-off", 4: "nightrider"}
|
||||
print(f"ScreenDisplayMode: {current} ({mode_names.get(current, '?')}) → {new_mode} ({mode_names.get(new_mode, '?')})"
|
||||
f" [gear={gear}, in_drive={in_drive}]")
|
||||
|
||||
elif cmd in param_map:
|
||||
if len(sys.argv) < 3:
|
||||
print(f"Usage: bench_cmd {cmd} <value>")
|
||||
|
||||
Reference in New Issue
Block a user