File tree Expand file tree Collapse file tree 2 files changed +10
-23
lines changed Expand file tree Collapse file tree 2 files changed +10
-23
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -65,8 +65,12 @@ bool GPSHardware::Handle_GPSConfig(wippersnapper_gps_GPSConfig *gps_config) {
65
65
WS_DEBUG_PRINTLN (" [gps] ERROR: Failed to build PMTK ACK response!" );
66
66
return false ;
67
67
}
68
+ // Flush the RX/TX buffers before sending
69
+ _hw_serial->flush ();
70
+ while (_hw_serial->available () > 0 ) {
71
+ _hw_serial->read ();
72
+ }
68
73
// Send the command to the GPS module
69
- _hw_serial->flush (); // Flush the serial buffer before sending
70
74
_ada_gps->sendCommand (gps_config->commands [i]);
71
75
// and wait for the corresponding response from the GPS module
72
76
if (!_ada_gps->waitForSentence (msg_resp)) {
@@ -169,9 +173,13 @@ bool GPSHardware::DetectMediatek() {
169
173
return false ;
170
174
}
171
175
172
- // Query MediaTek firmware version
176
+ // Clear the tx and rx buffers before sending the command
173
177
_hw_serial->flush ();
178
+ while (_hw_serial->available () > 0 ) {
179
+ _hw_serial->read ();
180
+ }
174
181
_hw_serial->println (CMD_MTK_QUERY_FW);
182
+ // Query MediaTek firmware version
175
183
// Wait for response
176
184
uint16_t timeout = 2000 ; // 1 second timeout
177
185
while (_hw_serial->available () < MAX_NEMA_SENTENCE_LEN && timeout--) {
You can’t perform that action at this time.
0 commit comments