GPS NMEA through NavSatFix

Dependencies:   TinyGPSPlus

Files at this revision

API Documentation at this revision

Comitter:
Luka_Danilovic
Date:
Tue Apr 23 16:02:34 2019 +0000
Parent:
16:394d6b995bf8
Commit message:
Fixed the issue of location not updating when "statCheck" print-out is running

Changed in this revision

PROJ515.cpp Show annotated file Show diff for this revision Revisions of this file
PROJ515.hpp Show annotated file Show diff for this revision Revisions of this file
--- a/PROJ515.cpp	Tue Apr 09 15:59:24 2019 +0000
+++ b/PROJ515.cpp	Tue Apr 23 16:02:34 2019 +0000
@@ -43,7 +43,6 @@
         gps_odom_msg.header.stamp = nh.now();      // Get current time
         
         gps_odom_pub.publish(&gps_odom_msg);       // Publish the Odometry message
-        usbSer.printf("\n>Valid Loc<");            // Print out valid location
     }
 }
 
@@ -101,12 +100,19 @@
 
         if (gpsModule.location.isValid()) {        // If GPS location is Valid
             thread_com.set(PRINT_DATA);            // Set EventFlag to Print Data
-            leds = LEDS_ON;                        // Flash LED bus ON
         }
+        
+        sats_n = gpsModule.satellites.value();     // Aquire satelite number
+        if (sats_n > 0){
+            leds = LEDS_ON;
+            }
 
         if (btn) {                                 // If blue button is pressed
-            sats_n = gpsModule.satellites.value(); // Aquire satelite number
-            usbSer.printf("\nstatChck: %d Satelites", sats_n); // Print Status
+            
+            usbSer.printf("\n\nTimestamp: %d ", nh.now());                  // Print Status: Time Stamp
+            usbSer.printf("\nstatChck: %d Satelites", sats_n);              // Print Status: Satelite Number
+            usbSer.printf("\nstatChck: %f Long", gpsModule.location.lng()); // Print Status: Long
+            usbSer.printf("\nstatChck: %f Lat", gpsModule.location.lat());  // Print Status: Lat
         }
 
     }
--- a/PROJ515.hpp	Tue Apr 09 15:59:24 2019 +0000
+++ b/PROJ515.hpp	Tue Apr 23 16:02:34 2019 +0000
@@ -15,11 +15,11 @@
 #define LEDS_ON  0x07               // LED bus all on
 #define GPS_TX   PC_10              // GPS Transmit Pin
 #define GPS_RX   PC_11              // GPS Recieve  Pin
-#define USB_TX   PC_12              // USB Transmit Pin
-#define USB_RX   PD_2               // USB Recieve  Pin
+#define USB_TX   PD_5               // USB Transmit Pin
+#define USB_RX   PD_6               // USB Recieve  Pin
 
 #define GPS_Baud 9600               // GPS Baud Rate
-#define USB_Baud 9600               // ROS Baud Rate
+#define USB_Baud 9600               // USB Baud Rate
 #define ROS_Baud 921600             // ROS Baud Rate
 #define frameID "gps_odom"          // ROS frame ID