|
DovesLapTimer 4.0.0
GPS-based lap timing Arduino library — go-karts to race cars
|
#include <Adafruit_GPS.h>#include "gps_config.h"#include "images.h"#include "display_config.h"#include <DovesLapTimer.h>Macros | |
| #define | debug DEBUG_SERIAL.print |
| #define | DEBUG_SERIAL Serial |
| #define | debugln DEBUG_SERIAL.println |
| #define | GPS_SERIAL Serial1 |
| #define | HAS_DEBUG |
| #define | I2C_DISPLAY_ADDRESS 0x3C |
| #define | NMEA_LED_PIN LED_GREEN |
| #define | SCREEN_HEIGHT 64 |
| #define | SCREEN_WIDTH 128 |
| #define | USE_1306_DISPLAY |
Functions | |
| void | displayCrossing () |
| void | displayLoadPage () |
| void | displayLoop () |
| void | displaySetup () |
| void | displayStats () |
| unsigned long | getGpsTimeInMilliseconds () |
| Returns the GPS time since midnight in milliseconds. | |
| void | GPS_SendConfig (const uint8_t *Progmem_ptr, uint8_t arraysize) |
| Sends a GPS configuration command stored in program memory to the GPS module via [GPS_SERIAL]. | |
| void | gpsLoop () |
| void | gpsSetup () |
| void | loop () |
| void | setup () |
Variables | |
| bool | activityFlasher = false |
| bool | calculatingFlip = false |
| const double | crossingPointALat = 00.00 |
| const double | crossingPointALng = -00.00 |
| const double | crossingPointBLat = 00.00 |
| const double | crossingPointBLng = -00.00 |
| double | crossingThresholdMeters = 7.0 |
| unsigned long | currentMillis |
| unsigned long | displayLastUpdate |
| int | displayUpdateRateHz = 3 |
| unsigned long | endTime |
| float | frameRate = 0.0 |
| Adafruit_GPS * | gps = NULL |
| DovesLapTimer | lapTimer (crossingThresholdMeters) |
| unsigned long | lastCurTime = -1 |
| int | ledState = LOW |
| unsigned long | loopCounter |
| unsigned long | startTime |
| const unsigned long | updateInterval = 1000 |
| unsigned long | worstTimeDifference = 0 |
| #define debug DEBUG_SERIAL.print |
| #define DEBUG_SERIAL Serial |
| #define debugln DEBUG_SERIAL.println |
| #define GPS_SERIAL Serial1 |
| #define HAS_DEBUG |
| #define I2C_DISPLAY_ADDRESS 0x3C |
| #define NMEA_LED_PIN LED_GREEN |
| #define SCREEN_HEIGHT 64 |
| #define SCREEN_WIDTH 128 |
| #define USE_1306_DISPLAY |
| void displayCrossing | ( | ) |
| void displayLoadPage | ( | ) |
| void displayLoop | ( | ) |
| void displaySetup | ( | ) |
| void displayStats | ( | ) |
| unsigned long getGpsTimeInMilliseconds | ( | ) |
Returns the GPS time since midnight in milliseconds.
| void GPS_SendConfig | ( | const uint8_t * | Progmem_ptr, |
| uint8_t | arraysize | ||
| ) |
Sends a GPS configuration command stored in program memory to the GPS module via [GPS_SERIAL].
This function reads a configuration command from PROGMEM (program memory) and sends it byte by byte to the GPS module using the [GPS_SERIAL] interface. The function also prints the configuration command in hexadecimal format for debugging purposes.
| Progmem_ptr | Pointer to the PROGMEM (program memory) containing the GPS configuration command. |
| arraysize | Size of the configuration command stored in PROGMEM. |
| void gpsLoop | ( | ) |
| void gpsSetup | ( | ) |
| void loop | ( | ) |
| void setup | ( | ) |
| bool activityFlasher = false |
| bool calculatingFlip = false |
| const double crossingPointALat = 00.00 |
Notes: this display of data is not pretty at all, its a debug screen.... the pretty part is your job
Notes: assumes you have the following: 1: a legit ublox GPS (in my case a SAM-M8Q, highly reccomended) 2: a 128x64 1306|1106 i2c oled display
DovesLapTimer does not interface with your GPS directly, you feed it data, and then check the state.
For feeding data: Check out the "Setup()" "loop()" and "gpsLoop()" For getting data: check out "displayStats()" towards the bottom of the file
I like organizing code with defines.... dont shoot me
| const double crossingPointALng = -00.00 |
| const double crossingPointBLat = 00.00 |
| const double crossingPointBLng = -00.00 |
| double crossingThresholdMeters = 7.0 |
| unsigned long currentMillis |
| unsigned long displayLastUpdate |
| int displayUpdateRateHz = 3 |
| unsigned long endTime |
| float frameRate = 0.0 |
| Adafruit_GPS* gps = NULL |
| DovesLapTimer lapTimer(crossingThresholdMeters) | ( | crossingThresholdMeters | ) |
| unsigned long lastCurTime = -1 |
| int ledState = LOW |
| unsigned long loopCounter |
| unsigned long startTime |
| const unsigned long updateInterval = 1000 |
| unsigned long worstTimeDifference = 0 |