#include <Arduino.h>
#include "ArxTypeTraits.h"
#include "GeoMath.h"
Go to the source code of this file.
|
| static unsigned long | timeSinceMidnightDelta (unsigned long startMs, unsigned long endMs) |
| | Elapsed milliseconds between two milliseconds-since-midnight timestamps.
|
| |
◆ CROSSING_LINE_SIDE_A
| #define CROSSING_LINE_SIDE_A -1 |
CrossingEngine - the reusable line-crossing detection core.
Owns the in-zone GPS ring buffer and the crossing interpolation math that previously lived inside DovesLapTimer (_detectLineCrossing + interpolateCrossingPoint). Extracted so point-to-point timers (SprintTimer) can reuse the exact same battle-tested pipeline — including with independent per-line buffers — without duplicating the math.
The engine is deliberately stateless about which line it is checking: line endpoints and the per-line in-zone flag are passed per call, exactly like the old private helper. One engine can therefore be shared across several lines (DovesLapTimer shares one across S/F + S2 + S3, with the caller enforcing only-one-line-crossing-at-a-time), or dedicated to a single line (SprintTimer gives every line its own engine, so start and finish zones may overlap without contention).
See DETECTION.md for the algorithm itself.
◆ CROSSING_LINE_SIDE_B
| #define CROSSING_LINE_SIDE_B 1 |
◆ CROSSING_LINE_SIDE_EXACT
| #define CROSSING_LINE_SIDE_EXACT 0 |
◆ CROSSING_MAX_FIX_GAP_MS
| #define CROSSING_MAX_FIX_GAP_MS 10000UL |
◆ CROSSING_PAIR_SPACING_FACTOR
| #define CROSSING_PAIR_SPACING_FACTOR 1.25 |
◆ DOVES_MILLIS_PER_DAY
| #define DOVES_MILLIS_PER_DAY 86400000UL |
◆ LineDetectResult
| Enumerator |
|---|
| LINE_DETECT_NONE | |
| LINE_DETECT_IN_ZONE | |
| LINE_DETECT_COMPLETED | |
◆ timeSinceMidnightDelta()
| static unsigned long timeSinceMidnightDelta |
( |
unsigned long |
startMs, |
|
|
unsigned long |
endMs |
|
) |
| |
|
inlinestatic |
Elapsed milliseconds between two milliseconds-since-midnight timestamps.
Normalizes across the UTC midnight wrap (86,399,999 -> 0), which happens mid-evening across the Americas. Without this, a lap straddling midnight underflows unsigned subtraction into a ~4.29-billion-ms "lap time".
- Parameters
-
| startMs | Earlier timestamp, in ms since midnight. |
| endMs | Later timestamp, in ms since midnight. |
- Returns
- Elapsed time in ms, wrap-normalized.