How theangryraven/doveslaptimer works
Main components
• Library Core: represented by the files in the “src” folder (DovesLapTimer.cpp and DovesLapTimer.h). This is where the lap timing logic, interpolation, and state management live.
• Example Applications: the Arduino sketches inside “examples” (e.g., basic_oled_example and real_track_data_debug) that demonstrate how to use the library. Note that one example uses a display (basic OLED example) and another uses serial-only data debugging.
• External Hardware Components:
• GPS: The module handling positional data (with support for different GPS hardware specified in the README).
• OLED or other compatible display used in demos.
• Microcontroller: The project is intended for devices like the Seed NRF52840 or even an Arduino Mega+, with specific requirements due to floating-point math.
• Simulation/Emulation: Represented by the “wokwi” folder, which includes simulation configuration (chip json/c files) for in-browser demos.
• Dependencies/External Libraries: Include components like Adafruit_GPS, Adafruit-GFX-Library, Adafruit_SSD1306, and Adafruit_SH110x, which are used in the examples to support hardware functions.
Relationships and interactions
• The GPS Module feeds real-time data (latitude, longitude, altitude, speed) into the timing system.
• The Example Application (sketch) acts as the orchestrator—receiving this data and interfacing with the Lap Timer library by calling its initialize, update, and loop methods (as shown in the API usage examples).
• The Lap Timer module internally processes the incoming data, determines if the vehicle has crossed the start/finish line, and computes lap times using interpolation methods.
• Depending on the sketch, processed data may be output to either a display (OLED) or the serial console for debugging.
• In simulation environments (Wokwi), the “wokwi” components simulate the behavior of the GPS firmware to demonstrate how the system works without actual hardware.
Important architectural patterns/design principles
• Modular Design: The core functionality is separated into a reusable library (src) while demonstration code resides in examples.
• Hardware Abstraction: The library is independent of any specific hardware, assuming the user will supply proper GPS data and handle any display output.
• Interpolation & Real-Time Processing: The use of multiple interpolation strategies (linear and CatmullRom) to get an accurate crossing time hints at careful algorithmic design.
• API-Driven Development: The API provided (initialize, loop, reset, data retrieval functions) gives a clear abstraction for how the library should be integrated into a host project.