Skip to content

Conversation

@TheAngryRaven
Copy link
Owner

No description provided.

Created detailed implementation plan for adding 3-sector split timing to DovesLapTimer:
- Analyzed current lap timing architecture and line detection logic
- Proposed shared buffer approach for memory efficiency
- Designed sector state machine with out-of-order detection
- Planned 7-step implementation with backwards compatibility
- API includes getBestSector1/2/3Time() and getOptimalLapTime()
- Estimated ~114 bytes RAM overhead, minimal performance impact
This commit adds comprehensive sector timing support to DovesLapTimer,
allowing drivers to track split times across 3 sectors and calculate
optimal lap times from best sector performances.

Features Added:
- 3-sector split timing (Start/Finish → S2 → S3 → Start/Finish)
- Track best time for each sector independently
- Calculate optimal lap time (sum of best sectors)
- Live sector timing during current lap
- Track which lap number achieved each best sector
- Optional feature - works without sector lines configured (backwards compatible)
- Shared buffer approach for memory efficiency (~114 bytes overhead)

Implementation Details:
- Added sector line configuration (setSector2Line, setSector3Line)
- Sector state machine with out-of-order detection
- Reuses existing line crossing detection and interpolation logic
- Same interpolation accuracy as start/finish line (sub-100ms)
- Proper reset handling for all sector state

New API Methods:
- getBestSector1/2/3Time() - Best sector times in milliseconds
- getCurrentLapSector1/2/3Time() - Current lap sector times
- getOptimalLapTime() - Sum of best sector times
- getBestSector1/2/3LapNumber() - Which lap achieved best sector
- getCurrentSector() - Current sector (1/2/3)
- areSectorLinesConfigured() - Check if sectors enabled

Files Modified:
- src/DovesLapTimer.h - Added sector state variables and API methods
- src/DovesLapTimer.cpp - Implemented sector timing logic
- README.md - Updated documentation with sector timing info
- examples/sector_timing_example/ - New example demonstrating feature

Memory Impact: ~114 bytes RAM, ~2.5KB flash
Timing Accuracy: Maintains existing sub-100ms accuracy for all lines
@TheAngryRaven TheAngryRaven merged commit cfa3beb into master Jan 8, 2026
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.

3 participants