-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGps.h
56 lines (52 loc) · 1.17 KB
/
Gps.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#ifndef Gps_h
#define Gps_h
/*
* gps
*
* Library to manage a gps device
*
* Greg Cope <[email protected]>
*
*/
#include <Arduino.h>
// https://github.com/mikalhart/TinyGPSPlus/releases
#include <TinyGPS++.h>
#include "Sleep.h"
// debug functions
#define DEBUG(input) {Serial.print(input); Serial.flush();}
#define DEBUGln(input) {Serial.println(input); Serial.flush();}
#define ACCEPTABLE_GPS_HDOP_FOR_FIX 160
#define GOOD_GPS_HDOP_FOR_FIX 145
class Gps
{
public:
Gps(byte pin);
boolean on(void);
void off(void);
boolean isOn(void);
boolean updateFix(unsigned long);
unsigned long getInitialFix(unsigned long);
// Sleep sleep;
private:
int _powerPin;
boolean _powerState;
boolean nmeaOutput;
int nmeaUpdated;
unsigned long nmeaTimeoutMs;
boolean serial1Output;
unsigned long gpsFixTimeoutMs;
unsigned long gpsTimerStart;
unsigned long gpsTimeToFixMs;
boolean gpsFix;
boolean gpsFixTimeoutReached;
void setupGPS(void);
boolean drainNmea(void);
void printGPSData(void);
int initialHDOP;
int finalHDOP;
int hdop;
TinyGPSPlus nmea;
Sleep sleep;
//int nmeaUpdated;
};
#endif