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);
86 template<
typename... Args>
87 void debug_print(Args&&... args) {
88 if(_serial) { _serial->print(std::forward<Args>(args)...); }
90 template<
typename... Args>
91 void debug_println(Args&&... args) {
92 if(_serial) { _serial->println(std::forward<Args>(args)...); }
96 void _checkSpeed(
double lat,
double lng);
97 void _checkProximity(
double lat,
double lng);
98 void _bufferProximityPoint(
double lat,
double lng);
99 void _clearProximityBuffer();
100 void _processProximityBuffer();
105 unsigned long _millisecondsSinceMidnight;
110 float _waypointOdometer;
113 float _totalDistanceTraveled;
114 double _positionPrevLat;
115 double _positionPrevLng;
116 bool _firstPositionReceived;
117 float _currentSpeedKmh;
118 float _speedThresholdMph;
119 float _proximityMeters;
124 unsigned long _currentLapStartTime;
125 unsigned long _lastLapTime;
126 unsigned long _bestLapTime;
127 float _currentLapOdometerStart;
128 float _lastLapDistance;
129 float _bestLapDistance;
135 int _proximityBufferIndex;
136 int _proximityBufferCount;
138 unsigned long _closestTime;
139 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:69
float getTotalDistanceTraveled() const
Definition WaypointLapTimer.cpp:258
double getWaypointLat() const
Definition WaypointLapTimer.cpp:291
unsigned long getBestSector2Time() const
Definition WaypointLapTimer.h:74
void reset()
Definition WaypointLapTimer.cpp:87
bool isDirectionResolved() const
Definition WaypointLapTimer.h:83
int getCurrentSector() const
Definition WaypointLapTimer.h:68
void setSpeedThresholdMph(float mph)
Definition WaypointLapTimer.cpp:91
unsigned long getCurrentLapTime() const
Definition WaypointLapTimer.cpp:238
unsigned long getBestSector1Time() const
Definition WaypointLapTimer.h:73
int getBestLapNumber() const
Definition WaypointLapTimer.cpp:262
int getBestSector2LapNumber() const
Definition WaypointLapTimer.h:78
int getDirection() const
Definition WaypointLapTimer.h:82
void updateCurrentTime(unsigned long currentTimeMilliseconds)
Definition WaypointLapTimer.cpp:50
int getBestSector3LapNumber() const
Definition WaypointLapTimer.h:79
bool getCrossing() const
Definition WaypointLapTimer.cpp:230
unsigned long getBestSector3Time() const
Definition WaypointLapTimer.h:75
unsigned long getCurrentLapSector3Time() const
Definition WaypointLapTimer.h:72
int getLaps() const
Definition WaypointLapTimer.cpp:234
unsigned long getCurrentLapSector1Time() const
Definition WaypointLapTimer.h:70
float getLastLapDistance() const
Definition WaypointLapTimer.cpp:279
int getBestSector1LapNumber() const
Definition WaypointLapTimer.h:77
bool hasWaypoint() const
Definition WaypointLapTimer.cpp:287
float getPaceDifference() const
Definition WaypointLapTimer.cpp:266
unsigned long getCurrentLapSector2Time() const
Definition WaypointLapTimer.h:71
float getBestLapDistance() const
Definition WaypointLapTimer.cpp:283
float getCurrentLapDistance() const
Definition WaypointLapTimer.cpp:252
void setProximityMeters(float meters)
Definition WaypointLapTimer.cpp:95
unsigned long getOptimalLapTime() const
Definition WaypointLapTimer.h:76
double getWaypointLng() const
Definition WaypointLapTimer.cpp:295
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