2021 mbed Grove GPS

Dependents:   er4_2022

Revision:
3:037ec2b52d31
Parent:
2:82fce70de15f
Child:
4:0ee729b4a211
--- a/GroveGPS.h	Tue Jun 04 21:06:20 2019 +0000
+++ b/GroveGPS.h	Thu Jun 06 20:17:47 2019 -0500
@@ -18,6 +18,11 @@
 		} else {
 			_last_line += newCharacter;
 		}
+
+		if (_last_line.length() > max_line_length) {
+		    error("GPS error - line too long");
+		    _last_line = "";
+		}
 	}
 
 	struct GGA {
@@ -70,6 +75,7 @@
         
 
 private:
+    static const size_t max_line_length = 1024;
 	std::string _last_line;
     Thread serial_thread;
     Serial gps_serial;