DovesLapTimer 4.3.0
GPS-based lap timing Arduino library — go-karts to race cars
Loading...
Searching...
No Matches
SprintTimer.h File Reference
#include <Arduino.h>
#include "GeoMath.h"
#include "CrossingEngine.h"
#include "DovesLapTimer.h"
+ Include dependency graph for SprintTimer.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  SprintTimer
 

Macros

#define SPRINT_MAX_SPLITS   2
 

Macro Definition Documentation

◆ SPRINT_MAX_SPLITS

#define SPRINT_MAX_SPLITS   2

SprintTimer - point-to-point run timing ("sprint mode": autocross, hillclimb, rally-stage style events).

Unlike DovesLapTimer there are no laps: a run begins at a START line and ends at a SEPARATE FINISH line, with up to two optional split (sector) lines between them. Multiple runs happen per session — the driver loops back around to the start and goes again.

Run semantics (deliberately simple, two states):

  • WAITING: a start-line crossing begins a run.
  • RUNNING: a finish-line crossing completes the run; a START-line crossing CANCELS the run in progress and starts a brand new one (botched-course re-launch — the sprint equivalent of circuit's every-S/F-crossing-closes-and-opens).
  • Finish crossings while WAITING are ignored (driving back past the finish on the return loop must not do anything).
  • A DNF is just normal operation: an abandoned run never completes and records nothing.

ALL lines are monitored on every fix — there is no mutual exclusion. Every line owns its own CrossingEngine (buffer + interpolation), so the start and finish zones may sit arbitrarily close together (common at autocross paddocks) without contending for a shared buffer. The cost is RAM: ~2.9 KB per configured line's buffer on 32-bit targets (~11.6 KB for a fully-configured instance). SprintTimer is meant to be instantiated once, not pooled like CourseManager's 8-slot timer array. Not suitable for AVR Uno; tight on Mega.

Sector/split model: segments are numbered 1..N in crossing order, where N = 1 + (number of configured splits). Sector 2 (if configured) always closes segment 1; sector 3 closes the next segment; the finish closes the last. A split crossed out of order, or missed entirely, invalidates the run's SECTOR data (best-segment tracking skips that run) but never the run time itself. Zero, one, or two splits are all legal — unlike the circuit timer there is no both-or-nothing sector gate.

Direction note: crossing detection is direction-agnostic. A backward start crossing on the return loop opens a bogus run, which the cancel-and-restart rule self-heals at the real launch. A backward FINISH crossing while RUNNING is the only truly bogus completion; it requires re-entering the finish zone mid-run, which a one-way sprint course doesn't do.

Duck-typed to DovesLapTimer's public getter surface (laps == runs) so displays/loggers can consume either timer interchangeably; run-native aliases (getRuns, getBestRunTime, ...) are provided for new code.