16#ifndef _WAYPOINT_LAP_TIMER_H
17#define _WAYPOINT_LAP_TIMER_H
24#define WLT_STATE_IDLE 0
25#define WLT_STATE_WAITING_SPEED 1
26#define WLT_STATE_DRIVING 2
27#define WLT_STATE_IN_PROXIMITY 3
42 int loop(
double currentLat,
double currentLng,
float currentAltitudeMeters,
float currentSpeedKnots);
88 template<
typename... Args>
89 void debug_print(Args&&... args) {
90 if(_serial) { _serial->print(std::forward<Args>(args)...); }
92 template<
typename... Args>
93 void debug_println(Args&&... args) {
94 if(_serial) { _serial->println(std::forward<Args>(args)...); }
98 void _checkSpeed(
double lat,
double lng);
99 void _checkProximity(
double lat,
double lng);
100 void _bufferProximityPoint(
double lat,
double lng);
101 void _clearProximityBuffer();
102 void _processProximityBuffer();
107 unsigned long _millisecondsSinceMidnight;
112 float _waypointOdometer;
115 float _totalDistanceTraveled;
116 double _positionPrevLat;
117 double _positionPrevLng;
118 bool _firstPositionReceived;
119 float _currentSpeedKmh;
120 float _speedThresholdMph;
121 float _proximityMeters;
126 unsigned long _currentLapStartTime;
127 unsigned long _lastLapTime;
128 unsigned long _bestLapTime;
129 float _currentLapOdometerStart;
130 float _lastLapDistance;
131 float _bestLapDistance;
137 int _proximityBufferIndex;
138 int _proximityBufferCount;
140 unsigned long _closestTime;
141 float _closestOdometer;
#define DIR_UNKNOWN
Definition DovesLapTimer.h:33
#define WAYPOINT_LAP_BUFFER_SIZE
Definition DovesLapTimer.h:30
void loop()
Definition basic_oled_example.ino:116
Definition WaypointLapTimer.h:37
bool areSectorLinesConfigured() const
Definition WaypointLapTimer.h:71
float getCurrentSpeedKmh() const
Definition WaypointLapTimer.cpp:279
float getTotalDistanceTraveled() const
Definition WaypointLapTimer.cpp:258
double getWaypointLat() const
Definition WaypointLapTimer.cpp:299
unsigned long getBestSector2Time() const
Definition WaypointLapTimer.h:76
void reset()
Definition WaypointLapTimer.cpp:87
bool isDirectionResolved() const
Definition WaypointLapTimer.h:85
int getCurrentSector() const
Definition WaypointLapTimer.h:70
void setSpeedThresholdMph(float mph)
Definition WaypointLapTimer.cpp:91
unsigned long getCurrentLapTime() const
Definition WaypointLapTimer.cpp:238
unsigned long getBestSector1Time() const
Definition WaypointLapTimer.h:75
int getBestLapNumber() const
Definition WaypointLapTimer.cpp:262
int getBestSector2LapNumber() const
Definition WaypointLapTimer.h:80
int getDirection() const
Definition WaypointLapTimer.h:84
void updateCurrentTime(unsigned long currentTimeMilliseconds)
Definition WaypointLapTimer.cpp:50
float getCurrentSpeedMph() const
Definition WaypointLapTimer.cpp:283
int getBestSector3LapNumber() const
Definition WaypointLapTimer.h:81
bool getCrossing() const
Definition WaypointLapTimer.cpp:230
unsigned long getBestSector3Time() const
Definition WaypointLapTimer.h:77
unsigned long getCurrentLapSector3Time() const
Definition WaypointLapTimer.h:74
int getLaps() const
Definition WaypointLapTimer.cpp:234
unsigned long getCurrentLapSector1Time() const
Definition WaypointLapTimer.h:72
float getLastLapDistance() const
Definition WaypointLapTimer.cpp:287
int getBestSector1LapNumber() const
Definition WaypointLapTimer.h:79
bool hasWaypoint() const
Definition WaypointLapTimer.cpp:295
float getPaceDifference() const
Definition WaypointLapTimer.cpp:266
unsigned long getCurrentLapSector2Time() const
Definition WaypointLapTimer.h:73
float getBestLapDistance() const
Definition WaypointLapTimer.cpp:291
float getCurrentLapDistance() const
Definition WaypointLapTimer.cpp:252
void setProximityMeters(float meters)
Definition WaypointLapTimer.cpp:95
unsigned long getOptimalLapTime() const
Definition WaypointLapTimer.h:78
double getWaypointLng() const
Definition WaypointLapTimer.cpp:303
bool getRaceStarted() const
Definition WaypointLapTimer.cpp:226
unsigned long getLastLapTime() const
Definition WaypointLapTimer.cpp:244
unsigned long getBestLapTime() const
Definition WaypointLapTimer.cpp:248
Definition WaypointLapTimer.h:29
unsigned long time
Definition WaypointLapTimer.h:32
float odometer
Definition WaypointLapTimer.h:33
double lat
Definition WaypointLapTimer.h:30
double lng
Definition WaypointLapTimer.h:31
float distToWaypoint
Definition WaypointLapTimer.h:34