@@ -127,7 +127,7 @@ bool nmea_handshake(const char *req, const char *resp, bool skipline)
127127
128128 /* skip first line when expected response contains 2 of them */
129129 if (skipline) {
130- // start_time = millis();
130+ start_time = millis ();
131131 while (Serial_GNSS_In.read () != ' \n ' && (millis () - start_time) < timeout_ms) { yield (); }
132132 }
133133
@@ -1152,7 +1152,7 @@ const gnss_chip_ops_t uc65_ops = {
11521152static gnss_id_t ag33_probe ()
11531153{
11541154 /* Firmware version request */
1155- return nmea_handshake (" $PAIR021*39\r\n " , " $PAIR021, " , true ) ?
1155+ return nmea_handshake (" $PAIR021*39\r\n " , " $PAIR001,021 " , false ) ?
11561156 GNSS_MODULE_AG33 : GNSS_MODULE_NMEA;
11571157}
11581158
@@ -1161,21 +1161,30 @@ extern gnss_chip_ops_t ag33_ops;
11611161static bool ag33_setup ()
11621162{
11631163#if !defined(EXCLUDE_LOG_GNSS_VERSION)
1164+ int i=0 ;
1165+ char c;
1166+ unsigned long timeout_ms = 2000 ;
1167+
11641168 while (Serial_GNSS_In.available () > 0 ) { Serial_GNSS_In.read (); }
11651169
1170+ unsigned long start_time = millis ();
1171+
1172+ while ((millis () - start_time) < timeout_ms) {
1173+ c = Serial_GNSS_In.read ();
1174+ if (c == ' \n ' ) break ;
1175+ }
1176+
11661177 Serial_GNSS_Out.write (" $PAIR021*39\r\n " );
11671178
1168- int i=0 ;
1169- char c;
1170- unsigned long start_time = millis ();
1179+ start_time = millis ();
11711180
1172- while ((millis () - start_time) < 2000 ) {
1181+ while ((millis () - start_time) < timeout_ms ) {
11731182 c = Serial_GNSS_In.read ();
11741183 if (c == ' \n ' ) break ;
11751184 }
11761185
11771186 /* take response into buffer */
1178- while ((millis () - start_time) < 2000 ) {
1187+ while ((millis () - start_time) < timeout_ms ) {
11791188
11801189 c = Serial_GNSS_In.read ();
11811190
0 commit comments