[GPS] Fix running out of memory when no GPS data is received.

The log string was extended over 80 bytes when occasional bogus data was read, but no valid NMEA sentence, thus filling up the RAM.
This commit is contained in:
TD-er
2021-03-14 15:01:41 +01:00
parent 6b11c52c99
commit 44f13734bc
2 changed files with 6 additions and 2 deletions
+4 -1
View File
@@ -78,7 +78,10 @@ bool P082_data_struct::loop() {
--available;
char c = easySerial->read();
# ifdef P082_SEND_GPS_TO_LOG
_currentSentence += c;
if (_currentSentence.length() <= 80) {
// No need to capture more than 80 bytes as a NMEA message is never that long.
_currentSentence += c;
}
# endif // ifdef P082_SEND_GPS_TO_LOG
if (gps->encode(c)) {
+2 -1
View File
@@ -7,8 +7,9 @@
# include <TinyGPS++.h>
# include <ESPeasySerial.h>
#ifndef LIMIT_BUILD_SIZE
# define P082_SEND_GPS_TO_LOG
#endif
# define P082_TIMESTAMP_AGE 1500
# define P082_DEFAULT_FIX_TIMEOUT 2500 // TTL of fix status in ms since last update