Repository navigation
Feature/kart link laps - #58
Merged
Merged
Conversation
In lap mode the ESP now sends one lapCrossing line per valid pass: the first beam break on the core's wrap-safe 64-bit µs clock (t), its age when the line is written (age) and a random per-boot id. The host chains crossings into laps, so a false trigger (someone walking through) can be dropped without ending the running lap. Replaces lapStart/lapEnd and the ESP-side single/multi mode and direction filter. Also drops the hand-rolled 64-bit widening, which only advanced in lap mode and could underflow. pong reports lapCrossing=true so the host can detect this firmware.
The lap engine (plugins/laptimer/engine.rs) turns the ESP's lapCrossing reports into laps. Lap durations are differences of ESP boundaries, so they keep the barrier's µs precision; the wall-clock time is the host receive time backdated by the reported age and the UART transfer time. Every crossing gets a verdict and is stored in lap_crossings, counted or not: too slow (someone walking through), double trigger, wrong direction, or the kart gate's answer. A rejected crossing never ends the running lap. A long gap, an ESP reboot or a new kart session starts a fresh lap. Single/multi mode and the direction filter moved here from the ESP. Crossings run through one task in order, because a verdict may wait for the kart's GPS. Photos still start right away, and the lap rows get the photos of their start and end crossings. The engine emits LAPSTART and LAPEND in the old shapes, so the UI and display keep working; the home panel lists the latest crossings with their verdicts. Lap mode requires the new firmware.
New kartlink plugin that connects the lap timer to the asl-gokart
telemetry stack over the driver's phone hotspot. It follows the kart's
retained status and live GPS on the broker. As the laptimer's kart gate,
it waits up to 3 s for the kart's fixes around a crossing and counts it
only if the kart was within the radius of the barrier; an offline kart
rejects it, and a missing fix or an unsynced clock makes it unverified.
Every stored crossing is published as kart.timing.v1.LapCrossing on
kart/{id}/laps (QoS 1, protos vendored in proto/). lap_crossings is the
outbox: a row is marked once the broker acknowledged it, and the flush
waits a moment after connecting so subscribers are back after a broker
restart.
Settings → Lap Timer gets the crossing filter and a Kart Link section
with a live status line and "Use kart's current position" to set the
barrier. The package now depends on an NTP client.
How crossings become laps, what each verdict means, and how to set up the kart link at the track (hotspot, broker settings, barrier position).
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.
No description provided.