DovesLapTimer 4.0.0
GPS-based lap timing Arduino library — go-karts to race cars
Loading...
Searching...
No Matches
basic_oled_example.ino File Reference
#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
 

Macro Definition Documentation

◆ debug

#define debug   DEBUG_SERIAL.print

◆ DEBUG_SERIAL

#define DEBUG_SERIAL   Serial

◆ debugln

#define debugln   DEBUG_SERIAL.println

◆ GPS_SERIAL

#define GPS_SERIAL   Serial1

◆ HAS_DEBUG

#define HAS_DEBUG

◆ I2C_DISPLAY_ADDRESS

#define I2C_DISPLAY_ADDRESS   0x3C

◆ NMEA_LED_PIN

#define NMEA_LED_PIN   LED_GREEN

◆ SCREEN_HEIGHT

#define SCREEN_HEIGHT   64

◆ SCREEN_WIDTH

#define SCREEN_WIDTH   128

◆ USE_1306_DISPLAY

#define USE_1306_DISPLAY

Function Documentation

◆ displayCrossing()

void displayCrossing ( )

◆ displayLoadPage()

void displayLoadPage ( )

◆ displayLoop()

void displayLoop ( )

◆ displaySetup()

void displaySetup ( )

◆ displayStats()

void displayStats ( )

◆ getGpsTimeInMilliseconds()

unsigned long getGpsTimeInMilliseconds ( )

Returns the GPS time since midnight in milliseconds.

Returns
unsigned long The time since midnight in milliseconds

◆ GPS_SendConfig()

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.

Note
This function contains blocking code and should be used during setup only.
Parameters
Progmem_ptrPointer to the PROGMEM (program memory) containing the GPS configuration command.
arraysizeSize of the configuration command stored in PROGMEM.

◆ gpsLoop()

void gpsLoop ( )

◆ gpsSetup()

void gpsSetup ( )

◆ loop()

void loop ( )

◆ setup()

void setup ( )

Variable Documentation

◆ activityFlasher

bool activityFlasher = false

◆ calculatingFlip

bool calculatingFlip = false

◆ crossingPointALat

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

◆ crossingPointALng

const double crossingPointALng = -00.00

◆ crossingPointBLat

const double crossingPointBLat = 00.00

◆ crossingPointBLng

const double crossingPointBLng = -00.00

◆ crossingThresholdMeters

double crossingThresholdMeters = 7.0

◆ currentMillis

unsigned long currentMillis

◆ displayLastUpdate

unsigned long displayLastUpdate

◆ displayUpdateRateHz

int displayUpdateRateHz = 3

◆ endTime

unsigned long endTime

◆ frameRate

float frameRate = 0.0

◆ gps

Adafruit_GPS* gps = NULL

◆ lapTimer

◆ lastCurTime

unsigned long lastCurTime = -1

◆ ledState

int ledState = LOW

◆ loopCounter

unsigned long loopCounter

◆ startTime

unsigned long startTime

◆ updateInterval

const unsigned long updateInterval = 1000

◆ worstTimeDifference

unsigned long worstTimeDifference = 0