Repository navigation
feat: remove pit lane entry and exit - #227
Merged
Merged
Conversation
The gates, the settings behind them, the automation's stop path, the capture steps, the gate fields in a track definition, and their documentation. Too much complexity for what they earned. TimingGate is start and finish, kTimingGateCount is 2, and a track definition's CircuitGateDefinitions loses both pit gates - which takes the track schema to version 4. Schema 3 still loads: its pit gates are parsed and discarded, because the 26 circuits already written to cards are otherwise correct and rejecting them would cost a device its whole track list for gates nothing reads. Gate capture walks two gates rather than four. SessionController::stop_from_pit_entry and CompletionReason::pit_entry go. pit_entry_auto_stop_enabled goes, and gains no start-line equivalent: stopping there would end a session after one lap, so stopping stays the driver's. The GPS trigger survives, retargeted to the start line. It is what keeps the trigger when the pit gates go, and it is the better gate anyway: the start line is crossed every lap, where pit exit on a road loop was a line somebody picked, and on a circuit whose start and finish are one line the session and lap 1 begin on the same crossing. Two decisions departed from the issue, both to avoid a format change for a field nothing uses: pit_exit_auto_start_enabled is renamed gps_start_line_enabled rather than removed and replaced. The stored byte and its meaning are unchanged, so the settings record needs no version bump and no migration, and a v8 device keeps every setting it had. Byte 65, which held pit-entry auto-stop, is kept as reserved and written as zero: reclaiming it would change a fixed-width record's length. The log format's SessionSettingsV1 and SessionCompletionReason are treated the same way - reserved_pit_entry is kept and never produced, so the five sessions already on cards still decode to a reason the reader knows. A start-line crossing starts a session only while armed. Without that, driving out of the paddock would begin one: pit exit was obscure enough that a crossing implied intent, and the start line is not. ignored_unarmed reports it, because the remedy differs from every other refusal. Two things found on the way: std::array<DirectedGateDefinition*, 4> kept its length after losing two initialisers, so it held two null pointers and load_track_definition segfaulted. The two arrays parallel to it had the same fault. SettingsField had gained acceleration_target without kSettingsFieldCount or the name array following it, so naming that field read past the end. Both are fixed, with a static_assert on the array now. Closes #226 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
Closes #226. 53 files, −761 lines.
What went
The two timing gates, the settings behind them, the automation's stop path, the capture steps, the gate fields in a track definition, and their documentation.
TimingGateisstartandfinish;kTimingGateCountis 2CircuitGateDefinitionsloses both pit gates → track schema version 4SessionController::stop_from_pit_entryandCompletionReason::pit_entrypit_entry_auto_stop_enabled, with no start-line equivalent: stopping there would end a session after one lap, so stopping stays the driver'sSchema 3 still loads. Its pit gates are parsed and discarded, because the 26 circuits already written to cards are otherwise correct and rejecting them would cost a device its whole track list for gates nothing reads.
The GPS trigger survives, on the start line
Per the amendment on the issue. It is also simply the better gate: the start line is crossed every lap, where pit exit on a road loop was a line somebody picked, and on a circuit whose start and finish are one line the session and lap 1 begin on the same crossing.
A crossing starts a session only while armed. Without that, driving out of the paddock would begin one — pit exit was obscure enough that a crossing implied intent, and the start line is not.
GateAutomationResult::ignored_unarmedreports it, because the remedy differs from every other refusal.Two departures from the issue, both for the same reason
The issue called for settings v9 with a migration. No version bump was needed, and avoiding one is strictly better for anyone holding a v8 device:
pit_exit_auto_start_enabled→gps_start_line_enabled. The stored byte and its meaning are unchanged, so this is a rename in C++ and nothing in the format.The log format is treated the same way:
SessionSettingsV1keeps a reserved field, andSessionCompletionReason::pit_entrybecomesreserved_pit_entry— kept, never produced — so the sessions already on cards still decode to a reason the reader knows.Two faults found on the way
A segfault I introduced and the tests caught.
std::array<DirectedGateDefinition*, 4>kept its length after losing two initialisers, so it held two null pointers andload_track_definitioncrashed dereferencing them. The two arrays parallel to it had the same fault. Worth noting because the compiler is silent about it — a short initialiser list is legal.A latent out-of-bounds read, pre-existing.
SettingsFieldhad gainedacceleration_targetwithoutkSettingsFieldCountor the name array following it, so naming that field read past the end of a 14-element array. Found only because the two pit entries were in the same list. Fixed, with astatic_assertso the array and the enum cannot drift again.Also:
SETUPnow names the rest periodRESTrather thanPIT REST— it is time between sessions, spent wherever the driver likes.Verification
make check→CHECK_RC=0make test→ 38 Python tests, OKtools/validate_tracks.pypasses against the schemaThe automation's new behaviour is covered by a rewritten
test_gate_session_automation.cpp— each refusal asserted distinctly, including unarmed, plus a second crossing not restarting a running session and the configured duration surviving an automated start.test_track_definition.cppgains a case asserting a schema-3 document with pit gates still loads.Not yet flashed.
🤖 Generated with Claude Code