Skip to content

Commit b26776b

Browse files
committed
Fix - ESP8266 Platform Build
1 parent 1d9ab75 commit b26776b

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

src/components/gps/model.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,7 @@ wippersnapper_gps_GPSConfig *GPSModel::GetGPSConfigMsg() {
5757
void GPSModel::CreateGPSEvent() {
5858
// Zero-out whatever was previously in the GPSEvent message
5959
memset(&_msg_gps_event, 0, sizeof(_msg_gps_event));
60-
// Create new GPSEvent message with initializer
61-
_msg_gps_event = wippersnapper_gps_GPSEvent_init_zero;
60+
// Already zeroed out by memset, just set the counts
6261
_msg_gps_event.gga_responses_count = 0;
6362
_msg_gps_event.rmc_responses_count = 0;
6463
}
@@ -124,7 +123,7 @@ bool GPSModel::AddGpsEventRMC(wippersnapper_gps_GPSDateTime datetime,
124123

125124
// Always store at index 0, overwriting any previous response
126125
wippersnapper_gps_GPSRMCResponse rmc_response;
127-
rmc_response = wippersnapper_gps_GPSRMCResponse_init_zero;
126+
memset(&rmc_response, 0, sizeof(rmc_response));
128127
rmc_response.has_datetime = true;
129128
rmc_response.datetime = datetime;
130129

@@ -164,7 +163,7 @@ bool GPSModel::AddGpsEventGGA(wippersnapper_gps_GPSDateTime datetime,
164163
return false;
165164

166165
wippersnapper_gps_GPGGAResponse gga_response;
167-
gga_response = wippersnapper_gps_GPGGAResponse_init_zero;
166+
memset(&gga_response, 0, sizeof(gga_response));
168167
gga_response.has_datetime = true;
169168
gga_response.datetime = datetime;
170169

src/components/uart/drivers/drvUartPm25.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ class drvUartPm25 : public drvUartBase {
5757
drvUartPm25(SoftwareSerial *sw_serial,
5858
wippersnapper_uart_UartDeviceType device_type,
5959
const char *driver_name, uint32_t port_num)
60-
: drvUartBase(sw_serial, device_type, driver_name, port_num) {
61-
// Handled by drvUartBase constructor
60+
: drvUartBase(sw_serial, driver_name, port_num) {
61+
_device_type = device_type; // Set device type after base constructor
6262
}
6363
#endif // HAS_SW_SERIAL
6464

src/components/uart/hardware.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,13 @@ bool UARTHardware::ConfigureSerial() {
144144
#else
145145
// ESP8266, SAMD, and other platforms
146146
// take the default Arduino/Wiring API arguments
147+
#ifdef ARDUINO_ARCH_ESP8266
148+
// We want to pass the cfg as an enum for ESP8266
149+
_hwSerial->begin((unsigned long)_config.baud_rate, (SerialConfig)cfg);
150+
#else
151+
// We want to cast the cfg for other platforms
147152
_hwSerial->begin((unsigned long)_config.baud_rate, (uint32_t)cfg);
153+
#endif
148154
#endif
149155
_baud_rate = _config.baud_rate;
150156
}

0 commit comments

Comments
 (0)