@@ -68,20 +68,17 @@ bool GPSHardware::Handle_GPSConfig(wippersnapper_gps_GPSConfig *gps_config) {
68
68
return false ;
69
69
}
70
70
71
- // Delay for two seconds to allow the GPS module to initialize
72
- WS_DEBUG_PRINTLN (" [gps] Delaying for 1 second" );
73
- delay (1000 );
74
71
// Iterate through the command sentences and send them to the GPS module
75
72
// TODO: We may want to break this out into a generic function that supports
76
73
// MTK, Ublox, etc...
77
74
for (size_t i = 0 ; i < gps_config->commands_count ; i++) {
78
75
// Build the PMTK ACK response for the command
79
76
char msg_resp[MAX_NEMA_SENTENCE_LEN];
80
- WS_DEBUG_PRINT (" [gps] Building PMTK ACK response: " );
81
77
if (!BuildPmtkAck (gps_config->commands [i], msg_resp)) {
82
78
WS_DEBUG_PRINTLN (" [gps] ERROR: Failed to build PMTK ACK response!" );
83
79
return false ;
84
80
}
81
+ WS_DEBUG_PRINT (" [gps] Expected response: " );
85
82
WS_DEBUG_PRINTLN (msg_resp);
86
83
if (_iface_type == GPS_IFACE_UART_HW) {
87
84
// Flush the RX/TX buffers before sending
@@ -90,13 +87,15 @@ bool GPSHardware::Handle_GPSConfig(wippersnapper_gps_GPSConfig *gps_config) {
90
87
_hw_serial->read ();
91
88
}
92
89
} else if (_iface_type == GPS_IFACE_I2C) {
90
+ WS_DEBUG_PRINT (" [gps] Flushing I2C buffers..." );
93
91
I2cReadDiscard ();
92
+ WS_DEBUG_PRINTLN (" done!" );
94
93
}
95
- WS_DEBUG_PRINT (" [gps] Sending command to MediaTek GPS : " );
94
+ WS_DEBUG_PRINT (" [gps] TX, CMD : " );
96
95
WS_DEBUG_PRINTLN (gps_config->commands [i]);
97
96
// Send the command to the GPS module
98
97
_ada_gps->sendCommand (gps_config->commands [i]);
99
- WS_DEBUG_PRINTLN (" [gps] Command sent, waiting for response ..." );
98
+ WS_DEBUG_PRINTLN (" [gps] Waiting for RX ..." );
100
99
// and wait for the corresponding response from the GPS module
101
100
if (!_ada_gps->waitForSentence (msg_resp, 255 )) {
102
101
WS_DEBUG_PRINT (" [gps] ERROR: Failed to get response | cmd:" );
@@ -288,7 +287,6 @@ bool GPSHardware::BuildPmtkAck(char *msg_cmd, char *msg_resp) {
288
287
if (sscanf (msg_cmd, " $PMTK%d" , &cmd_num) != 1 )
289
288
return false ;
290
289
snprintf (msg_resp, MAX_NEMA_SENTENCE_LEN, " $PMTK001,%d,3" , cmd_num);
291
- _ada_gps->addChecksum (msg_resp);
292
290
return true ;
293
291
}
294
292
0 commit comments