Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions src/helpers/sensors/MicroNMEALocationProvider.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,12 @@
#endif

class MicroNMEALocationProvider : public LocationProvider {
char _nmeaBuffer[100];
// MicroNMEA never writes past the length it is given, but its fixed-width field
// skips can read a few bytes past the end of a malformed sentence. The zeroed tail
// lets those reads stop on NUL bytes instead of reading the members that follow.
static constexpr size_t NMEA_BUFFER_LEN = 100;
static constexpr size_t NMEA_BUFFER_TAIL = 16;
char _nmeaBuffer[NMEA_BUFFER_LEN + NMEA_BUFFER_TAIL] = {};
MicroNMEA nmea;
mesh::RTCClock* _clock;
NmeaGpsDriver* _driver;
Expand Down Expand Up @@ -135,7 +140,7 @@ class MicroNMEALocationProvider : public LocationProvider {

public:
MicroNMEALocationProvider(NmeaGpsDriver& driver, mesh::RTCClock* clock = nullptr)
: nmea(_nmeaBuffer, sizeof(_nmeaBuffer)), _clock(clock), _driver(&driver) {}
: nmea(_nmeaBuffer, NMEA_BUFFER_LEN), _clock(clock), _driver(&driver) {}

void begin() override {
_begin_calls++;
Expand Down
Loading