diff --git a/src/multi-tracker.cpp b/src/multi-tracker.cpp index ec9f2d5..46f9823 100644 --- a/src/multi-tracker.cpp +++ b/src/multi-tracker.cpp @@ -167,6 +167,21 @@ void Radio_Main(MSG *msg_out, MSG *msg_in) { } +//Returns the result type and updates the global values(coordinates). +uint8_t GPS_GetCoordinates() { + Serial.println("GPS_GetCoordinates()"); + if (!gpsSerial.available()) { + Serial.println("INFO: GPS not availble."); + return NoReply; + } + gps.encode(gpsSerial.read()); // Decode the GPS data + if (gps.location.isValid()) { // Check if GPS location data is valid + msg_out.latitude = gps.location.lat(); + msg_out.longitude = gps.location.lat(); + } + + return Ok; +} void setup(void) { // Initialize Serial Communication for debugging