Conversation
mzdnick
force-pushed
the
mazda-lka-toggle-v2
branch
4 times, most recently
from
September 16, 2026 18:38
08615c3 to
232e947
Compare
mzdnick
force-pushed
the
mazda-lka-toggle-v2
branch
2 times, most recently
from
September 17, 2026 16:45
e1c4cc4 to
a61b2a6
Compare
mzdnick
marked this pull request as ready for review
September 17, 2026 16:48
mzdnick
force-pushed
the
mazda-lka-toggle-v2
branch
2 times, most recently
from
September 18, 2026 04:29
d65c14f to
0048775
Compare
Issue: non-TJA trims expose no wheel button for lateral; the dash LKAS button is the only switch, and with MADS on its press read as a steering fault - the delivery watchdog sees the EPS stop applying torque the instant the button goes off - instead of the driver choice it is. Fix: read the button's edge from LANE_LINES, the state the dash button drives (0 lane keep off, 1-4 lane state): two agreeing frames make a 0 <-> nonzero edge one ButtonType.lkas press, the debounced off state publishes as lkaButtonOff for a lateral-only refusal, and the panda arms lateral on the on-press from the same frame, its HUD-frame liveness check riding the declaration. One lateral switch per car: a declared TJA button owns the press, the state still publishes. The delivery watchdog holds through a button-off window and alerts only while a request stands: the latch can outlive the request that earned it. Stock-long only: a SET press with LKA off is a stock ACC run openpilot never joined, so cancel no longer kills it. The TJA press hands a joined cruise back to the driver: on a TJA-declared car under stock longitudinal, the press that turns MADS lateral off leaves the driver's stock MRCC engaged underneath, and controlsd raises cruiseControl.cancel for exactly that state; the cancel spam disengaged an MRCC the press never asked about. Clear cruise_joined every cycle CRZ_BTNS carries the TJA bit, on the press cycle itself and before the MADS disable lands, so the standing engagement falls into the never-joined protection; joining the cruise again re-arms the sync cancel. Alpha-long still cancels, the engagement there being openpilot's own. Without the declaration carstate publishes tja_button as zero, so the clause is unreachable on other cars. The re-enabled button stops overselling control too: the EPS holds LKAS_BLOCK through standstill, a dash LKA-off, and a fixed ~3 s re-arm after a re-enable (3.03 to 3.06 s, nine of nine measured dash cycles) before it takes lateral. carstate publishes the bit debounced (0.2 s) as latBlocked on carState, so the UI can hold lateral as arming until the EPS actually grants it. Validation: mazda suites 562 car + 289 safety passed, 44 skipped, 215 subtests; ruff clean. Route 9ff65375 (2026-09-16): every toggle drove LANE_LINES to zero and back on marked road, unmarked streets held the count at one. Stage drive the same evening: boot-off silent arm, no-entry while off, ON edges engage lateral, and the standing-request gate silenced the four false warnings seen before it. The re-arm window was measured on the stage drive's dedicated capture, ten dash cycles.
mzdnick
force-pushed
the
mazda-lka-toggle-v2
branch
from
September 19, 2026 06:59
0048775 to
67fdea7
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Depends on #13: it replaces the LANE_LINES == 0 heuristic this PR's button read would otherwise collide with.
Why
What
Validation
AI Usage
Disclaimer: GLM-5.3 by Z.ai was used to help develop, debug, and document this submission. All changes were reviewed and validated by me.