Skip to content

Commit 7d22453

Browse files
committed
GPS - discard parse errors
1 parent 881e47a commit 7d22453

File tree

2 files changed

+11
-12
lines changed

2 files changed

+11
-12
lines changed

src/components/gps/controller.cpp

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,6 @@ int GPSController::NmeaBufPush(const char *new_sentence) {
9191
strncpy(_nmea_buff.sentences[_nmea_buff.head], new_sentence,
9292
MAX_LEN_NMEA_SENTENCE - 1);
9393
_nmea_buff.sentences[_nmea_buff.head][MAX_LEN_NMEA_SENTENCE - 1] = '\0';
94-
WS_DEBUG_PRINT("[gps] Pushing NMEA sentence: ");
95-
WS_DEBUG_PRINTLN(_nmea_buff.sentences[_nmea_buff.head]);
9694
_nmea_buff.head = next;
9795
return 0;
9896
}
@@ -130,12 +128,13 @@ void GPSController::update() {
130128

131129
for (GPSHardware *drv : _gps_drivers) {
132130

131+
// TODO: Commented out due to parsing failures, stability issue (failed to parse NMEA acks for this)
133132
// Perform a keep-alive check by sending an antenna check command every 2
134133
// seconds
135-
if (millis() - drv->GetPrvKat() > 2000) {
134+
/* if (millis() - drv->GetPrvKat() > 2000) {
136135
drv->GetAdaGps()->sendCommand(CMD_MTK_CHECK_ANTENNA);
137136
drv->SetPrvKat(millis());
138-
}
137+
} */
139138

140139
// Did read period elapse?
141140
ulong cur_time = millis();
@@ -179,9 +178,6 @@ void GPSController::update() {
179178
// Check if we have a new NMEA sentence
180179
if (drv->GetAdaGps()->newNMEAreceived()) {
181180
// If we have a new sentence, push it to the buffer
182-
// TODO: Check result of this operation actually
183-
WS_DEBUG_PRINTLN("[gps] New data, pushing sentence to buffer.");
184-
// Push the last NMEA sentence to the buffer
185181
char *last_nmea = drv->GetAdaGps()->lastNMEA();
186182
NmeaBufPush(drv->GetAdaGps()->lastNMEA());
187183
}
@@ -201,11 +197,10 @@ void GPSController::update() {
201197
// Parse the NMEA sentence
202198
WS_DEBUG_PRINT("[gps] Parsing NMEA sentence: ");
203199
WS_DEBUG_PRINTLN(nmea_sentence);
204-
if (!drv->GetAdaGps()->parse(nmea_sentence)) {
205-
WS_DEBUG_PRINT("[gps] ERROR: Failed to parse NMEA sentence: ");
206-
WS_DEBUG_PRINTLN(nmea_sentence);
207-
continue; // Skip this driver if parsing failed
208-
}
200+
if (!drv->GetAdaGps()->parse(nmea_sentence))
201+
continue; // Skip parsing this sentence if parsing failed
202+
203+
// Print the parsed data for debugging
209204
Serial.print("Fix: ");
210205
Serial.print((int)drv->GetAdaGps()->fix);
211206
Serial.print(" quality: ");
@@ -228,6 +223,8 @@ void GPSController::update() {
228223
Serial.print("Antenna status: ");
229224
Serial.println((int)drv->GetAdaGps()->antenna);
230225
}
226+
227+
// TODO: Okay so here we are going to create the model of gps data
231228
}
232229
WS_DEBUG_PRINTLN("[gps] Finished processing NMEA sentences.");
233230
// TODO: Successfully parsed the NMEA sentence, update the model

src/components/uart/controller.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ bool UARTController::Handle_UartAdd(pb_istream_t *stream) {
5454
}
5555

5656
// Configure a UART hardware instance using the provided serial configuration
57+
// TODO: Have we already configured this UART hardware instance?!
5758
WS_DEBUG_PRINTLN("[uart] Configuring UART hardware instance...");
5859
wippersnapper_uart_UartSerialConfig cfg_serial = add_msg->cfg_serial;
5960
UARTHardware *uart_hardware = new UARTHardware(cfg_serial);
@@ -68,6 +69,7 @@ bool UARTController::Handle_UartAdd(pb_istream_t *stream) {
6869
WS_DEBUG_PRINTLN("[uart] UART hardware instance configured successfully!");
6970

7071
// Create a new UartDevice "driver" on the hardware layer (UARTHardware)
72+
// TODO: Have we already added this UART device?!
7173
drvUartBase *uart_driver = nullptr;
7274
GPSController *drv_uart_gps = nullptr;
7375
bool is_gps_drv = false;

0 commit comments

Comments
 (0)