-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathSunCalc.h
61 lines (48 loc) · 1.26 KB
/
SunCalc.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
57
58
59
60
61
////////////////////////////////////////////////////////////
// Sun Calc
////////////////////////////////////////////////////////////
#ifndef SunCalc_h
#define SunCalc_h
////////////////////////////////////////////////////////////
// Use GPS data to calculate sunrise, sunset, and current times.
// Times are in UTC and represented as float with hour in the
// integer and decimal hours instead of minutes in the fractional.
// ie 11:30 AM (UTC) is represented as 11.50, 11:45 AM (UTC)
// is represented as 11.75, and so on.
////////////////////////////////////////////////////////////
#define CSunCalc_INVALID_TIME (-999)
class CSunCalc
{
protected:
double m_currentTime;
double m_sunriseTime; // Civil
double m_sunsetTime; // Civil
public:
CSunCalc();
virtual ~CSunCalc();
bool isValidTime(float _t)
{
if((_t >= 0) && (_t < 24.))
return true;
return false;
}
double getCurrentTime()
{
return m_currentTime;
}
double getSunriseTime()
{
return m_sunriseTime;
}
double getSunsetTime()
{
return m_sunsetTime;
}
bool processGPSData(CGPSParserData &_gpsData);
void sendTelemetry();
};
// Deal with rolling to the next day
void normalizeTime(double &_t);
// Check time ranges
bool timeIsBetween(double _currentTime, double _first, double _second);
#endif