Skip to content

Commit 336a670

Browse files
committed
Fix build errors for ESP8266 and PICOW platforms
- Replace aggregate initializers with memset for ESP8266 compatibility - Add platform guards for PICOW boards that lack baudRate() method - Use default 9600 baud for PICOW GPS initialization
1 parent 9085838 commit 336a670

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/components/gps/hardware.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,12 @@ bool GPSHardware::DetectMtkUart() {
357357

358358
// Attempt to use Adafruit_GPS
359359
_ada_gps = new Adafruit_GPS(_hw_serial);
360+
#if defined(ARDUINO_RASPBERRY_PI_PICO_W) || defined(ARDUINO_RASPBERRY_PI_PICO_2W)
361+
// PICOW doesn't have baudRate() method, use default baud
362+
if (!_ada_gps->begin(9600)) {
363+
#else
360364
if (!_ada_gps->begin(_hw_serial->baudRate())) {
365+
#endif
361366
WS_DEBUG_PRINTLN("[gps] ERROR: Failed to initialize Mediatek!");
362367
return false;
363368
}

src/components/gps/model.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ bool GPSModel::AddGpsEventRMC(wippersnapper_gps_GPSDateTime datetime,
122122

123123
// Always store at index 0, overwriting any previous response
124124
wippersnapper_gps_GPSRMCResponse rmc_response;
125-
rmc_response = wippersnapper_gps_GPSRMCResponse_init_zero;
125+
memset(&rmc_response, 0, sizeof(rmc_response));
126126
rmc_response.has_datetime = true;
127127
rmc_response.datetime = datetime;
128128

0 commit comments

Comments
 (0)