Skip to content

Feature/kart link laps - #58

Merged
LeoLTM merged 4 commits into
mainfrom
feature/kart-link-laps
Oct 28, 2026
Merged

LeoLTM merged 4 commits into
mainfrom
feature/kart-link-laps

Conversation

@LeoLTM

@LeoLTM LeoLTM commented Oct 28, 2026

Copy link
Copy Markdown
Owner

No description provided.

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).
@LeoLTM LeoLTM self-assigned this Oct 28, 2026
@LeoLTM
LeoLTM merged commit e9d0236 into main Oct 28, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant