-
Notifications
You must be signed in to change notification settings - Fork 79
Expand file tree
/
Copy pathLatitude.cpp
More file actions
41 lines (34 loc) · 1.09 KB
/
Latitude.cpp
File metadata and controls
41 lines (34 loc) · 1.09 KB
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
#include "../Configuration.hpp"
#include "Utility.hpp"
#include "Latitude.hpp"
//////////////////////////////////////////////////////////////////////////////////////
//
// Latitude — Arduino-dependent overlay methods
// Pure arithmetic is in core::Latitude (src/core/types/Latitude.hpp/.cpp)
//
// 90 is north pole, -90 is south pole
Latitude::Latitude(const Latitude &other) : core::Latitude(other)
{
}
Latitude::Latitude(int h, int m, int s) : core::Latitude(h, m, s)
{
}
Latitude::Latitude(float inDegrees) : core::Latitude(inDegrees)
{
}
char achBufLat[32];
const char *Latitude::ToString() const
{
return core::DayTime::formatString(achBufLat, "{+}{d}:{m}:{s}");
}
Latitude Latitude::ParseFromMeade(String const &s)
{
Latitude result(0.0);
LOG(DEBUG_MEADE, "[LATITUDE]: Latitude.Parse(%s)", s.c_str());
// Use the DayTime code to parse it.
::DayTime dt = ::DayTime::ParseFromMeade(s);
result.totalSeconds = dt.getTotalSeconds();
result.checkHours();
LOG(DEBUG_MEADE, "[LATITUDE]: Latitude.Parse(%s) -> %s", s.c_str(), result.ToString());
return result;
}