diff --git a/examples/ArduinoLoRa/LoRaReceiver/LoRaBoards.cpp b/examples/ArduinoLoRa/LoRaReceiver/LoRaBoards.cpp index 8c90174..f5948b4 100644 --- a/examples/ArduinoLoRa/LoRaReceiver/LoRaBoards.cpp +++ b/examples/ArduinoLoRa/LoRaReceiver/LoRaBoards.cpp @@ -914,43 +914,43 @@ bool beginGPS() SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); bool result = false; uint32_t startTimeout ; - for (int i = 0; i < 3; ++i) { - SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); - delay(5); - // Get version information - startTimeout = millis() + 3000; - Serial.print("Try to init L76K . Wait stop ."); + SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); + delay(5); + // Get version information + startTimeout = millis() + 3000; + Serial.print("Try to init L76K . Wait stop ."); + SerialGPS.flush(); + + while (SerialGPS.available()) { + // Serial.print("."); + Serial.flush(); SerialGPS.flush(); - while (SerialGPS.available()) { - Serial.print("."); - SerialGPS.readString(); - if (millis() > startTimeout) { - Serial.println("Wait L76K stop NMEA timeout!"); - return false; - } - }; - Serial.println(); - SerialGPS.flush(); - delay(200); - - SerialGPS.write("$PCAS06,0*1B\r\n"); - startTimeout = millis() + 500; - String ver = ""; - while (!SerialGPS.available()) { - if (millis() > startTimeout) { - Serial.println("Get L76K timeout!"); - return false; - } + if (millis() > startTimeout) { + Serial.println("Wait L76K stop NMEA timeout!"); + return false; } - SerialGPS.setTimeout(10); - ver = SerialGPS.readStringUntil('\n'); - if (ver.startsWith("$GPTXT,01,01,02")) { - Serial.println("L76K GNSS init succeeded, using L76K GNSS Module\n"); - result = true; - break; + }; + Serial.println(); + SerialGPS.flush(); + delay(200); + + SerialGPS.write("$PCAS06,0*1B\r\n"); + startTimeout = millis() + 500; + String ver = ""; + while (!SerialGPS.available()) { + if (millis() > startTimeout) { + Serial.println("Get L76K timeout!"); + return false; } - delay(500); } + SerialGPS.setTimeout(10); + ver = SerialGPS.readStringUntil('\n'); + if (ver.startsWith("$GPTXT,01,01,02")) { + Serial.println("L76K GNSS init succeeded, using L76K GNSS Module\n"); + result = true; + } + delay(500); + // Initialize the L76K Chip, use GPS + GLONASS SerialGPS.write("$PCAS04,5*1C\r\n"); delay(250); diff --git a/examples/ArduinoLoRa/LoRaSender/LoRaBoards.cpp b/examples/ArduinoLoRa/LoRaSender/LoRaBoards.cpp index 8c90174..f5948b4 100644 --- a/examples/ArduinoLoRa/LoRaSender/LoRaBoards.cpp +++ b/examples/ArduinoLoRa/LoRaSender/LoRaBoards.cpp @@ -914,43 +914,43 @@ bool beginGPS() SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); bool result = false; uint32_t startTimeout ; - for (int i = 0; i < 3; ++i) { - SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); - delay(5); - // Get version information - startTimeout = millis() + 3000; - Serial.print("Try to init L76K . Wait stop ."); + SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); + delay(5); + // Get version information + startTimeout = millis() + 3000; + Serial.print("Try to init L76K . Wait stop ."); + SerialGPS.flush(); + + while (SerialGPS.available()) { + // Serial.print("."); + Serial.flush(); SerialGPS.flush(); - while (SerialGPS.available()) { - Serial.print("."); - SerialGPS.readString(); - if (millis() > startTimeout) { - Serial.println("Wait L76K stop NMEA timeout!"); - return false; - } - }; - Serial.println(); - SerialGPS.flush(); - delay(200); - - SerialGPS.write("$PCAS06,0*1B\r\n"); - startTimeout = millis() + 500; - String ver = ""; - while (!SerialGPS.available()) { - if (millis() > startTimeout) { - Serial.println("Get L76K timeout!"); - return false; - } + if (millis() > startTimeout) { + Serial.println("Wait L76K stop NMEA timeout!"); + return false; } - SerialGPS.setTimeout(10); - ver = SerialGPS.readStringUntil('\n'); - if (ver.startsWith("$GPTXT,01,01,02")) { - Serial.println("L76K GNSS init succeeded, using L76K GNSS Module\n"); - result = true; - break; + }; + Serial.println(); + SerialGPS.flush(); + delay(200); + + SerialGPS.write("$PCAS06,0*1B\r\n"); + startTimeout = millis() + 500; + String ver = ""; + while (!SerialGPS.available()) { + if (millis() > startTimeout) { + Serial.println("Get L76K timeout!"); + return false; } - delay(500); } + SerialGPS.setTimeout(10); + ver = SerialGPS.readStringUntil('\n'); + if (ver.startsWith("$GPTXT,01,01,02")) { + Serial.println("L76K GNSS init succeeded, using L76K GNSS Module\n"); + result = true; + } + delay(500); + // Initialize the L76K Chip, use GPS + GLONASS SerialGPS.write("$PCAS04,5*1C\r\n"); delay(250); diff --git a/examples/BPFFactory/LoRaBoards.cpp b/examples/BPFFactory/LoRaBoards.cpp index 8c90174..f5948b4 100644 --- a/examples/BPFFactory/LoRaBoards.cpp +++ b/examples/BPFFactory/LoRaBoards.cpp @@ -914,43 +914,43 @@ bool beginGPS() SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); bool result = false; uint32_t startTimeout ; - for (int i = 0; i < 3; ++i) { - SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); - delay(5); - // Get version information - startTimeout = millis() + 3000; - Serial.print("Try to init L76K . Wait stop ."); + SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); + delay(5); + // Get version information + startTimeout = millis() + 3000; + Serial.print("Try to init L76K . Wait stop ."); + SerialGPS.flush(); + + while (SerialGPS.available()) { + // Serial.print("."); + Serial.flush(); SerialGPS.flush(); - while (SerialGPS.available()) { - Serial.print("."); - SerialGPS.readString(); - if (millis() > startTimeout) { - Serial.println("Wait L76K stop NMEA timeout!"); - return false; - } - }; - Serial.println(); - SerialGPS.flush(); - delay(200); - - SerialGPS.write("$PCAS06,0*1B\r\n"); - startTimeout = millis() + 500; - String ver = ""; - while (!SerialGPS.available()) { - if (millis() > startTimeout) { - Serial.println("Get L76K timeout!"); - return false; - } + if (millis() > startTimeout) { + Serial.println("Wait L76K stop NMEA timeout!"); + return false; } - SerialGPS.setTimeout(10); - ver = SerialGPS.readStringUntil('\n'); - if (ver.startsWith("$GPTXT,01,01,02")) { - Serial.println("L76K GNSS init succeeded, using L76K GNSS Module\n"); - result = true; - break; + }; + Serial.println(); + SerialGPS.flush(); + delay(200); + + SerialGPS.write("$PCAS06,0*1B\r\n"); + startTimeout = millis() + 500; + String ver = ""; + while (!SerialGPS.available()) { + if (millis() > startTimeout) { + Serial.println("Get L76K timeout!"); + return false; } - delay(500); } + SerialGPS.setTimeout(10); + ver = SerialGPS.readStringUntil('\n'); + if (ver.startsWith("$GPTXT,01,01,02")) { + Serial.println("L76K GNSS init succeeded, using L76K GNSS Module\n"); + result = true; + } + delay(500); + // Initialize the L76K Chip, use GPS + GLONASS SerialGPS.write("$PCAS04,5*1C\r\n"); delay(250); diff --git a/examples/Display/Free_Font_Demo/LoRaBoards.cpp b/examples/Display/Free_Font_Demo/LoRaBoards.cpp index 8c90174..f5948b4 100644 --- a/examples/Display/Free_Font_Demo/LoRaBoards.cpp +++ b/examples/Display/Free_Font_Demo/LoRaBoards.cpp @@ -914,43 +914,43 @@ bool beginGPS() SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); bool result = false; uint32_t startTimeout ; - for (int i = 0; i < 3; ++i) { - SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); - delay(5); - // Get version information - startTimeout = millis() + 3000; - Serial.print("Try to init L76K . Wait stop ."); + SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); + delay(5); + // Get version information + startTimeout = millis() + 3000; + Serial.print("Try to init L76K . Wait stop ."); + SerialGPS.flush(); + + while (SerialGPS.available()) { + // Serial.print("."); + Serial.flush(); SerialGPS.flush(); - while (SerialGPS.available()) { - Serial.print("."); - SerialGPS.readString(); - if (millis() > startTimeout) { - Serial.println("Wait L76K stop NMEA timeout!"); - return false; - } - }; - Serial.println(); - SerialGPS.flush(); - delay(200); - - SerialGPS.write("$PCAS06,0*1B\r\n"); - startTimeout = millis() + 500; - String ver = ""; - while (!SerialGPS.available()) { - if (millis() > startTimeout) { - Serial.println("Get L76K timeout!"); - return false; - } + if (millis() > startTimeout) { + Serial.println("Wait L76K stop NMEA timeout!"); + return false; } - SerialGPS.setTimeout(10); - ver = SerialGPS.readStringUntil('\n'); - if (ver.startsWith("$GPTXT,01,01,02")) { - Serial.println("L76K GNSS init succeeded, using L76K GNSS Module\n"); - result = true; - break; + }; + Serial.println(); + SerialGPS.flush(); + delay(200); + + SerialGPS.write("$PCAS06,0*1B\r\n"); + startTimeout = millis() + 500; + String ver = ""; + while (!SerialGPS.available()) { + if (millis() > startTimeout) { + Serial.println("Get L76K timeout!"); + return false; } - delay(500); } + SerialGPS.setTimeout(10); + ver = SerialGPS.readStringUntil('\n'); + if (ver.startsWith("$GPTXT,01,01,02")) { + Serial.println("L76K GNSS init succeeded, using L76K GNSS Module\n"); + result = true; + } + delay(500); + // Initialize the L76K Chip, use GPS + GLONASS SerialGPS.write("$PCAS04,5*1C\r\n"); delay(250); diff --git a/examples/Display/TBeam_TFT_Shield/LoRaBoards.cpp b/examples/Display/TBeam_TFT_Shield/LoRaBoards.cpp index 8c90174..f5948b4 100644 --- a/examples/Display/TBeam_TFT_Shield/LoRaBoards.cpp +++ b/examples/Display/TBeam_TFT_Shield/LoRaBoards.cpp @@ -914,43 +914,43 @@ bool beginGPS() SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); bool result = false; uint32_t startTimeout ; - for (int i = 0; i < 3; ++i) { - SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); - delay(5); - // Get version information - startTimeout = millis() + 3000; - Serial.print("Try to init L76K . Wait stop ."); + SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); + delay(5); + // Get version information + startTimeout = millis() + 3000; + Serial.print("Try to init L76K . Wait stop ."); + SerialGPS.flush(); + + while (SerialGPS.available()) { + // Serial.print("."); + Serial.flush(); SerialGPS.flush(); - while (SerialGPS.available()) { - Serial.print("."); - SerialGPS.readString(); - if (millis() > startTimeout) { - Serial.println("Wait L76K stop NMEA timeout!"); - return false; - } - }; - Serial.println(); - SerialGPS.flush(); - delay(200); - - SerialGPS.write("$PCAS06,0*1B\r\n"); - startTimeout = millis() + 500; - String ver = ""; - while (!SerialGPS.available()) { - if (millis() > startTimeout) { - Serial.println("Get L76K timeout!"); - return false; - } + if (millis() > startTimeout) { + Serial.println("Wait L76K stop NMEA timeout!"); + return false; } - SerialGPS.setTimeout(10); - ver = SerialGPS.readStringUntil('\n'); - if (ver.startsWith("$GPTXT,01,01,02")) { - Serial.println("L76K GNSS init succeeded, using L76K GNSS Module\n"); - result = true; - break; + }; + Serial.println(); + SerialGPS.flush(); + delay(200); + + SerialGPS.write("$PCAS06,0*1B\r\n"); + startTimeout = millis() + 500; + String ver = ""; + while (!SerialGPS.available()) { + if (millis() > startTimeout) { + Serial.println("Get L76K timeout!"); + return false; } - delay(500); } + SerialGPS.setTimeout(10); + ver = SerialGPS.readStringUntil('\n'); + if (ver.startsWith("$GPTXT,01,01,02")) { + Serial.println("L76K GNSS init succeeded, using L76K GNSS Module\n"); + result = true; + } + delay(500); + // Initialize the L76K Chip, use GPS + GLONASS SerialGPS.write("$PCAS04,5*1C\r\n"); delay(250); diff --git a/examples/Display/TFT_Char_times/LoRaBoards.cpp b/examples/Display/TFT_Char_times/LoRaBoards.cpp index 8c90174..f5948b4 100644 --- a/examples/Display/TFT_Char_times/LoRaBoards.cpp +++ b/examples/Display/TFT_Char_times/LoRaBoards.cpp @@ -914,43 +914,43 @@ bool beginGPS() SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); bool result = false; uint32_t startTimeout ; - for (int i = 0; i < 3; ++i) { - SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); - delay(5); - // Get version information - startTimeout = millis() + 3000; - Serial.print("Try to init L76K . Wait stop ."); + SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); + delay(5); + // Get version information + startTimeout = millis() + 3000; + Serial.print("Try to init L76K . Wait stop ."); + SerialGPS.flush(); + + while (SerialGPS.available()) { + // Serial.print("."); + Serial.flush(); SerialGPS.flush(); - while (SerialGPS.available()) { - Serial.print("."); - SerialGPS.readString(); - if (millis() > startTimeout) { - Serial.println("Wait L76K stop NMEA timeout!"); - return false; - } - }; - Serial.println(); - SerialGPS.flush(); - delay(200); - - SerialGPS.write("$PCAS06,0*1B\r\n"); - startTimeout = millis() + 500; - String ver = ""; - while (!SerialGPS.available()) { - if (millis() > startTimeout) { - Serial.println("Get L76K timeout!"); - return false; - } + if (millis() > startTimeout) { + Serial.println("Wait L76K stop NMEA timeout!"); + return false; } - SerialGPS.setTimeout(10); - ver = SerialGPS.readStringUntil('\n'); - if (ver.startsWith("$GPTXT,01,01,02")) { - Serial.println("L76K GNSS init succeeded, using L76K GNSS Module\n"); - result = true; - break; + }; + Serial.println(); + SerialGPS.flush(); + delay(200); + + SerialGPS.write("$PCAS06,0*1B\r\n"); + startTimeout = millis() + 500; + String ver = ""; + while (!SerialGPS.available()) { + if (millis() > startTimeout) { + Serial.println("Get L76K timeout!"); + return false; } - delay(500); } + SerialGPS.setTimeout(10); + ver = SerialGPS.readStringUntil('\n'); + if (ver.startsWith("$GPTXT,01,01,02")) { + Serial.println("L76K GNSS init succeeded, using L76K GNSS Module\n"); + result = true; + } + delay(500); + // Initialize the L76K Chip, use GPS + GLONASS SerialGPS.write("$PCAS04,5*1C\r\n"); delay(250); diff --git a/examples/Display/UTFT_demo/LoRaBoards.cpp b/examples/Display/UTFT_demo/LoRaBoards.cpp index 8c90174..f5948b4 100644 --- a/examples/Display/UTFT_demo/LoRaBoards.cpp +++ b/examples/Display/UTFT_demo/LoRaBoards.cpp @@ -914,43 +914,43 @@ bool beginGPS() SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); bool result = false; uint32_t startTimeout ; - for (int i = 0; i < 3; ++i) { - SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); - delay(5); - // Get version information - startTimeout = millis() + 3000; - Serial.print("Try to init L76K . Wait stop ."); + SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); + delay(5); + // Get version information + startTimeout = millis() + 3000; + Serial.print("Try to init L76K . Wait stop ."); + SerialGPS.flush(); + + while (SerialGPS.available()) { + // Serial.print("."); + Serial.flush(); SerialGPS.flush(); - while (SerialGPS.available()) { - Serial.print("."); - SerialGPS.readString(); - if (millis() > startTimeout) { - Serial.println("Wait L76K stop NMEA timeout!"); - return false; - } - }; - Serial.println(); - SerialGPS.flush(); - delay(200); - - SerialGPS.write("$PCAS06,0*1B\r\n"); - startTimeout = millis() + 500; - String ver = ""; - while (!SerialGPS.available()) { - if (millis() > startTimeout) { - Serial.println("Get L76K timeout!"); - return false; - } + if (millis() > startTimeout) { + Serial.println("Wait L76K stop NMEA timeout!"); + return false; } - SerialGPS.setTimeout(10); - ver = SerialGPS.readStringUntil('\n'); - if (ver.startsWith("$GPTXT,01,01,02")) { - Serial.println("L76K GNSS init succeeded, using L76K GNSS Module\n"); - result = true; - break; + }; + Serial.println(); + SerialGPS.flush(); + delay(200); + + SerialGPS.write("$PCAS06,0*1B\r\n"); + startTimeout = millis() + 500; + String ver = ""; + while (!SerialGPS.available()) { + if (millis() > startTimeout) { + Serial.println("Get L76K timeout!"); + return false; } - delay(500); } + SerialGPS.setTimeout(10); + ver = SerialGPS.readStringUntil('\n'); + if (ver.startsWith("$GPTXT,01,01,02")) { + Serial.println("L76K GNSS init succeeded, using L76K GNSS Module\n"); + result = true; + } + delay(500); + // Initialize the L76K Chip, use GPS + GLONASS SerialGPS.write("$PCAS04,5*1C\r\n"); delay(250); diff --git a/examples/Factory/LoRaBoards.cpp b/examples/Factory/LoRaBoards.cpp index 8c90174..f5948b4 100644 --- a/examples/Factory/LoRaBoards.cpp +++ b/examples/Factory/LoRaBoards.cpp @@ -914,43 +914,43 @@ bool beginGPS() SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); bool result = false; uint32_t startTimeout ; - for (int i = 0; i < 3; ++i) { - SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); - delay(5); - // Get version information - startTimeout = millis() + 3000; - Serial.print("Try to init L76K . Wait stop ."); + SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); + delay(5); + // Get version information + startTimeout = millis() + 3000; + Serial.print("Try to init L76K . Wait stop ."); + SerialGPS.flush(); + + while (SerialGPS.available()) { + // Serial.print("."); + Serial.flush(); SerialGPS.flush(); - while (SerialGPS.available()) { - Serial.print("."); - SerialGPS.readString(); - if (millis() > startTimeout) { - Serial.println("Wait L76K stop NMEA timeout!"); - return false; - } - }; - Serial.println(); - SerialGPS.flush(); - delay(200); - - SerialGPS.write("$PCAS06,0*1B\r\n"); - startTimeout = millis() + 500; - String ver = ""; - while (!SerialGPS.available()) { - if (millis() > startTimeout) { - Serial.println("Get L76K timeout!"); - return false; - } + if (millis() > startTimeout) { + Serial.println("Wait L76K stop NMEA timeout!"); + return false; } - SerialGPS.setTimeout(10); - ver = SerialGPS.readStringUntil('\n'); - if (ver.startsWith("$GPTXT,01,01,02")) { - Serial.println("L76K GNSS init succeeded, using L76K GNSS Module\n"); - result = true; - break; + }; + Serial.println(); + SerialGPS.flush(); + delay(200); + + SerialGPS.write("$PCAS06,0*1B\r\n"); + startTimeout = millis() + 500; + String ver = ""; + while (!SerialGPS.available()) { + if (millis() > startTimeout) { + Serial.println("Get L76K timeout!"); + return false; } - delay(500); } + SerialGPS.setTimeout(10); + ver = SerialGPS.readStringUntil('\n'); + if (ver.startsWith("$GPTXT,01,01,02")) { + Serial.println("L76K GNSS init succeeded, using L76K GNSS Module\n"); + result = true; + } + delay(500); + // Initialize the L76K Chip, use GPS + GLONASS SerialGPS.write("$PCAS04,5*1C\r\n"); delay(250); diff --git a/examples/GPS/TinyGPS_Example/LoRaBoards.cpp b/examples/GPS/TinyGPS_Example/LoRaBoards.cpp index 8c90174..f5948b4 100644 --- a/examples/GPS/TinyGPS_Example/LoRaBoards.cpp +++ b/examples/GPS/TinyGPS_Example/LoRaBoards.cpp @@ -914,43 +914,43 @@ bool beginGPS() SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); bool result = false; uint32_t startTimeout ; - for (int i = 0; i < 3; ++i) { - SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); - delay(5); - // Get version information - startTimeout = millis() + 3000; - Serial.print("Try to init L76K . Wait stop ."); + SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); + delay(5); + // Get version information + startTimeout = millis() + 3000; + Serial.print("Try to init L76K . Wait stop ."); + SerialGPS.flush(); + + while (SerialGPS.available()) { + // Serial.print("."); + Serial.flush(); SerialGPS.flush(); - while (SerialGPS.available()) { - Serial.print("."); - SerialGPS.readString(); - if (millis() > startTimeout) { - Serial.println("Wait L76K stop NMEA timeout!"); - return false; - } - }; - Serial.println(); - SerialGPS.flush(); - delay(200); - - SerialGPS.write("$PCAS06,0*1B\r\n"); - startTimeout = millis() + 500; - String ver = ""; - while (!SerialGPS.available()) { - if (millis() > startTimeout) { - Serial.println("Get L76K timeout!"); - return false; - } + if (millis() > startTimeout) { + Serial.println("Wait L76K stop NMEA timeout!"); + return false; } - SerialGPS.setTimeout(10); - ver = SerialGPS.readStringUntil('\n'); - if (ver.startsWith("$GPTXT,01,01,02")) { - Serial.println("L76K GNSS init succeeded, using L76K GNSS Module\n"); - result = true; - break; + }; + Serial.println(); + SerialGPS.flush(); + delay(200); + + SerialGPS.write("$PCAS06,0*1B\r\n"); + startTimeout = millis() + 500; + String ver = ""; + while (!SerialGPS.available()) { + if (millis() > startTimeout) { + Serial.println("Get L76K timeout!"); + return false; } - delay(500); } + SerialGPS.setTimeout(10); + ver = SerialGPS.readStringUntil('\n'); + if (ver.startsWith("$GPTXT,01,01,02")) { + Serial.println("L76K GNSS init succeeded, using L76K GNSS Module\n"); + result = true; + } + delay(500); + // Initialize the L76K Chip, use GPS + GLONASS SerialGPS.write("$PCAS04,5*1C\r\n"); delay(250); diff --git a/examples/GPS/TinyGPS_FullExample/LoRaBoards.cpp b/examples/GPS/TinyGPS_FullExample/LoRaBoards.cpp index 8c90174..f5948b4 100644 --- a/examples/GPS/TinyGPS_FullExample/LoRaBoards.cpp +++ b/examples/GPS/TinyGPS_FullExample/LoRaBoards.cpp @@ -914,43 +914,43 @@ bool beginGPS() SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); bool result = false; uint32_t startTimeout ; - for (int i = 0; i < 3; ++i) { - SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); - delay(5); - // Get version information - startTimeout = millis() + 3000; - Serial.print("Try to init L76K . Wait stop ."); + SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); + delay(5); + // Get version information + startTimeout = millis() + 3000; + Serial.print("Try to init L76K . Wait stop ."); + SerialGPS.flush(); + + while (SerialGPS.available()) { + // Serial.print("."); + Serial.flush(); SerialGPS.flush(); - while (SerialGPS.available()) { - Serial.print("."); - SerialGPS.readString(); - if (millis() > startTimeout) { - Serial.println("Wait L76K stop NMEA timeout!"); - return false; - } - }; - Serial.println(); - SerialGPS.flush(); - delay(200); - - SerialGPS.write("$PCAS06,0*1B\r\n"); - startTimeout = millis() + 500; - String ver = ""; - while (!SerialGPS.available()) { - if (millis() > startTimeout) { - Serial.println("Get L76K timeout!"); - return false; - } + if (millis() > startTimeout) { + Serial.println("Wait L76K stop NMEA timeout!"); + return false; } - SerialGPS.setTimeout(10); - ver = SerialGPS.readStringUntil('\n'); - if (ver.startsWith("$GPTXT,01,01,02")) { - Serial.println("L76K GNSS init succeeded, using L76K GNSS Module\n"); - result = true; - break; + }; + Serial.println(); + SerialGPS.flush(); + delay(200); + + SerialGPS.write("$PCAS06,0*1B\r\n"); + startTimeout = millis() + 500; + String ver = ""; + while (!SerialGPS.available()) { + if (millis() > startTimeout) { + Serial.println("Get L76K timeout!"); + return false; } - delay(500); } + SerialGPS.setTimeout(10); + ver = SerialGPS.readStringUntil('\n'); + if (ver.startsWith("$GPTXT,01,01,02")) { + Serial.println("L76K GNSS init succeeded, using L76K GNSS Module\n"); + result = true; + } + delay(500); + // Initialize the L76K Chip, use GPS + GLONASS SerialGPS.write("$PCAS04,5*1C\r\n"); delay(250); diff --git a/examples/GPS/TinyGPS_KitchenSink/LoRaBoards.cpp b/examples/GPS/TinyGPS_KitchenSink/LoRaBoards.cpp index 8c90174..f5948b4 100644 --- a/examples/GPS/TinyGPS_KitchenSink/LoRaBoards.cpp +++ b/examples/GPS/TinyGPS_KitchenSink/LoRaBoards.cpp @@ -914,43 +914,43 @@ bool beginGPS() SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); bool result = false; uint32_t startTimeout ; - for (int i = 0; i < 3; ++i) { - SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); - delay(5); - // Get version information - startTimeout = millis() + 3000; - Serial.print("Try to init L76K . Wait stop ."); + SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); + delay(5); + // Get version information + startTimeout = millis() + 3000; + Serial.print("Try to init L76K . Wait stop ."); + SerialGPS.flush(); + + while (SerialGPS.available()) { + // Serial.print("."); + Serial.flush(); SerialGPS.flush(); - while (SerialGPS.available()) { - Serial.print("."); - SerialGPS.readString(); - if (millis() > startTimeout) { - Serial.println("Wait L76K stop NMEA timeout!"); - return false; - } - }; - Serial.println(); - SerialGPS.flush(); - delay(200); - - SerialGPS.write("$PCAS06,0*1B\r\n"); - startTimeout = millis() + 500; - String ver = ""; - while (!SerialGPS.available()) { - if (millis() > startTimeout) { - Serial.println("Get L76K timeout!"); - return false; - } + if (millis() > startTimeout) { + Serial.println("Wait L76K stop NMEA timeout!"); + return false; } - SerialGPS.setTimeout(10); - ver = SerialGPS.readStringUntil('\n'); - if (ver.startsWith("$GPTXT,01,01,02")) { - Serial.println("L76K GNSS init succeeded, using L76K GNSS Module\n"); - result = true; - break; + }; + Serial.println(); + SerialGPS.flush(); + delay(200); + + SerialGPS.write("$PCAS06,0*1B\r\n"); + startTimeout = millis() + 500; + String ver = ""; + while (!SerialGPS.available()) { + if (millis() > startTimeout) { + Serial.println("Get L76K timeout!"); + return false; } - delay(500); } + SerialGPS.setTimeout(10); + ver = SerialGPS.readStringUntil('\n'); + if (ver.startsWith("$GPTXT,01,01,02")) { + Serial.println("L76K GNSS init succeeded, using L76K GNSS Module\n"); + result = true; + } + delay(500); + // Initialize the L76K Chip, use GPS + GLONASS SerialGPS.write("$PCAS04,5*1C\r\n"); delay(250); diff --git a/examples/GPS/UBlox_BasicNMEARead/LoRaBoards.cpp b/examples/GPS/UBlox_BasicNMEARead/LoRaBoards.cpp index 8c90174..f5948b4 100644 --- a/examples/GPS/UBlox_BasicNMEARead/LoRaBoards.cpp +++ b/examples/GPS/UBlox_BasicNMEARead/LoRaBoards.cpp @@ -914,43 +914,43 @@ bool beginGPS() SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); bool result = false; uint32_t startTimeout ; - for (int i = 0; i < 3; ++i) { - SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); - delay(5); - // Get version information - startTimeout = millis() + 3000; - Serial.print("Try to init L76K . Wait stop ."); + SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); + delay(5); + // Get version information + startTimeout = millis() + 3000; + Serial.print("Try to init L76K . Wait stop ."); + SerialGPS.flush(); + + while (SerialGPS.available()) { + // Serial.print("."); + Serial.flush(); SerialGPS.flush(); - while (SerialGPS.available()) { - Serial.print("."); - SerialGPS.readString(); - if (millis() > startTimeout) { - Serial.println("Wait L76K stop NMEA timeout!"); - return false; - } - }; - Serial.println(); - SerialGPS.flush(); - delay(200); - - SerialGPS.write("$PCAS06,0*1B\r\n"); - startTimeout = millis() + 500; - String ver = ""; - while (!SerialGPS.available()) { - if (millis() > startTimeout) { - Serial.println("Get L76K timeout!"); - return false; - } + if (millis() > startTimeout) { + Serial.println("Wait L76K stop NMEA timeout!"); + return false; } - SerialGPS.setTimeout(10); - ver = SerialGPS.readStringUntil('\n'); - if (ver.startsWith("$GPTXT,01,01,02")) { - Serial.println("L76K GNSS init succeeded, using L76K GNSS Module\n"); - result = true; - break; + }; + Serial.println(); + SerialGPS.flush(); + delay(200); + + SerialGPS.write("$PCAS06,0*1B\r\n"); + startTimeout = millis() + 500; + String ver = ""; + while (!SerialGPS.available()) { + if (millis() > startTimeout) { + Serial.println("Get L76K timeout!"); + return false; } - delay(500); } + SerialGPS.setTimeout(10); + ver = SerialGPS.readStringUntil('\n'); + if (ver.startsWith("$GPTXT,01,01,02")) { + Serial.println("L76K GNSS init succeeded, using L76K GNSS Module\n"); + result = true; + } + delay(500); + // Initialize the L76K Chip, use GPS + GLONASS SerialGPS.write("$PCAS04,5*1C\r\n"); delay(250); diff --git a/examples/GPS/UBlox_NMEAParsing/LoRaBoards.cpp b/examples/GPS/UBlox_NMEAParsing/LoRaBoards.cpp index 8c90174..f5948b4 100644 --- a/examples/GPS/UBlox_NMEAParsing/LoRaBoards.cpp +++ b/examples/GPS/UBlox_NMEAParsing/LoRaBoards.cpp @@ -914,43 +914,43 @@ bool beginGPS() SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); bool result = false; uint32_t startTimeout ; - for (int i = 0; i < 3; ++i) { - SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); - delay(5); - // Get version information - startTimeout = millis() + 3000; - Serial.print("Try to init L76K . Wait stop ."); + SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); + delay(5); + // Get version information + startTimeout = millis() + 3000; + Serial.print("Try to init L76K . Wait stop ."); + SerialGPS.flush(); + + while (SerialGPS.available()) { + // Serial.print("."); + Serial.flush(); SerialGPS.flush(); - while (SerialGPS.available()) { - Serial.print("."); - SerialGPS.readString(); - if (millis() > startTimeout) { - Serial.println("Wait L76K stop NMEA timeout!"); - return false; - } - }; - Serial.println(); - SerialGPS.flush(); - delay(200); - - SerialGPS.write("$PCAS06,0*1B\r\n"); - startTimeout = millis() + 500; - String ver = ""; - while (!SerialGPS.available()) { - if (millis() > startTimeout) { - Serial.println("Get L76K timeout!"); - return false; - } + if (millis() > startTimeout) { + Serial.println("Wait L76K stop NMEA timeout!"); + return false; } - SerialGPS.setTimeout(10); - ver = SerialGPS.readStringUntil('\n'); - if (ver.startsWith("$GPTXT,01,01,02")) { - Serial.println("L76K GNSS init succeeded, using L76K GNSS Module\n"); - result = true; - break; + }; + Serial.println(); + SerialGPS.flush(); + delay(200); + + SerialGPS.write("$PCAS06,0*1B\r\n"); + startTimeout = millis() + 500; + String ver = ""; + while (!SerialGPS.available()) { + if (millis() > startTimeout) { + Serial.println("Get L76K timeout!"); + return false; } - delay(500); } + SerialGPS.setTimeout(10); + ver = SerialGPS.readStringUntil('\n'); + if (ver.startsWith("$GPTXT,01,01,02")) { + Serial.println("L76K GNSS init succeeded, using L76K GNSS Module\n"); + result = true; + } + delay(500); + // Initialize the L76K Chip, use GPS + GLONASS SerialGPS.write("$PCAS04,5*1C\r\n"); delay(250); diff --git a/examples/GPS/UBlox_OutputRate/LoRaBoards.cpp b/examples/GPS/UBlox_OutputRate/LoRaBoards.cpp index 8c90174..f5948b4 100644 --- a/examples/GPS/UBlox_OutputRate/LoRaBoards.cpp +++ b/examples/GPS/UBlox_OutputRate/LoRaBoards.cpp @@ -914,43 +914,43 @@ bool beginGPS() SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); bool result = false; uint32_t startTimeout ; - for (int i = 0; i < 3; ++i) { - SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); - delay(5); - // Get version information - startTimeout = millis() + 3000; - Serial.print("Try to init L76K . Wait stop ."); + SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); + delay(5); + // Get version information + startTimeout = millis() + 3000; + Serial.print("Try to init L76K . Wait stop ."); + SerialGPS.flush(); + + while (SerialGPS.available()) { + // Serial.print("."); + Serial.flush(); SerialGPS.flush(); - while (SerialGPS.available()) { - Serial.print("."); - SerialGPS.readString(); - if (millis() > startTimeout) { - Serial.println("Wait L76K stop NMEA timeout!"); - return false; - } - }; - Serial.println(); - SerialGPS.flush(); - delay(200); - - SerialGPS.write("$PCAS06,0*1B\r\n"); - startTimeout = millis() + 500; - String ver = ""; - while (!SerialGPS.available()) { - if (millis() > startTimeout) { - Serial.println("Get L76K timeout!"); - return false; - } + if (millis() > startTimeout) { + Serial.println("Wait L76K stop NMEA timeout!"); + return false; } - SerialGPS.setTimeout(10); - ver = SerialGPS.readStringUntil('\n'); - if (ver.startsWith("$GPTXT,01,01,02")) { - Serial.println("L76K GNSS init succeeded, using L76K GNSS Module\n"); - result = true; - break; + }; + Serial.println(); + SerialGPS.flush(); + delay(200); + + SerialGPS.write("$PCAS06,0*1B\r\n"); + startTimeout = millis() + 500; + String ver = ""; + while (!SerialGPS.available()) { + if (millis() > startTimeout) { + Serial.println("Get L76K timeout!"); + return false; } - delay(500); } + SerialGPS.setTimeout(10); + ver = SerialGPS.readStringUntil('\n'); + if (ver.startsWith("$GPTXT,01,01,02")) { + Serial.println("L76K GNSS init succeeded, using L76K GNSS Module\n"); + result = true; + } + delay(500); + // Initialize the L76K Chip, use GPS + GLONASS SerialGPS.write("$PCAS04,5*1C\r\n"); delay(250); diff --git a/examples/GPS/UBlox_Recovery/LoRaBoards.cpp b/examples/GPS/UBlox_Recovery/LoRaBoards.cpp index 8c90174..f5948b4 100644 --- a/examples/GPS/UBlox_Recovery/LoRaBoards.cpp +++ b/examples/GPS/UBlox_Recovery/LoRaBoards.cpp @@ -914,43 +914,43 @@ bool beginGPS() SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); bool result = false; uint32_t startTimeout ; - for (int i = 0; i < 3; ++i) { - SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); - delay(5); - // Get version information - startTimeout = millis() + 3000; - Serial.print("Try to init L76K . Wait stop ."); + SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); + delay(5); + // Get version information + startTimeout = millis() + 3000; + Serial.print("Try to init L76K . Wait stop ."); + SerialGPS.flush(); + + while (SerialGPS.available()) { + // Serial.print("."); + Serial.flush(); SerialGPS.flush(); - while (SerialGPS.available()) { - Serial.print("."); - SerialGPS.readString(); - if (millis() > startTimeout) { - Serial.println("Wait L76K stop NMEA timeout!"); - return false; - } - }; - Serial.println(); - SerialGPS.flush(); - delay(200); - - SerialGPS.write("$PCAS06,0*1B\r\n"); - startTimeout = millis() + 500; - String ver = ""; - while (!SerialGPS.available()) { - if (millis() > startTimeout) { - Serial.println("Get L76K timeout!"); - return false; - } + if (millis() > startTimeout) { + Serial.println("Wait L76K stop NMEA timeout!"); + return false; } - SerialGPS.setTimeout(10); - ver = SerialGPS.readStringUntil('\n'); - if (ver.startsWith("$GPTXT,01,01,02")) { - Serial.println("L76K GNSS init succeeded, using L76K GNSS Module\n"); - result = true; - break; + }; + Serial.println(); + SerialGPS.flush(); + delay(200); + + SerialGPS.write("$PCAS06,0*1B\r\n"); + startTimeout = millis() + 500; + String ver = ""; + while (!SerialGPS.available()) { + if (millis() > startTimeout) { + Serial.println("Get L76K timeout!"); + return false; } - delay(500); } + SerialGPS.setTimeout(10); + ver = SerialGPS.readStringUntil('\n'); + if (ver.startsWith("$GPTXT,01,01,02")) { + Serial.println("L76K GNSS init succeeded, using L76K GNSS Module\n"); + result = true; + } + delay(500); + // Initialize the L76K Chip, use GPS + GLONASS SerialGPS.write("$PCAS04,5*1C\r\n"); delay(250); diff --git a/examples/LoRaWAN/LMIC_Library_OTTA/LoRaBoards.cpp b/examples/LoRaWAN/LMIC_Library_OTTA/LoRaBoards.cpp index 8c90174..f5948b4 100644 --- a/examples/LoRaWAN/LMIC_Library_OTTA/LoRaBoards.cpp +++ b/examples/LoRaWAN/LMIC_Library_OTTA/LoRaBoards.cpp @@ -914,43 +914,43 @@ bool beginGPS() SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); bool result = false; uint32_t startTimeout ; - for (int i = 0; i < 3; ++i) { - SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); - delay(5); - // Get version information - startTimeout = millis() + 3000; - Serial.print("Try to init L76K . Wait stop ."); + SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); + delay(5); + // Get version information + startTimeout = millis() + 3000; + Serial.print("Try to init L76K . Wait stop ."); + SerialGPS.flush(); + + while (SerialGPS.available()) { + // Serial.print("."); + Serial.flush(); SerialGPS.flush(); - while (SerialGPS.available()) { - Serial.print("."); - SerialGPS.readString(); - if (millis() > startTimeout) { - Serial.println("Wait L76K stop NMEA timeout!"); - return false; - } - }; - Serial.println(); - SerialGPS.flush(); - delay(200); - - SerialGPS.write("$PCAS06,0*1B\r\n"); - startTimeout = millis() + 500; - String ver = ""; - while (!SerialGPS.available()) { - if (millis() > startTimeout) { - Serial.println("Get L76K timeout!"); - return false; - } + if (millis() > startTimeout) { + Serial.println("Wait L76K stop NMEA timeout!"); + return false; } - SerialGPS.setTimeout(10); - ver = SerialGPS.readStringUntil('\n'); - if (ver.startsWith("$GPTXT,01,01,02")) { - Serial.println("L76K GNSS init succeeded, using L76K GNSS Module\n"); - result = true; - break; + }; + Serial.println(); + SerialGPS.flush(); + delay(200); + + SerialGPS.write("$PCAS06,0*1B\r\n"); + startTimeout = millis() + 500; + String ver = ""; + while (!SerialGPS.available()) { + if (millis() > startTimeout) { + Serial.println("Get L76K timeout!"); + return false; } - delay(500); } + SerialGPS.setTimeout(10); + ver = SerialGPS.readStringUntil('\n'); + if (ver.startsWith("$GPTXT,01,01,02")) { + Serial.println("L76K GNSS init succeeded, using L76K GNSS Module\n"); + result = true; + } + delay(500); + // Initialize the L76K Chip, use GPS + GLONASS SerialGPS.write("$PCAS04,5*1C\r\n"); delay(250); diff --git a/examples/LoRaWAN/LoRaWAN_ABP/LoRaBoards.cpp b/examples/LoRaWAN/LoRaWAN_ABP/LoRaBoards.cpp index 8c90174..f5948b4 100644 --- a/examples/LoRaWAN/LoRaWAN_ABP/LoRaBoards.cpp +++ b/examples/LoRaWAN/LoRaWAN_ABP/LoRaBoards.cpp @@ -914,43 +914,43 @@ bool beginGPS() SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); bool result = false; uint32_t startTimeout ; - for (int i = 0; i < 3; ++i) { - SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); - delay(5); - // Get version information - startTimeout = millis() + 3000; - Serial.print("Try to init L76K . Wait stop ."); + SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); + delay(5); + // Get version information + startTimeout = millis() + 3000; + Serial.print("Try to init L76K . Wait stop ."); + SerialGPS.flush(); + + while (SerialGPS.available()) { + // Serial.print("."); + Serial.flush(); SerialGPS.flush(); - while (SerialGPS.available()) { - Serial.print("."); - SerialGPS.readString(); - if (millis() > startTimeout) { - Serial.println("Wait L76K stop NMEA timeout!"); - return false; - } - }; - Serial.println(); - SerialGPS.flush(); - delay(200); - - SerialGPS.write("$PCAS06,0*1B\r\n"); - startTimeout = millis() + 500; - String ver = ""; - while (!SerialGPS.available()) { - if (millis() > startTimeout) { - Serial.println("Get L76K timeout!"); - return false; - } + if (millis() > startTimeout) { + Serial.println("Wait L76K stop NMEA timeout!"); + return false; } - SerialGPS.setTimeout(10); - ver = SerialGPS.readStringUntil('\n'); - if (ver.startsWith("$GPTXT,01,01,02")) { - Serial.println("L76K GNSS init succeeded, using L76K GNSS Module\n"); - result = true; - break; + }; + Serial.println(); + SerialGPS.flush(); + delay(200); + + SerialGPS.write("$PCAS06,0*1B\r\n"); + startTimeout = millis() + 500; + String ver = ""; + while (!SerialGPS.available()) { + if (millis() > startTimeout) { + Serial.println("Get L76K timeout!"); + return false; } - delay(500); } + SerialGPS.setTimeout(10); + ver = SerialGPS.readStringUntil('\n'); + if (ver.startsWith("$GPTXT,01,01,02")) { + Serial.println("L76K GNSS init succeeded, using L76K GNSS Module\n"); + result = true; + } + delay(500); + // Initialize the L76K Chip, use GPS + GLONASS SerialGPS.write("$PCAS04,5*1C\r\n"); delay(250); diff --git a/examples/LoRaWAN/RadioLib_OTAA/LoRaBoards.cpp b/examples/LoRaWAN/RadioLib_OTAA/LoRaBoards.cpp index 8c90174..f5948b4 100644 --- a/examples/LoRaWAN/RadioLib_OTAA/LoRaBoards.cpp +++ b/examples/LoRaWAN/RadioLib_OTAA/LoRaBoards.cpp @@ -914,43 +914,43 @@ bool beginGPS() SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); bool result = false; uint32_t startTimeout ; - for (int i = 0; i < 3; ++i) { - SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); - delay(5); - // Get version information - startTimeout = millis() + 3000; - Serial.print("Try to init L76K . Wait stop ."); + SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); + delay(5); + // Get version information + startTimeout = millis() + 3000; + Serial.print("Try to init L76K . Wait stop ."); + SerialGPS.flush(); + + while (SerialGPS.available()) { + // Serial.print("."); + Serial.flush(); SerialGPS.flush(); - while (SerialGPS.available()) { - Serial.print("."); - SerialGPS.readString(); - if (millis() > startTimeout) { - Serial.println("Wait L76K stop NMEA timeout!"); - return false; - } - }; - Serial.println(); - SerialGPS.flush(); - delay(200); - - SerialGPS.write("$PCAS06,0*1B\r\n"); - startTimeout = millis() + 500; - String ver = ""; - while (!SerialGPS.available()) { - if (millis() > startTimeout) { - Serial.println("Get L76K timeout!"); - return false; - } + if (millis() > startTimeout) { + Serial.println("Wait L76K stop NMEA timeout!"); + return false; } - SerialGPS.setTimeout(10); - ver = SerialGPS.readStringUntil('\n'); - if (ver.startsWith("$GPTXT,01,01,02")) { - Serial.println("L76K GNSS init succeeded, using L76K GNSS Module\n"); - result = true; - break; + }; + Serial.println(); + SerialGPS.flush(); + delay(200); + + SerialGPS.write("$PCAS06,0*1B\r\n"); + startTimeout = millis() + 500; + String ver = ""; + while (!SerialGPS.available()) { + if (millis() > startTimeout) { + Serial.println("Get L76K timeout!"); + return false; } - delay(500); } + SerialGPS.setTimeout(10); + ver = SerialGPS.readStringUntil('\n'); + if (ver.startsWith("$GPTXT,01,01,02")) { + Serial.println("L76K GNSS init succeeded, using L76K GNSS Module\n"); + result = true; + } + delay(500); + // Initialize the L76K Chip, use GPS + GLONASS SerialGPS.write("$PCAS04,5*1C\r\n"); delay(250); diff --git a/examples/OLED/SH1106FontUsage/LoRaBoards.cpp b/examples/OLED/SH1106FontUsage/LoRaBoards.cpp index 8c90174..f5948b4 100644 --- a/examples/OLED/SH1106FontUsage/LoRaBoards.cpp +++ b/examples/OLED/SH1106FontUsage/LoRaBoards.cpp @@ -914,43 +914,43 @@ bool beginGPS() SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); bool result = false; uint32_t startTimeout ; - for (int i = 0; i < 3; ++i) { - SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); - delay(5); - // Get version information - startTimeout = millis() + 3000; - Serial.print("Try to init L76K . Wait stop ."); + SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); + delay(5); + // Get version information + startTimeout = millis() + 3000; + Serial.print("Try to init L76K . Wait stop ."); + SerialGPS.flush(); + + while (SerialGPS.available()) { + // Serial.print("."); + Serial.flush(); SerialGPS.flush(); - while (SerialGPS.available()) { - Serial.print("."); - SerialGPS.readString(); - if (millis() > startTimeout) { - Serial.println("Wait L76K stop NMEA timeout!"); - return false; - } - }; - Serial.println(); - SerialGPS.flush(); - delay(200); - - SerialGPS.write("$PCAS06,0*1B\r\n"); - startTimeout = millis() + 500; - String ver = ""; - while (!SerialGPS.available()) { - if (millis() > startTimeout) { - Serial.println("Get L76K timeout!"); - return false; - } + if (millis() > startTimeout) { + Serial.println("Wait L76K stop NMEA timeout!"); + return false; } - SerialGPS.setTimeout(10); - ver = SerialGPS.readStringUntil('\n'); - if (ver.startsWith("$GPTXT,01,01,02")) { - Serial.println("L76K GNSS init succeeded, using L76K GNSS Module\n"); - result = true; - break; + }; + Serial.println(); + SerialGPS.flush(); + delay(200); + + SerialGPS.write("$PCAS06,0*1B\r\n"); + startTimeout = millis() + 500; + String ver = ""; + while (!SerialGPS.available()) { + if (millis() > startTimeout) { + Serial.println("Get L76K timeout!"); + return false; } - delay(500); } + SerialGPS.setTimeout(10); + ver = SerialGPS.readStringUntil('\n'); + if (ver.startsWith("$GPTXT,01,01,02")) { + Serial.println("L76K GNSS init succeeded, using L76K GNSS Module\n"); + result = true; + } + delay(500); + // Initialize the L76K Chip, use GPS + GLONASS SerialGPS.write("$PCAS04,5*1C\r\n"); delay(250); diff --git a/examples/OLED/SH1106GraphicsTest/LoRaBoards.cpp b/examples/OLED/SH1106GraphicsTest/LoRaBoards.cpp index 8c90174..f5948b4 100644 --- a/examples/OLED/SH1106GraphicsTest/LoRaBoards.cpp +++ b/examples/OLED/SH1106GraphicsTest/LoRaBoards.cpp @@ -914,43 +914,43 @@ bool beginGPS() SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); bool result = false; uint32_t startTimeout ; - for (int i = 0; i < 3; ++i) { - SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); - delay(5); - // Get version information - startTimeout = millis() + 3000; - Serial.print("Try to init L76K . Wait stop ."); + SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); + delay(5); + // Get version information + startTimeout = millis() + 3000; + Serial.print("Try to init L76K . Wait stop ."); + SerialGPS.flush(); + + while (SerialGPS.available()) { + // Serial.print("."); + Serial.flush(); SerialGPS.flush(); - while (SerialGPS.available()) { - Serial.print("."); - SerialGPS.readString(); - if (millis() > startTimeout) { - Serial.println("Wait L76K stop NMEA timeout!"); - return false; - } - }; - Serial.println(); - SerialGPS.flush(); - delay(200); - - SerialGPS.write("$PCAS06,0*1B\r\n"); - startTimeout = millis() + 500; - String ver = ""; - while (!SerialGPS.available()) { - if (millis() > startTimeout) { - Serial.println("Get L76K timeout!"); - return false; - } + if (millis() > startTimeout) { + Serial.println("Wait L76K stop NMEA timeout!"); + return false; } - SerialGPS.setTimeout(10); - ver = SerialGPS.readStringUntil('\n'); - if (ver.startsWith("$GPTXT,01,01,02")) { - Serial.println("L76K GNSS init succeeded, using L76K GNSS Module\n"); - result = true; - break; + }; + Serial.println(); + SerialGPS.flush(); + delay(200); + + SerialGPS.write("$PCAS06,0*1B\r\n"); + startTimeout = millis() + 500; + String ver = ""; + while (!SerialGPS.available()) { + if (millis() > startTimeout) { + Serial.println("Get L76K timeout!"); + return false; } - delay(500); } + SerialGPS.setTimeout(10); + ver = SerialGPS.readStringUntil('\n'); + if (ver.startsWith("$GPTXT,01,01,02")) { + Serial.println("L76K GNSS init succeeded, using L76K GNSS Module\n"); + result = true; + } + delay(500); + // Initialize the L76K Chip, use GPS + GLONASS SerialGPS.write("$PCAS04,5*1C\r\n"); delay(250); diff --git a/examples/OLED/SH1106IconMenu/LoRaBoards.cpp b/examples/OLED/SH1106IconMenu/LoRaBoards.cpp index 8c90174..f5948b4 100644 --- a/examples/OLED/SH1106IconMenu/LoRaBoards.cpp +++ b/examples/OLED/SH1106IconMenu/LoRaBoards.cpp @@ -914,43 +914,43 @@ bool beginGPS() SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); bool result = false; uint32_t startTimeout ; - for (int i = 0; i < 3; ++i) { - SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); - delay(5); - // Get version information - startTimeout = millis() + 3000; - Serial.print("Try to init L76K . Wait stop ."); + SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); + delay(5); + // Get version information + startTimeout = millis() + 3000; + Serial.print("Try to init L76K . Wait stop ."); + SerialGPS.flush(); + + while (SerialGPS.available()) { + // Serial.print("."); + Serial.flush(); SerialGPS.flush(); - while (SerialGPS.available()) { - Serial.print("."); - SerialGPS.readString(); - if (millis() > startTimeout) { - Serial.println("Wait L76K stop NMEA timeout!"); - return false; - } - }; - Serial.println(); - SerialGPS.flush(); - delay(200); - - SerialGPS.write("$PCAS06,0*1B\r\n"); - startTimeout = millis() + 500; - String ver = ""; - while (!SerialGPS.available()) { - if (millis() > startTimeout) { - Serial.println("Get L76K timeout!"); - return false; - } + if (millis() > startTimeout) { + Serial.println("Wait L76K stop NMEA timeout!"); + return false; } - SerialGPS.setTimeout(10); - ver = SerialGPS.readStringUntil('\n'); - if (ver.startsWith("$GPTXT,01,01,02")) { - Serial.println("L76K GNSS init succeeded, using L76K GNSS Module\n"); - result = true; - break; + }; + Serial.println(); + SerialGPS.flush(); + delay(200); + + SerialGPS.write("$PCAS06,0*1B\r\n"); + startTimeout = millis() + 500; + String ver = ""; + while (!SerialGPS.available()) { + if (millis() > startTimeout) { + Serial.println("Get L76K timeout!"); + return false; } - delay(500); } + SerialGPS.setTimeout(10); + ver = SerialGPS.readStringUntil('\n'); + if (ver.startsWith("$GPTXT,01,01,02")) { + Serial.println("L76K GNSS init succeeded, using L76K GNSS Module\n"); + result = true; + } + delay(500); + // Initialize the L76K Chip, use GPS + GLONASS SerialGPS.write("$PCAS04,5*1C\r\n"); delay(250); diff --git a/examples/OLED/SH1106PrintUTF8/LoRaBoards.cpp b/examples/OLED/SH1106PrintUTF8/LoRaBoards.cpp index 8c90174..f5948b4 100644 --- a/examples/OLED/SH1106PrintUTF8/LoRaBoards.cpp +++ b/examples/OLED/SH1106PrintUTF8/LoRaBoards.cpp @@ -914,43 +914,43 @@ bool beginGPS() SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); bool result = false; uint32_t startTimeout ; - for (int i = 0; i < 3; ++i) { - SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); - delay(5); - // Get version information - startTimeout = millis() + 3000; - Serial.print("Try to init L76K . Wait stop ."); + SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); + delay(5); + // Get version information + startTimeout = millis() + 3000; + Serial.print("Try to init L76K . Wait stop ."); + SerialGPS.flush(); + + while (SerialGPS.available()) { + // Serial.print("."); + Serial.flush(); SerialGPS.flush(); - while (SerialGPS.available()) { - Serial.print("."); - SerialGPS.readString(); - if (millis() > startTimeout) { - Serial.println("Wait L76K stop NMEA timeout!"); - return false; - } - }; - Serial.println(); - SerialGPS.flush(); - delay(200); - - SerialGPS.write("$PCAS06,0*1B\r\n"); - startTimeout = millis() + 500; - String ver = ""; - while (!SerialGPS.available()) { - if (millis() > startTimeout) { - Serial.println("Get L76K timeout!"); - return false; - } + if (millis() > startTimeout) { + Serial.println("Wait L76K stop NMEA timeout!"); + return false; } - SerialGPS.setTimeout(10); - ver = SerialGPS.readStringUntil('\n'); - if (ver.startsWith("$GPTXT,01,01,02")) { - Serial.println("L76K GNSS init succeeded, using L76K GNSS Module\n"); - result = true; - break; + }; + Serial.println(); + SerialGPS.flush(); + delay(200); + + SerialGPS.write("$PCAS06,0*1B\r\n"); + startTimeout = millis() + 500; + String ver = ""; + while (!SerialGPS.available()) { + if (millis() > startTimeout) { + Serial.println("Get L76K timeout!"); + return false; } - delay(500); } + SerialGPS.setTimeout(10); + ver = SerialGPS.readStringUntil('\n'); + if (ver.startsWith("$GPTXT,01,01,02")) { + Serial.println("L76K GNSS init succeeded, using L76K GNSS Module\n"); + result = true; + } + delay(500); + // Initialize the L76K Chip, use GPS + GLONASS SerialGPS.write("$PCAS04,5*1C\r\n"); delay(250); diff --git a/examples/OLED/SSD1306SimpleDemo/LoRaBoards.cpp b/examples/OLED/SSD1306SimpleDemo/LoRaBoards.cpp index 8c90174..f5948b4 100644 --- a/examples/OLED/SSD1306SimpleDemo/LoRaBoards.cpp +++ b/examples/OLED/SSD1306SimpleDemo/LoRaBoards.cpp @@ -914,43 +914,43 @@ bool beginGPS() SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); bool result = false; uint32_t startTimeout ; - for (int i = 0; i < 3; ++i) { - SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); - delay(5); - // Get version information - startTimeout = millis() + 3000; - Serial.print("Try to init L76K . Wait stop ."); + SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); + delay(5); + // Get version information + startTimeout = millis() + 3000; + Serial.print("Try to init L76K . Wait stop ."); + SerialGPS.flush(); + + while (SerialGPS.available()) { + // Serial.print("."); + Serial.flush(); SerialGPS.flush(); - while (SerialGPS.available()) { - Serial.print("."); - SerialGPS.readString(); - if (millis() > startTimeout) { - Serial.println("Wait L76K stop NMEA timeout!"); - return false; - } - }; - Serial.println(); - SerialGPS.flush(); - delay(200); - - SerialGPS.write("$PCAS06,0*1B\r\n"); - startTimeout = millis() + 500; - String ver = ""; - while (!SerialGPS.available()) { - if (millis() > startTimeout) { - Serial.println("Get L76K timeout!"); - return false; - } + if (millis() > startTimeout) { + Serial.println("Wait L76K stop NMEA timeout!"); + return false; } - SerialGPS.setTimeout(10); - ver = SerialGPS.readStringUntil('\n'); - if (ver.startsWith("$GPTXT,01,01,02")) { - Serial.println("L76K GNSS init succeeded, using L76K GNSS Module\n"); - result = true; - break; + }; + Serial.println(); + SerialGPS.flush(); + delay(200); + + SerialGPS.write("$PCAS06,0*1B\r\n"); + startTimeout = millis() + 500; + String ver = ""; + while (!SerialGPS.available()) { + if (millis() > startTimeout) { + Serial.println("Get L76K timeout!"); + return false; } - delay(500); } + SerialGPS.setTimeout(10); + ver = SerialGPS.readStringUntil('\n'); + if (ver.startsWith("$GPTXT,01,01,02")) { + Serial.println("L76K GNSS init succeeded, using L76K GNSS Module\n"); + result = true; + } + delay(500); + // Initialize the L76K Chip, use GPS + GLONASS SerialGPS.write("$PCAS04,5*1C\r\n"); delay(250); diff --git a/examples/OLED/SSD1306UiDemo/LoRaBoards.cpp b/examples/OLED/SSD1306UiDemo/LoRaBoards.cpp index 8c90174..f5948b4 100644 --- a/examples/OLED/SSD1306UiDemo/LoRaBoards.cpp +++ b/examples/OLED/SSD1306UiDemo/LoRaBoards.cpp @@ -914,43 +914,43 @@ bool beginGPS() SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); bool result = false; uint32_t startTimeout ; - for (int i = 0; i < 3; ++i) { - SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); - delay(5); - // Get version information - startTimeout = millis() + 3000; - Serial.print("Try to init L76K . Wait stop ."); + SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); + delay(5); + // Get version information + startTimeout = millis() + 3000; + Serial.print("Try to init L76K . Wait stop ."); + SerialGPS.flush(); + + while (SerialGPS.available()) { + // Serial.print("."); + Serial.flush(); SerialGPS.flush(); - while (SerialGPS.available()) { - Serial.print("."); - SerialGPS.readString(); - if (millis() > startTimeout) { - Serial.println("Wait L76K stop NMEA timeout!"); - return false; - } - }; - Serial.println(); - SerialGPS.flush(); - delay(200); - - SerialGPS.write("$PCAS06,0*1B\r\n"); - startTimeout = millis() + 500; - String ver = ""; - while (!SerialGPS.available()) { - if (millis() > startTimeout) { - Serial.println("Get L76K timeout!"); - return false; - } + if (millis() > startTimeout) { + Serial.println("Wait L76K stop NMEA timeout!"); + return false; } - SerialGPS.setTimeout(10); - ver = SerialGPS.readStringUntil('\n'); - if (ver.startsWith("$GPTXT,01,01,02")) { - Serial.println("L76K GNSS init succeeded, using L76K GNSS Module\n"); - result = true; - break; + }; + Serial.println(); + SerialGPS.flush(); + delay(200); + + SerialGPS.write("$PCAS06,0*1B\r\n"); + startTimeout = millis() + 500; + String ver = ""; + while (!SerialGPS.available()) { + if (millis() > startTimeout) { + Serial.println("Get L76K timeout!"); + return false; } - delay(500); } + SerialGPS.setTimeout(10); + ver = SerialGPS.readStringUntil('\n'); + if (ver.startsWith("$GPTXT,01,01,02")) { + Serial.println("L76K GNSS init succeeded, using L76K GNSS Module\n"); + result = true; + } + delay(500); + // Initialize the L76K Chip, use GPS + GLONASS SerialGPS.write("$PCAS04,5*1C\r\n"); delay(250); diff --git a/examples/PMU/LoRaBoards.cpp b/examples/PMU/LoRaBoards.cpp index 8c90174..f5948b4 100644 --- a/examples/PMU/LoRaBoards.cpp +++ b/examples/PMU/LoRaBoards.cpp @@ -914,43 +914,43 @@ bool beginGPS() SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); bool result = false; uint32_t startTimeout ; - for (int i = 0; i < 3; ++i) { - SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); - delay(5); - // Get version information - startTimeout = millis() + 3000; - Serial.print("Try to init L76K . Wait stop ."); + SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); + delay(5); + // Get version information + startTimeout = millis() + 3000; + Serial.print("Try to init L76K . Wait stop ."); + SerialGPS.flush(); + + while (SerialGPS.available()) { + // Serial.print("."); + Serial.flush(); SerialGPS.flush(); - while (SerialGPS.available()) { - Serial.print("."); - SerialGPS.readString(); - if (millis() > startTimeout) { - Serial.println("Wait L76K stop NMEA timeout!"); - return false; - } - }; - Serial.println(); - SerialGPS.flush(); - delay(200); - - SerialGPS.write("$PCAS06,0*1B\r\n"); - startTimeout = millis() + 500; - String ver = ""; - while (!SerialGPS.available()) { - if (millis() > startTimeout) { - Serial.println("Get L76K timeout!"); - return false; - } + if (millis() > startTimeout) { + Serial.println("Wait L76K stop NMEA timeout!"); + return false; } - SerialGPS.setTimeout(10); - ver = SerialGPS.readStringUntil('\n'); - if (ver.startsWith("$GPTXT,01,01,02")) { - Serial.println("L76K GNSS init succeeded, using L76K GNSS Module\n"); - result = true; - break; + }; + Serial.println(); + SerialGPS.flush(); + delay(200); + + SerialGPS.write("$PCAS06,0*1B\r\n"); + startTimeout = millis() + 500; + String ver = ""; + while (!SerialGPS.available()) { + if (millis() > startTimeout) { + Serial.println("Get L76K timeout!"); + return false; } - delay(500); } + SerialGPS.setTimeout(10); + ver = SerialGPS.readStringUntil('\n'); + if (ver.startsWith("$GPTXT,01,01,02")) { + Serial.println("L76K GNSS init succeeded, using L76K GNSS Module\n"); + result = true; + } + delay(500); + // Initialize the L76K Chip, use GPS + GLONASS SerialGPS.write("$PCAS04,5*1C\r\n"); delay(250); diff --git a/examples/RadioLibExamples/Receive_Interrupt/LoRaBoards.cpp b/examples/RadioLibExamples/Receive_Interrupt/LoRaBoards.cpp index 8c90174..f5948b4 100644 --- a/examples/RadioLibExamples/Receive_Interrupt/LoRaBoards.cpp +++ b/examples/RadioLibExamples/Receive_Interrupt/LoRaBoards.cpp @@ -914,43 +914,43 @@ bool beginGPS() SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); bool result = false; uint32_t startTimeout ; - for (int i = 0; i < 3; ++i) { - SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); - delay(5); - // Get version information - startTimeout = millis() + 3000; - Serial.print("Try to init L76K . Wait stop ."); + SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); + delay(5); + // Get version information + startTimeout = millis() + 3000; + Serial.print("Try to init L76K . Wait stop ."); + SerialGPS.flush(); + + while (SerialGPS.available()) { + // Serial.print("."); + Serial.flush(); SerialGPS.flush(); - while (SerialGPS.available()) { - Serial.print("."); - SerialGPS.readString(); - if (millis() > startTimeout) { - Serial.println("Wait L76K stop NMEA timeout!"); - return false; - } - }; - Serial.println(); - SerialGPS.flush(); - delay(200); - - SerialGPS.write("$PCAS06,0*1B\r\n"); - startTimeout = millis() + 500; - String ver = ""; - while (!SerialGPS.available()) { - if (millis() > startTimeout) { - Serial.println("Get L76K timeout!"); - return false; - } + if (millis() > startTimeout) { + Serial.println("Wait L76K stop NMEA timeout!"); + return false; } - SerialGPS.setTimeout(10); - ver = SerialGPS.readStringUntil('\n'); - if (ver.startsWith("$GPTXT,01,01,02")) { - Serial.println("L76K GNSS init succeeded, using L76K GNSS Module\n"); - result = true; - break; + }; + Serial.println(); + SerialGPS.flush(); + delay(200); + + SerialGPS.write("$PCAS06,0*1B\r\n"); + startTimeout = millis() + 500; + String ver = ""; + while (!SerialGPS.available()) { + if (millis() > startTimeout) { + Serial.println("Get L76K timeout!"); + return false; } - delay(500); } + SerialGPS.setTimeout(10); + ver = SerialGPS.readStringUntil('\n'); + if (ver.startsWith("$GPTXT,01,01,02")) { + Serial.println("L76K GNSS init succeeded, using L76K GNSS Module\n"); + result = true; + } + delay(500); + // Initialize the L76K Chip, use GPS + GLONASS SerialGPS.write("$PCAS04,5*1C\r\n"); delay(250); diff --git a/examples/RadioLibExamples/Transmit_Interrupt/LoRaBoards.cpp b/examples/RadioLibExamples/Transmit_Interrupt/LoRaBoards.cpp index 8c90174..f5948b4 100644 --- a/examples/RadioLibExamples/Transmit_Interrupt/LoRaBoards.cpp +++ b/examples/RadioLibExamples/Transmit_Interrupt/LoRaBoards.cpp @@ -914,43 +914,43 @@ bool beginGPS() SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); bool result = false; uint32_t startTimeout ; - for (int i = 0; i < 3; ++i) { - SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); - delay(5); - // Get version information - startTimeout = millis() + 3000; - Serial.print("Try to init L76K . Wait stop ."); + SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); + delay(5); + // Get version information + startTimeout = millis() + 3000; + Serial.print("Try to init L76K . Wait stop ."); + SerialGPS.flush(); + + while (SerialGPS.available()) { + // Serial.print("."); + Serial.flush(); SerialGPS.flush(); - while (SerialGPS.available()) { - Serial.print("."); - SerialGPS.readString(); - if (millis() > startTimeout) { - Serial.println("Wait L76K stop NMEA timeout!"); - return false; - } - }; - Serial.println(); - SerialGPS.flush(); - delay(200); - - SerialGPS.write("$PCAS06,0*1B\r\n"); - startTimeout = millis() + 500; - String ver = ""; - while (!SerialGPS.available()) { - if (millis() > startTimeout) { - Serial.println("Get L76K timeout!"); - return false; - } + if (millis() > startTimeout) { + Serial.println("Wait L76K stop NMEA timeout!"); + return false; } - SerialGPS.setTimeout(10); - ver = SerialGPS.readStringUntil('\n'); - if (ver.startsWith("$GPTXT,01,01,02")) { - Serial.println("L76K GNSS init succeeded, using L76K GNSS Module\n"); - result = true; - break; + }; + Serial.println(); + SerialGPS.flush(); + delay(200); + + SerialGPS.write("$PCAS06,0*1B\r\n"); + startTimeout = millis() + 500; + String ver = ""; + while (!SerialGPS.available()) { + if (millis() > startTimeout) { + Serial.println("Get L76K timeout!"); + return false; } - delay(500); } + SerialGPS.setTimeout(10); + ver = SerialGPS.readStringUntil('\n'); + if (ver.startsWith("$GPTXT,01,01,02")) { + Serial.println("L76K GNSS init succeeded, using L76K GNSS Module\n"); + result = true; + } + delay(500); + // Initialize the L76K Chip, use GPS + GLONASS SerialGPS.write("$PCAS04,5*1C\r\n"); delay(250); diff --git a/examples/Sensor/BME280_AdvancedsettingsExample/LoRaBoards.cpp b/examples/Sensor/BME280_AdvancedsettingsExample/LoRaBoards.cpp index 8c90174..f5948b4 100644 --- a/examples/Sensor/BME280_AdvancedsettingsExample/LoRaBoards.cpp +++ b/examples/Sensor/BME280_AdvancedsettingsExample/LoRaBoards.cpp @@ -914,43 +914,43 @@ bool beginGPS() SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); bool result = false; uint32_t startTimeout ; - for (int i = 0; i < 3; ++i) { - SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); - delay(5); - // Get version information - startTimeout = millis() + 3000; - Serial.print("Try to init L76K . Wait stop ."); + SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); + delay(5); + // Get version information + startTimeout = millis() + 3000; + Serial.print("Try to init L76K . Wait stop ."); + SerialGPS.flush(); + + while (SerialGPS.available()) { + // Serial.print("."); + Serial.flush(); SerialGPS.flush(); - while (SerialGPS.available()) { - Serial.print("."); - SerialGPS.readString(); - if (millis() > startTimeout) { - Serial.println("Wait L76K stop NMEA timeout!"); - return false; - } - }; - Serial.println(); - SerialGPS.flush(); - delay(200); - - SerialGPS.write("$PCAS06,0*1B\r\n"); - startTimeout = millis() + 500; - String ver = ""; - while (!SerialGPS.available()) { - if (millis() > startTimeout) { - Serial.println("Get L76K timeout!"); - return false; - } + if (millis() > startTimeout) { + Serial.println("Wait L76K stop NMEA timeout!"); + return false; } - SerialGPS.setTimeout(10); - ver = SerialGPS.readStringUntil('\n'); - if (ver.startsWith("$GPTXT,01,01,02")) { - Serial.println("L76K GNSS init succeeded, using L76K GNSS Module\n"); - result = true; - break; + }; + Serial.println(); + SerialGPS.flush(); + delay(200); + + SerialGPS.write("$PCAS06,0*1B\r\n"); + startTimeout = millis() + 500; + String ver = ""; + while (!SerialGPS.available()) { + if (millis() > startTimeout) { + Serial.println("Get L76K timeout!"); + return false; } - delay(500); } + SerialGPS.setTimeout(10); + ver = SerialGPS.readStringUntil('\n'); + if (ver.startsWith("$GPTXT,01,01,02")) { + Serial.println("L76K GNSS init succeeded, using L76K GNSS Module\n"); + result = true; + } + delay(500); + // Initialize the L76K Chip, use GPS + GLONASS SerialGPS.write("$PCAS04,5*1C\r\n"); delay(250); diff --git a/examples/Sensor/BME280_TestExample/LoRaBoards.cpp b/examples/Sensor/BME280_TestExample/LoRaBoards.cpp index 8c90174..f5948b4 100644 --- a/examples/Sensor/BME280_TestExample/LoRaBoards.cpp +++ b/examples/Sensor/BME280_TestExample/LoRaBoards.cpp @@ -914,43 +914,43 @@ bool beginGPS() SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); bool result = false; uint32_t startTimeout ; - for (int i = 0; i < 3; ++i) { - SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); - delay(5); - // Get version information - startTimeout = millis() + 3000; - Serial.print("Try to init L76K . Wait stop ."); + SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); + delay(5); + // Get version information + startTimeout = millis() + 3000; + Serial.print("Try to init L76K . Wait stop ."); + SerialGPS.flush(); + + while (SerialGPS.available()) { + // Serial.print("."); + Serial.flush(); SerialGPS.flush(); - while (SerialGPS.available()) { - Serial.print("."); - SerialGPS.readString(); - if (millis() > startTimeout) { - Serial.println("Wait L76K stop NMEA timeout!"); - return false; - } - }; - Serial.println(); - SerialGPS.flush(); - delay(200); - - SerialGPS.write("$PCAS06,0*1B\r\n"); - startTimeout = millis() + 500; - String ver = ""; - while (!SerialGPS.available()) { - if (millis() > startTimeout) { - Serial.println("Get L76K timeout!"); - return false; - } + if (millis() > startTimeout) { + Serial.println("Wait L76K stop NMEA timeout!"); + return false; } - SerialGPS.setTimeout(10); - ver = SerialGPS.readStringUntil('\n'); - if (ver.startsWith("$GPTXT,01,01,02")) { - Serial.println("L76K GNSS init succeeded, using L76K GNSS Module\n"); - result = true; - break; + }; + Serial.println(); + SerialGPS.flush(); + delay(200); + + SerialGPS.write("$PCAS06,0*1B\r\n"); + startTimeout = millis() + 500; + String ver = ""; + while (!SerialGPS.available()) { + if (millis() > startTimeout) { + Serial.println("Get L76K timeout!"); + return false; } - delay(500); } + SerialGPS.setTimeout(10); + ver = SerialGPS.readStringUntil('\n'); + if (ver.startsWith("$GPTXT,01,01,02")) { + Serial.println("L76K GNSS init succeeded, using L76K GNSS Module\n"); + result = true; + } + delay(500); + // Initialize the L76K Chip, use GPS + GLONASS SerialGPS.write("$PCAS04,5*1C\r\n"); delay(250); diff --git a/examples/Sensor/BME280_UnifiedExample/LoRaBoards.cpp b/examples/Sensor/BME280_UnifiedExample/LoRaBoards.cpp index 8c90174..f5948b4 100644 --- a/examples/Sensor/BME280_UnifiedExample/LoRaBoards.cpp +++ b/examples/Sensor/BME280_UnifiedExample/LoRaBoards.cpp @@ -914,43 +914,43 @@ bool beginGPS() SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); bool result = false; uint32_t startTimeout ; - for (int i = 0; i < 3; ++i) { - SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); - delay(5); - // Get version information - startTimeout = millis() + 3000; - Serial.print("Try to init L76K . Wait stop ."); + SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); + delay(5); + // Get version information + startTimeout = millis() + 3000; + Serial.print("Try to init L76K . Wait stop ."); + SerialGPS.flush(); + + while (SerialGPS.available()) { + // Serial.print("."); + Serial.flush(); SerialGPS.flush(); - while (SerialGPS.available()) { - Serial.print("."); - SerialGPS.readString(); - if (millis() > startTimeout) { - Serial.println("Wait L76K stop NMEA timeout!"); - return false; - } - }; - Serial.println(); - SerialGPS.flush(); - delay(200); - - SerialGPS.write("$PCAS06,0*1B\r\n"); - startTimeout = millis() + 500; - String ver = ""; - while (!SerialGPS.available()) { - if (millis() > startTimeout) { - Serial.println("Get L76K timeout!"); - return false; - } + if (millis() > startTimeout) { + Serial.println("Wait L76K stop NMEA timeout!"); + return false; } - SerialGPS.setTimeout(10); - ver = SerialGPS.readStringUntil('\n'); - if (ver.startsWith("$GPTXT,01,01,02")) { - Serial.println("L76K GNSS init succeeded, using L76K GNSS Module\n"); - result = true; - break; + }; + Serial.println(); + SerialGPS.flush(); + delay(200); + + SerialGPS.write("$PCAS06,0*1B\r\n"); + startTimeout = millis() + 500; + String ver = ""; + while (!SerialGPS.available()) { + if (millis() > startTimeout) { + Serial.println("Get L76K timeout!"); + return false; } - delay(500); } + SerialGPS.setTimeout(10); + ver = SerialGPS.readStringUntil('\n'); + if (ver.startsWith("$GPTXT,01,01,02")) { + Serial.println("L76K GNSS init succeeded, using L76K GNSS Module\n"); + result = true; + } + delay(500); + // Initialize the L76K Chip, use GPS + GLONASS SerialGPS.write("$PCAS04,5*1C\r\n"); delay(250); diff --git a/examples/Sensor/PCF8563_AlarmByUnits/LoRaBoards.cpp b/examples/Sensor/PCF8563_AlarmByUnits/LoRaBoards.cpp index 8c90174..f5948b4 100644 --- a/examples/Sensor/PCF8563_AlarmByUnits/LoRaBoards.cpp +++ b/examples/Sensor/PCF8563_AlarmByUnits/LoRaBoards.cpp @@ -914,43 +914,43 @@ bool beginGPS() SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); bool result = false; uint32_t startTimeout ; - for (int i = 0; i < 3; ++i) { - SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); - delay(5); - // Get version information - startTimeout = millis() + 3000; - Serial.print("Try to init L76K . Wait stop ."); + SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); + delay(5); + // Get version information + startTimeout = millis() + 3000; + Serial.print("Try to init L76K . Wait stop ."); + SerialGPS.flush(); + + while (SerialGPS.available()) { + // Serial.print("."); + Serial.flush(); SerialGPS.flush(); - while (SerialGPS.available()) { - Serial.print("."); - SerialGPS.readString(); - if (millis() > startTimeout) { - Serial.println("Wait L76K stop NMEA timeout!"); - return false; - } - }; - Serial.println(); - SerialGPS.flush(); - delay(200); - - SerialGPS.write("$PCAS06,0*1B\r\n"); - startTimeout = millis() + 500; - String ver = ""; - while (!SerialGPS.available()) { - if (millis() > startTimeout) { - Serial.println("Get L76K timeout!"); - return false; - } + if (millis() > startTimeout) { + Serial.println("Wait L76K stop NMEA timeout!"); + return false; } - SerialGPS.setTimeout(10); - ver = SerialGPS.readStringUntil('\n'); - if (ver.startsWith("$GPTXT,01,01,02")) { - Serial.println("L76K GNSS init succeeded, using L76K GNSS Module\n"); - result = true; - break; + }; + Serial.println(); + SerialGPS.flush(); + delay(200); + + SerialGPS.write("$PCAS06,0*1B\r\n"); + startTimeout = millis() + 500; + String ver = ""; + while (!SerialGPS.available()) { + if (millis() > startTimeout) { + Serial.println("Get L76K timeout!"); + return false; } - delay(500); } + SerialGPS.setTimeout(10); + ver = SerialGPS.readStringUntil('\n'); + if (ver.startsWith("$GPTXT,01,01,02")) { + Serial.println("L76K GNSS init succeeded, using L76K GNSS Module\n"); + result = true; + } + delay(500); + // Initialize the L76K Chip, use GPS + GLONASS SerialGPS.write("$PCAS04,5*1C\r\n"); delay(250); diff --git a/examples/Sensor/PCF8563_SimpleTime/LoRaBoards.cpp b/examples/Sensor/PCF8563_SimpleTime/LoRaBoards.cpp index 8c90174..f5948b4 100644 --- a/examples/Sensor/PCF8563_SimpleTime/LoRaBoards.cpp +++ b/examples/Sensor/PCF8563_SimpleTime/LoRaBoards.cpp @@ -914,43 +914,43 @@ bool beginGPS() SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); bool result = false; uint32_t startTimeout ; - for (int i = 0; i < 3; ++i) { - SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); - delay(5); - // Get version information - startTimeout = millis() + 3000; - Serial.print("Try to init L76K . Wait stop ."); + SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); + delay(5); + // Get version information + startTimeout = millis() + 3000; + Serial.print("Try to init L76K . Wait stop ."); + SerialGPS.flush(); + + while (SerialGPS.available()) { + // Serial.print("."); + Serial.flush(); SerialGPS.flush(); - while (SerialGPS.available()) { - Serial.print("."); - SerialGPS.readString(); - if (millis() > startTimeout) { - Serial.println("Wait L76K stop NMEA timeout!"); - return false; - } - }; - Serial.println(); - SerialGPS.flush(); - delay(200); - - SerialGPS.write("$PCAS06,0*1B\r\n"); - startTimeout = millis() + 500; - String ver = ""; - while (!SerialGPS.available()) { - if (millis() > startTimeout) { - Serial.println("Get L76K timeout!"); - return false; - } + if (millis() > startTimeout) { + Serial.println("Wait L76K stop NMEA timeout!"); + return false; } - SerialGPS.setTimeout(10); - ver = SerialGPS.readStringUntil('\n'); - if (ver.startsWith("$GPTXT,01,01,02")) { - Serial.println("L76K GNSS init succeeded, using L76K GNSS Module\n"); - result = true; - break; + }; + Serial.println(); + SerialGPS.flush(); + delay(200); + + SerialGPS.write("$PCAS06,0*1B\r\n"); + startTimeout = millis() + 500; + String ver = ""; + while (!SerialGPS.available()) { + if (millis() > startTimeout) { + Serial.println("Get L76K timeout!"); + return false; } - delay(500); } + SerialGPS.setTimeout(10); + ver = SerialGPS.readStringUntil('\n'); + if (ver.startsWith("$GPTXT,01,01,02")) { + Serial.println("L76K GNSS init succeeded, using L76K GNSS Module\n"); + result = true; + } + delay(500); + // Initialize the L76K Chip, use GPS + GLONASS SerialGPS.write("$PCAS04,5*1C\r\n"); delay(250); diff --git a/examples/Sensor/PCF8563_TimeLib/LoRaBoards.cpp b/examples/Sensor/PCF8563_TimeLib/LoRaBoards.cpp index 8c90174..f5948b4 100644 --- a/examples/Sensor/PCF8563_TimeLib/LoRaBoards.cpp +++ b/examples/Sensor/PCF8563_TimeLib/LoRaBoards.cpp @@ -914,43 +914,43 @@ bool beginGPS() SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); bool result = false; uint32_t startTimeout ; - for (int i = 0; i < 3; ++i) { - SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); - delay(5); - // Get version information - startTimeout = millis() + 3000; - Serial.print("Try to init L76K . Wait stop ."); + SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); + delay(5); + // Get version information + startTimeout = millis() + 3000; + Serial.print("Try to init L76K . Wait stop ."); + SerialGPS.flush(); + + while (SerialGPS.available()) { + // Serial.print("."); + Serial.flush(); SerialGPS.flush(); - while (SerialGPS.available()) { - Serial.print("."); - SerialGPS.readString(); - if (millis() > startTimeout) { - Serial.println("Wait L76K stop NMEA timeout!"); - return false; - } - }; - Serial.println(); - SerialGPS.flush(); - delay(200); - - SerialGPS.write("$PCAS06,0*1B\r\n"); - startTimeout = millis() + 500; - String ver = ""; - while (!SerialGPS.available()) { - if (millis() > startTimeout) { - Serial.println("Get L76K timeout!"); - return false; - } + if (millis() > startTimeout) { + Serial.println("Wait L76K stop NMEA timeout!"); + return false; } - SerialGPS.setTimeout(10); - ver = SerialGPS.readStringUntil('\n'); - if (ver.startsWith("$GPTXT,01,01,02")) { - Serial.println("L76K GNSS init succeeded, using L76K GNSS Module\n"); - result = true; - break; + }; + Serial.println(); + SerialGPS.flush(); + delay(200); + + SerialGPS.write("$PCAS06,0*1B\r\n"); + startTimeout = millis() + 500; + String ver = ""; + while (!SerialGPS.available()) { + if (millis() > startTimeout) { + Serial.println("Get L76K timeout!"); + return false; } - delay(500); } + SerialGPS.setTimeout(10); + ver = SerialGPS.readStringUntil('\n'); + if (ver.startsWith("$GPTXT,01,01,02")) { + Serial.println("L76K GNSS init succeeded, using L76K GNSS Module\n"); + result = true; + } + delay(500); + // Initialize the L76K Chip, use GPS + GLONASS SerialGPS.write("$PCAS04,5*1C\r\n"); delay(250); diff --git a/examples/Sensor/PCF8563_TimeSynchronization/LoRaBoards.cpp b/examples/Sensor/PCF8563_TimeSynchronization/LoRaBoards.cpp index 8c90174..f5948b4 100644 --- a/examples/Sensor/PCF8563_TimeSynchronization/LoRaBoards.cpp +++ b/examples/Sensor/PCF8563_TimeSynchronization/LoRaBoards.cpp @@ -914,43 +914,43 @@ bool beginGPS() SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); bool result = false; uint32_t startTimeout ; - for (int i = 0; i < 3; ++i) { - SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); - delay(5); - // Get version information - startTimeout = millis() + 3000; - Serial.print("Try to init L76K . Wait stop ."); + SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); + delay(5); + // Get version information + startTimeout = millis() + 3000; + Serial.print("Try to init L76K . Wait stop ."); + SerialGPS.flush(); + + while (SerialGPS.available()) { + // Serial.print("."); + Serial.flush(); SerialGPS.flush(); - while (SerialGPS.available()) { - Serial.print("."); - SerialGPS.readString(); - if (millis() > startTimeout) { - Serial.println("Wait L76K stop NMEA timeout!"); - return false; - } - }; - Serial.println(); - SerialGPS.flush(); - delay(200); - - SerialGPS.write("$PCAS06,0*1B\r\n"); - startTimeout = millis() + 500; - String ver = ""; - while (!SerialGPS.available()) { - if (millis() > startTimeout) { - Serial.println("Get L76K timeout!"); - return false; - } + if (millis() > startTimeout) { + Serial.println("Wait L76K stop NMEA timeout!"); + return false; } - SerialGPS.setTimeout(10); - ver = SerialGPS.readStringUntil('\n'); - if (ver.startsWith("$GPTXT,01,01,02")) { - Serial.println("L76K GNSS init succeeded, using L76K GNSS Module\n"); - result = true; - break; + }; + Serial.println(); + SerialGPS.flush(); + delay(200); + + SerialGPS.write("$PCAS06,0*1B\r\n"); + startTimeout = millis() + 500; + String ver = ""; + while (!SerialGPS.available()) { + if (millis() > startTimeout) { + Serial.println("Get L76K timeout!"); + return false; } - delay(500); } + SerialGPS.setTimeout(10); + ver = SerialGPS.readStringUntil('\n'); + if (ver.startsWith("$GPTXT,01,01,02")) { + Serial.println("L76K GNSS init succeeded, using L76K GNSS Module\n"); + result = true; + } + delay(500); + // Initialize the L76K Chip, use GPS + GLONASS SerialGPS.write("$PCAS04,5*1C\r\n"); delay(250); diff --git a/examples/Sensor/QMC6310_CalibrateExample/LoRaBoards.cpp b/examples/Sensor/QMC6310_CalibrateExample/LoRaBoards.cpp index 8c90174..f5948b4 100644 --- a/examples/Sensor/QMC6310_CalibrateExample/LoRaBoards.cpp +++ b/examples/Sensor/QMC6310_CalibrateExample/LoRaBoards.cpp @@ -914,43 +914,43 @@ bool beginGPS() SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); bool result = false; uint32_t startTimeout ; - for (int i = 0; i < 3; ++i) { - SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); - delay(5); - // Get version information - startTimeout = millis() + 3000; - Serial.print("Try to init L76K . Wait stop ."); + SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); + delay(5); + // Get version information + startTimeout = millis() + 3000; + Serial.print("Try to init L76K . Wait stop ."); + SerialGPS.flush(); + + while (SerialGPS.available()) { + // Serial.print("."); + Serial.flush(); SerialGPS.flush(); - while (SerialGPS.available()) { - Serial.print("."); - SerialGPS.readString(); - if (millis() > startTimeout) { - Serial.println("Wait L76K stop NMEA timeout!"); - return false; - } - }; - Serial.println(); - SerialGPS.flush(); - delay(200); - - SerialGPS.write("$PCAS06,0*1B\r\n"); - startTimeout = millis() + 500; - String ver = ""; - while (!SerialGPS.available()) { - if (millis() > startTimeout) { - Serial.println("Get L76K timeout!"); - return false; - } + if (millis() > startTimeout) { + Serial.println("Wait L76K stop NMEA timeout!"); + return false; } - SerialGPS.setTimeout(10); - ver = SerialGPS.readStringUntil('\n'); - if (ver.startsWith("$GPTXT,01,01,02")) { - Serial.println("L76K GNSS init succeeded, using L76K GNSS Module\n"); - result = true; - break; + }; + Serial.println(); + SerialGPS.flush(); + delay(200); + + SerialGPS.write("$PCAS06,0*1B\r\n"); + startTimeout = millis() + 500; + String ver = ""; + while (!SerialGPS.available()) { + if (millis() > startTimeout) { + Serial.println("Get L76K timeout!"); + return false; } - delay(500); } + SerialGPS.setTimeout(10); + ver = SerialGPS.readStringUntil('\n'); + if (ver.startsWith("$GPTXT,01,01,02")) { + Serial.println("L76K GNSS init succeeded, using L76K GNSS Module\n"); + result = true; + } + delay(500); + // Initialize the L76K Chip, use GPS + GLONASS SerialGPS.write("$PCAS04,5*1C\r\n"); delay(250); diff --git a/examples/Sensor/QMC6310_CompassExample/LoRaBoards.cpp b/examples/Sensor/QMC6310_CompassExample/LoRaBoards.cpp index 8c90174..f5948b4 100644 --- a/examples/Sensor/QMC6310_CompassExample/LoRaBoards.cpp +++ b/examples/Sensor/QMC6310_CompassExample/LoRaBoards.cpp @@ -914,43 +914,43 @@ bool beginGPS() SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); bool result = false; uint32_t startTimeout ; - for (int i = 0; i < 3; ++i) { - SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); - delay(5); - // Get version information - startTimeout = millis() + 3000; - Serial.print("Try to init L76K . Wait stop ."); + SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); + delay(5); + // Get version information + startTimeout = millis() + 3000; + Serial.print("Try to init L76K . Wait stop ."); + SerialGPS.flush(); + + while (SerialGPS.available()) { + // Serial.print("."); + Serial.flush(); SerialGPS.flush(); - while (SerialGPS.available()) { - Serial.print("."); - SerialGPS.readString(); - if (millis() > startTimeout) { - Serial.println("Wait L76K stop NMEA timeout!"); - return false; - } - }; - Serial.println(); - SerialGPS.flush(); - delay(200); - - SerialGPS.write("$PCAS06,0*1B\r\n"); - startTimeout = millis() + 500; - String ver = ""; - while (!SerialGPS.available()) { - if (millis() > startTimeout) { - Serial.println("Get L76K timeout!"); - return false; - } + if (millis() > startTimeout) { + Serial.println("Wait L76K stop NMEA timeout!"); + return false; } - SerialGPS.setTimeout(10); - ver = SerialGPS.readStringUntil('\n'); - if (ver.startsWith("$GPTXT,01,01,02")) { - Serial.println("L76K GNSS init succeeded, using L76K GNSS Module\n"); - result = true; - break; + }; + Serial.println(); + SerialGPS.flush(); + delay(200); + + SerialGPS.write("$PCAS06,0*1B\r\n"); + startTimeout = millis() + 500; + String ver = ""; + while (!SerialGPS.available()) { + if (millis() > startTimeout) { + Serial.println("Get L76K timeout!"); + return false; } - delay(500); } + SerialGPS.setTimeout(10); + ver = SerialGPS.readStringUntil('\n'); + if (ver.startsWith("$GPTXT,01,01,02")) { + Serial.println("L76K GNSS init succeeded, using L76K GNSS Module\n"); + result = true; + } + delay(500); + // Initialize the L76K Chip, use GPS + GLONASS SerialGPS.write("$PCAS04,5*1C\r\n"); delay(250); diff --git a/examples/Sensor/QMC6310_GetDataExample/LoRaBoards.cpp b/examples/Sensor/QMC6310_GetDataExample/LoRaBoards.cpp index 8c90174..f5948b4 100644 --- a/examples/Sensor/QMC6310_GetDataExample/LoRaBoards.cpp +++ b/examples/Sensor/QMC6310_GetDataExample/LoRaBoards.cpp @@ -914,43 +914,43 @@ bool beginGPS() SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); bool result = false; uint32_t startTimeout ; - for (int i = 0; i < 3; ++i) { - SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); - delay(5); - // Get version information - startTimeout = millis() + 3000; - Serial.print("Try to init L76K . Wait stop ."); + SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); + delay(5); + // Get version information + startTimeout = millis() + 3000; + Serial.print("Try to init L76K . Wait stop ."); + SerialGPS.flush(); + + while (SerialGPS.available()) { + // Serial.print("."); + Serial.flush(); SerialGPS.flush(); - while (SerialGPS.available()) { - Serial.print("."); - SerialGPS.readString(); - if (millis() > startTimeout) { - Serial.println("Wait L76K stop NMEA timeout!"); - return false; - } - }; - Serial.println(); - SerialGPS.flush(); - delay(200); - - SerialGPS.write("$PCAS06,0*1B\r\n"); - startTimeout = millis() + 500; - String ver = ""; - while (!SerialGPS.available()) { - if (millis() > startTimeout) { - Serial.println("Get L76K timeout!"); - return false; - } + if (millis() > startTimeout) { + Serial.println("Wait L76K stop NMEA timeout!"); + return false; } - SerialGPS.setTimeout(10); - ver = SerialGPS.readStringUntil('\n'); - if (ver.startsWith("$GPTXT,01,01,02")) { - Serial.println("L76K GNSS init succeeded, using L76K GNSS Module\n"); - result = true; - break; + }; + Serial.println(); + SerialGPS.flush(); + delay(200); + + SerialGPS.write("$PCAS06,0*1B\r\n"); + startTimeout = millis() + 500; + String ver = ""; + while (!SerialGPS.available()) { + if (millis() > startTimeout) { + Serial.println("Get L76K timeout!"); + return false; } - delay(500); } + SerialGPS.setTimeout(10); + ver = SerialGPS.readStringUntil('\n'); + if (ver.startsWith("$GPTXT,01,01,02")) { + Serial.println("L76K GNSS init succeeded, using L76K GNSS Module\n"); + result = true; + } + delay(500); + // Initialize the L76K Chip, use GPS + GLONASS SerialGPS.write("$PCAS04,5*1C\r\n"); delay(250); diff --git a/examples/Sensor/QMC6310_GetPolarExample/LoRaBoards.cpp b/examples/Sensor/QMC6310_GetPolarExample/LoRaBoards.cpp index 8c90174..f5948b4 100644 --- a/examples/Sensor/QMC6310_GetPolarExample/LoRaBoards.cpp +++ b/examples/Sensor/QMC6310_GetPolarExample/LoRaBoards.cpp @@ -914,43 +914,43 @@ bool beginGPS() SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); bool result = false; uint32_t startTimeout ; - for (int i = 0; i < 3; ++i) { - SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); - delay(5); - // Get version information - startTimeout = millis() + 3000; - Serial.print("Try to init L76K . Wait stop ."); + SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); + delay(5); + // Get version information + startTimeout = millis() + 3000; + Serial.print("Try to init L76K . Wait stop ."); + SerialGPS.flush(); + + while (SerialGPS.available()) { + // Serial.print("."); + Serial.flush(); SerialGPS.flush(); - while (SerialGPS.available()) { - Serial.print("."); - SerialGPS.readString(); - if (millis() > startTimeout) { - Serial.println("Wait L76K stop NMEA timeout!"); - return false; - } - }; - Serial.println(); - SerialGPS.flush(); - delay(200); - - SerialGPS.write("$PCAS06,0*1B\r\n"); - startTimeout = millis() + 500; - String ver = ""; - while (!SerialGPS.available()) { - if (millis() > startTimeout) { - Serial.println("Get L76K timeout!"); - return false; - } + if (millis() > startTimeout) { + Serial.println("Wait L76K stop NMEA timeout!"); + return false; } - SerialGPS.setTimeout(10); - ver = SerialGPS.readStringUntil('\n'); - if (ver.startsWith("$GPTXT,01,01,02")) { - Serial.println("L76K GNSS init succeeded, using L76K GNSS Module\n"); - result = true; - break; + }; + Serial.println(); + SerialGPS.flush(); + delay(200); + + SerialGPS.write("$PCAS06,0*1B\r\n"); + startTimeout = millis() + 500; + String ver = ""; + while (!SerialGPS.available()) { + if (millis() > startTimeout) { + Serial.println("Get L76K timeout!"); + return false; } - delay(500); } + SerialGPS.setTimeout(10); + ver = SerialGPS.readStringUntil('\n'); + if (ver.startsWith("$GPTXT,01,01,02")) { + Serial.println("L76K GNSS init succeeded, using L76K GNSS Module\n"); + result = true; + } + delay(500); + // Initialize the L76K Chip, use GPS + GLONASS SerialGPS.write("$PCAS04,5*1C\r\n"); delay(250); diff --git a/examples/Sensor/QMI8658_BlockExample/LoRaBoards.cpp b/examples/Sensor/QMI8658_BlockExample/LoRaBoards.cpp index 8c90174..f5948b4 100644 --- a/examples/Sensor/QMI8658_BlockExample/LoRaBoards.cpp +++ b/examples/Sensor/QMI8658_BlockExample/LoRaBoards.cpp @@ -914,43 +914,43 @@ bool beginGPS() SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); bool result = false; uint32_t startTimeout ; - for (int i = 0; i < 3; ++i) { - SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); - delay(5); - // Get version information - startTimeout = millis() + 3000; - Serial.print("Try to init L76K . Wait stop ."); + SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); + delay(5); + // Get version information + startTimeout = millis() + 3000; + Serial.print("Try to init L76K . Wait stop ."); + SerialGPS.flush(); + + while (SerialGPS.available()) { + // Serial.print("."); + Serial.flush(); SerialGPS.flush(); - while (SerialGPS.available()) { - Serial.print("."); - SerialGPS.readString(); - if (millis() > startTimeout) { - Serial.println("Wait L76K stop NMEA timeout!"); - return false; - } - }; - Serial.println(); - SerialGPS.flush(); - delay(200); - - SerialGPS.write("$PCAS06,0*1B\r\n"); - startTimeout = millis() + 500; - String ver = ""; - while (!SerialGPS.available()) { - if (millis() > startTimeout) { - Serial.println("Get L76K timeout!"); - return false; - } + if (millis() > startTimeout) { + Serial.println("Wait L76K stop NMEA timeout!"); + return false; } - SerialGPS.setTimeout(10); - ver = SerialGPS.readStringUntil('\n'); - if (ver.startsWith("$GPTXT,01,01,02")) { - Serial.println("L76K GNSS init succeeded, using L76K GNSS Module\n"); - result = true; - break; + }; + Serial.println(); + SerialGPS.flush(); + delay(200); + + SerialGPS.write("$PCAS06,0*1B\r\n"); + startTimeout = millis() + 500; + String ver = ""; + while (!SerialGPS.available()) { + if (millis() > startTimeout) { + Serial.println("Get L76K timeout!"); + return false; } - delay(500); } + SerialGPS.setTimeout(10); + ver = SerialGPS.readStringUntil('\n'); + if (ver.startsWith("$GPTXT,01,01,02")) { + Serial.println("L76K GNSS init succeeded, using L76K GNSS Module\n"); + result = true; + } + delay(500); + // Initialize the L76K Chip, use GPS + GLONASS SerialGPS.write("$PCAS04,5*1C\r\n"); delay(250); diff --git a/examples/Sensor/QMI8658_GetDataExample/LoRaBoards.cpp b/examples/Sensor/QMI8658_GetDataExample/LoRaBoards.cpp index 8c90174..f5948b4 100644 --- a/examples/Sensor/QMI8658_GetDataExample/LoRaBoards.cpp +++ b/examples/Sensor/QMI8658_GetDataExample/LoRaBoards.cpp @@ -914,43 +914,43 @@ bool beginGPS() SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); bool result = false; uint32_t startTimeout ; - for (int i = 0; i < 3; ++i) { - SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); - delay(5); - // Get version information - startTimeout = millis() + 3000; - Serial.print("Try to init L76K . Wait stop ."); + SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); + delay(5); + // Get version information + startTimeout = millis() + 3000; + Serial.print("Try to init L76K . Wait stop ."); + SerialGPS.flush(); + + while (SerialGPS.available()) { + // Serial.print("."); + Serial.flush(); SerialGPS.flush(); - while (SerialGPS.available()) { - Serial.print("."); - SerialGPS.readString(); - if (millis() > startTimeout) { - Serial.println("Wait L76K stop NMEA timeout!"); - return false; - } - }; - Serial.println(); - SerialGPS.flush(); - delay(200); - - SerialGPS.write("$PCAS06,0*1B\r\n"); - startTimeout = millis() + 500; - String ver = ""; - while (!SerialGPS.available()) { - if (millis() > startTimeout) { - Serial.println("Get L76K timeout!"); - return false; - } + if (millis() > startTimeout) { + Serial.println("Wait L76K stop NMEA timeout!"); + return false; } - SerialGPS.setTimeout(10); - ver = SerialGPS.readStringUntil('\n'); - if (ver.startsWith("$GPTXT,01,01,02")) { - Serial.println("L76K GNSS init succeeded, using L76K GNSS Module\n"); - result = true; - break; + }; + Serial.println(); + SerialGPS.flush(); + delay(200); + + SerialGPS.write("$PCAS06,0*1B\r\n"); + startTimeout = millis() + 500; + String ver = ""; + while (!SerialGPS.available()) { + if (millis() > startTimeout) { + Serial.println("Get L76K timeout!"); + return false; } - delay(500); } + SerialGPS.setTimeout(10); + ver = SerialGPS.readStringUntil('\n'); + if (ver.startsWith("$GPTXT,01,01,02")) { + Serial.println("L76K GNSS init succeeded, using L76K GNSS Module\n"); + result = true; + } + delay(500); + // Initialize the L76K Chip, use GPS + GLONASS SerialGPS.write("$PCAS04,5*1C\r\n"); delay(250); diff --git a/examples/Sensor/QMI8658_InterruptBlockExample/LoRaBoards.cpp b/examples/Sensor/QMI8658_InterruptBlockExample/LoRaBoards.cpp index 8c90174..f5948b4 100644 --- a/examples/Sensor/QMI8658_InterruptBlockExample/LoRaBoards.cpp +++ b/examples/Sensor/QMI8658_InterruptBlockExample/LoRaBoards.cpp @@ -914,43 +914,43 @@ bool beginGPS() SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); bool result = false; uint32_t startTimeout ; - for (int i = 0; i < 3; ++i) { - SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); - delay(5); - // Get version information - startTimeout = millis() + 3000; - Serial.print("Try to init L76K . Wait stop ."); + SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); + delay(5); + // Get version information + startTimeout = millis() + 3000; + Serial.print("Try to init L76K . Wait stop ."); + SerialGPS.flush(); + + while (SerialGPS.available()) { + // Serial.print("."); + Serial.flush(); SerialGPS.flush(); - while (SerialGPS.available()) { - Serial.print("."); - SerialGPS.readString(); - if (millis() > startTimeout) { - Serial.println("Wait L76K stop NMEA timeout!"); - return false; - } - }; - Serial.println(); - SerialGPS.flush(); - delay(200); - - SerialGPS.write("$PCAS06,0*1B\r\n"); - startTimeout = millis() + 500; - String ver = ""; - while (!SerialGPS.available()) { - if (millis() > startTimeout) { - Serial.println("Get L76K timeout!"); - return false; - } + if (millis() > startTimeout) { + Serial.println("Wait L76K stop NMEA timeout!"); + return false; } - SerialGPS.setTimeout(10); - ver = SerialGPS.readStringUntil('\n'); - if (ver.startsWith("$GPTXT,01,01,02")) { - Serial.println("L76K GNSS init succeeded, using L76K GNSS Module\n"); - result = true; - break; + }; + Serial.println(); + SerialGPS.flush(); + delay(200); + + SerialGPS.write("$PCAS06,0*1B\r\n"); + startTimeout = millis() + 500; + String ver = ""; + while (!SerialGPS.available()) { + if (millis() > startTimeout) { + Serial.println("Get L76K timeout!"); + return false; } - delay(500); } + SerialGPS.setTimeout(10); + ver = SerialGPS.readStringUntil('\n'); + if (ver.startsWith("$GPTXT,01,01,02")) { + Serial.println("L76K GNSS init succeeded, using L76K GNSS Module\n"); + result = true; + } + delay(500); + // Initialize the L76K Chip, use GPS + GLONASS SerialGPS.write("$PCAS04,5*1C\r\n"); delay(250); diff --git a/examples/Sensor/QMI8658_InterruptExample/LoRaBoards.cpp b/examples/Sensor/QMI8658_InterruptExample/LoRaBoards.cpp index 8c90174..f5948b4 100644 --- a/examples/Sensor/QMI8658_InterruptExample/LoRaBoards.cpp +++ b/examples/Sensor/QMI8658_InterruptExample/LoRaBoards.cpp @@ -914,43 +914,43 @@ bool beginGPS() SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); bool result = false; uint32_t startTimeout ; - for (int i = 0; i < 3; ++i) { - SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); - delay(5); - // Get version information - startTimeout = millis() + 3000; - Serial.print("Try to init L76K . Wait stop ."); + SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); + delay(5); + // Get version information + startTimeout = millis() + 3000; + Serial.print("Try to init L76K . Wait stop ."); + SerialGPS.flush(); + + while (SerialGPS.available()) { + // Serial.print("."); + Serial.flush(); SerialGPS.flush(); - while (SerialGPS.available()) { - Serial.print("."); - SerialGPS.readString(); - if (millis() > startTimeout) { - Serial.println("Wait L76K stop NMEA timeout!"); - return false; - } - }; - Serial.println(); - SerialGPS.flush(); - delay(200); - - SerialGPS.write("$PCAS06,0*1B\r\n"); - startTimeout = millis() + 500; - String ver = ""; - while (!SerialGPS.available()) { - if (millis() > startTimeout) { - Serial.println("Get L76K timeout!"); - return false; - } + if (millis() > startTimeout) { + Serial.println("Wait L76K stop NMEA timeout!"); + return false; } - SerialGPS.setTimeout(10); - ver = SerialGPS.readStringUntil('\n'); - if (ver.startsWith("$GPTXT,01,01,02")) { - Serial.println("L76K GNSS init succeeded, using L76K GNSS Module\n"); - result = true; - break; + }; + Serial.println(); + SerialGPS.flush(); + delay(200); + + SerialGPS.write("$PCAS06,0*1B\r\n"); + startTimeout = millis() + 500; + String ver = ""; + while (!SerialGPS.available()) { + if (millis() > startTimeout) { + Serial.println("Get L76K timeout!"); + return false; } - delay(500); } + SerialGPS.setTimeout(10); + ver = SerialGPS.readStringUntil('\n'); + if (ver.startsWith("$GPTXT,01,01,02")) { + Serial.println("L76K GNSS init succeeded, using L76K GNSS Module\n"); + result = true; + } + delay(500); + // Initialize the L76K Chip, use GPS + GLONASS SerialGPS.write("$PCAS04,5*1C\r\n"); delay(250); diff --git a/examples/Sensor/QMI8658_LockingMechanismExample/LoRaBoards.cpp b/examples/Sensor/QMI8658_LockingMechanismExample/LoRaBoards.cpp index 8c90174..f5948b4 100644 --- a/examples/Sensor/QMI8658_LockingMechanismExample/LoRaBoards.cpp +++ b/examples/Sensor/QMI8658_LockingMechanismExample/LoRaBoards.cpp @@ -914,43 +914,43 @@ bool beginGPS() SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); bool result = false; uint32_t startTimeout ; - for (int i = 0; i < 3; ++i) { - SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); - delay(5); - // Get version information - startTimeout = millis() + 3000; - Serial.print("Try to init L76K . Wait stop ."); + SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); + delay(5); + // Get version information + startTimeout = millis() + 3000; + Serial.print("Try to init L76K . Wait stop ."); + SerialGPS.flush(); + + while (SerialGPS.available()) { + // Serial.print("."); + Serial.flush(); SerialGPS.flush(); - while (SerialGPS.available()) { - Serial.print("."); - SerialGPS.readString(); - if (millis() > startTimeout) { - Serial.println("Wait L76K stop NMEA timeout!"); - return false; - } - }; - Serial.println(); - SerialGPS.flush(); - delay(200); - - SerialGPS.write("$PCAS06,0*1B\r\n"); - startTimeout = millis() + 500; - String ver = ""; - while (!SerialGPS.available()) { - if (millis() > startTimeout) { - Serial.println("Get L76K timeout!"); - return false; - } + if (millis() > startTimeout) { + Serial.println("Wait L76K stop NMEA timeout!"); + return false; } - SerialGPS.setTimeout(10); - ver = SerialGPS.readStringUntil('\n'); - if (ver.startsWith("$GPTXT,01,01,02")) { - Serial.println("L76K GNSS init succeeded, using L76K GNSS Module\n"); - result = true; - break; + }; + Serial.println(); + SerialGPS.flush(); + delay(200); + + SerialGPS.write("$PCAS06,0*1B\r\n"); + startTimeout = millis() + 500; + String ver = ""; + while (!SerialGPS.available()) { + if (millis() > startTimeout) { + Serial.println("Get L76K timeout!"); + return false; } - delay(500); } + SerialGPS.setTimeout(10); + ver = SerialGPS.readStringUntil('\n'); + if (ver.startsWith("$GPTXT,01,01,02")) { + Serial.println("L76K GNSS init succeeded, using L76K GNSS Module\n"); + result = true; + } + delay(500); + // Initialize the L76K Chip, use GPS + GLONASS SerialGPS.write("$PCAS04,5*1C\r\n"); delay(250); diff --git a/examples/Sensor/QMI8658_MadgwickAHRS/LoRaBoards.cpp b/examples/Sensor/QMI8658_MadgwickAHRS/LoRaBoards.cpp index 8c90174..f5948b4 100644 --- a/examples/Sensor/QMI8658_MadgwickAHRS/LoRaBoards.cpp +++ b/examples/Sensor/QMI8658_MadgwickAHRS/LoRaBoards.cpp @@ -914,43 +914,43 @@ bool beginGPS() SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); bool result = false; uint32_t startTimeout ; - for (int i = 0; i < 3; ++i) { - SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); - delay(5); - // Get version information - startTimeout = millis() + 3000; - Serial.print("Try to init L76K . Wait stop ."); + SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); + delay(5); + // Get version information + startTimeout = millis() + 3000; + Serial.print("Try to init L76K . Wait stop ."); + SerialGPS.flush(); + + while (SerialGPS.available()) { + // Serial.print("."); + Serial.flush(); SerialGPS.flush(); - while (SerialGPS.available()) { - Serial.print("."); - SerialGPS.readString(); - if (millis() > startTimeout) { - Serial.println("Wait L76K stop NMEA timeout!"); - return false; - } - }; - Serial.println(); - SerialGPS.flush(); - delay(200); - - SerialGPS.write("$PCAS06,0*1B\r\n"); - startTimeout = millis() + 500; - String ver = ""; - while (!SerialGPS.available()) { - if (millis() > startTimeout) { - Serial.println("Get L76K timeout!"); - return false; - } + if (millis() > startTimeout) { + Serial.println("Wait L76K stop NMEA timeout!"); + return false; } - SerialGPS.setTimeout(10); - ver = SerialGPS.readStringUntil('\n'); - if (ver.startsWith("$GPTXT,01,01,02")) { - Serial.println("L76K GNSS init succeeded, using L76K GNSS Module\n"); - result = true; - break; + }; + Serial.println(); + SerialGPS.flush(); + delay(200); + + SerialGPS.write("$PCAS06,0*1B\r\n"); + startTimeout = millis() + 500; + String ver = ""; + while (!SerialGPS.available()) { + if (millis() > startTimeout) { + Serial.println("Get L76K timeout!"); + return false; } - delay(500); } + SerialGPS.setTimeout(10); + ver = SerialGPS.readStringUntil('\n'); + if (ver.startsWith("$GPTXT,01,01,02")) { + Serial.println("L76K GNSS init succeeded, using L76K GNSS Module\n"); + result = true; + } + delay(500); + // Initialize the L76K Chip, use GPS + GLONASS SerialGPS.write("$PCAS04,5*1C\r\n"); delay(250); diff --git a/examples/Sensor/QMI8658_PedometerExample/LoRaBoards.cpp b/examples/Sensor/QMI8658_PedometerExample/LoRaBoards.cpp index 8c90174..f5948b4 100644 --- a/examples/Sensor/QMI8658_PedometerExample/LoRaBoards.cpp +++ b/examples/Sensor/QMI8658_PedometerExample/LoRaBoards.cpp @@ -914,43 +914,43 @@ bool beginGPS() SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); bool result = false; uint32_t startTimeout ; - for (int i = 0; i < 3; ++i) { - SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); - delay(5); - // Get version information - startTimeout = millis() + 3000; - Serial.print("Try to init L76K . Wait stop ."); + SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); + delay(5); + // Get version information + startTimeout = millis() + 3000; + Serial.print("Try to init L76K . Wait stop ."); + SerialGPS.flush(); + + while (SerialGPS.available()) { + // Serial.print("."); + Serial.flush(); SerialGPS.flush(); - while (SerialGPS.available()) { - Serial.print("."); - SerialGPS.readString(); - if (millis() > startTimeout) { - Serial.println("Wait L76K stop NMEA timeout!"); - return false; - } - }; - Serial.println(); - SerialGPS.flush(); - delay(200); - - SerialGPS.write("$PCAS06,0*1B\r\n"); - startTimeout = millis() + 500; - String ver = ""; - while (!SerialGPS.available()) { - if (millis() > startTimeout) { - Serial.println("Get L76K timeout!"); - return false; - } + if (millis() > startTimeout) { + Serial.println("Wait L76K stop NMEA timeout!"); + return false; } - SerialGPS.setTimeout(10); - ver = SerialGPS.readStringUntil('\n'); - if (ver.startsWith("$GPTXT,01,01,02")) { - Serial.println("L76K GNSS init succeeded, using L76K GNSS Module\n"); - result = true; - break; + }; + Serial.println(); + SerialGPS.flush(); + delay(200); + + SerialGPS.write("$PCAS06,0*1B\r\n"); + startTimeout = millis() + 500; + String ver = ""; + while (!SerialGPS.available()) { + if (millis() > startTimeout) { + Serial.println("Get L76K timeout!"); + return false; } - delay(500); } + SerialGPS.setTimeout(10); + ver = SerialGPS.readStringUntil('\n'); + if (ver.startsWith("$GPTXT,01,01,02")) { + Serial.println("L76K GNSS init succeeded, using L76K GNSS Module\n"); + result = true; + } + delay(500); + // Initialize the L76K Chip, use GPS + GLONASS SerialGPS.write("$PCAS04,5*1C\r\n"); delay(250); diff --git a/examples/Sensor/QMI8658_ReadFromFifoExample/LoRaBoards.cpp b/examples/Sensor/QMI8658_ReadFromFifoExample/LoRaBoards.cpp index 8c90174..f5948b4 100644 --- a/examples/Sensor/QMI8658_ReadFromFifoExample/LoRaBoards.cpp +++ b/examples/Sensor/QMI8658_ReadFromFifoExample/LoRaBoards.cpp @@ -914,43 +914,43 @@ bool beginGPS() SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); bool result = false; uint32_t startTimeout ; - for (int i = 0; i < 3; ++i) { - SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); - delay(5); - // Get version information - startTimeout = millis() + 3000; - Serial.print("Try to init L76K . Wait stop ."); + SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); + delay(5); + // Get version information + startTimeout = millis() + 3000; + Serial.print("Try to init L76K . Wait stop ."); + SerialGPS.flush(); + + while (SerialGPS.available()) { + // Serial.print("."); + Serial.flush(); SerialGPS.flush(); - while (SerialGPS.available()) { - Serial.print("."); - SerialGPS.readString(); - if (millis() > startTimeout) { - Serial.println("Wait L76K stop NMEA timeout!"); - return false; - } - }; - Serial.println(); - SerialGPS.flush(); - delay(200); - - SerialGPS.write("$PCAS06,0*1B\r\n"); - startTimeout = millis() + 500; - String ver = ""; - while (!SerialGPS.available()) { - if (millis() > startTimeout) { - Serial.println("Get L76K timeout!"); - return false; - } + if (millis() > startTimeout) { + Serial.println("Wait L76K stop NMEA timeout!"); + return false; } - SerialGPS.setTimeout(10); - ver = SerialGPS.readStringUntil('\n'); - if (ver.startsWith("$GPTXT,01,01,02")) { - Serial.println("L76K GNSS init succeeded, using L76K GNSS Module\n"); - result = true; - break; + }; + Serial.println(); + SerialGPS.flush(); + delay(200); + + SerialGPS.write("$PCAS06,0*1B\r\n"); + startTimeout = millis() + 500; + String ver = ""; + while (!SerialGPS.available()) { + if (millis() > startTimeout) { + Serial.println("Get L76K timeout!"); + return false; } - delay(500); } + SerialGPS.setTimeout(10); + ver = SerialGPS.readStringUntil('\n'); + if (ver.startsWith("$GPTXT,01,01,02")) { + Serial.println("L76K GNSS init succeeded, using L76K GNSS Module\n"); + result = true; + } + delay(500); + // Initialize the L76K Chip, use GPS + GLONASS SerialGPS.write("$PCAS04,5*1C\r\n"); delay(250); diff --git a/examples/Sensor/QMI8658_WakeOnMotion/LoRaBoards.cpp b/examples/Sensor/QMI8658_WakeOnMotion/LoRaBoards.cpp index 8c90174..f5948b4 100644 --- a/examples/Sensor/QMI8658_WakeOnMotion/LoRaBoards.cpp +++ b/examples/Sensor/QMI8658_WakeOnMotion/LoRaBoards.cpp @@ -914,43 +914,43 @@ bool beginGPS() SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); bool result = false; uint32_t startTimeout ; - for (int i = 0; i < 3; ++i) { - SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); - delay(5); - // Get version information - startTimeout = millis() + 3000; - Serial.print("Try to init L76K . Wait stop ."); + SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); + delay(5); + // Get version information + startTimeout = millis() + 3000; + Serial.print("Try to init L76K . Wait stop ."); + SerialGPS.flush(); + + while (SerialGPS.available()) { + // Serial.print("."); + Serial.flush(); SerialGPS.flush(); - while (SerialGPS.available()) { - Serial.print("."); - SerialGPS.readString(); - if (millis() > startTimeout) { - Serial.println("Wait L76K stop NMEA timeout!"); - return false; - } - }; - Serial.println(); - SerialGPS.flush(); - delay(200); - - SerialGPS.write("$PCAS06,0*1B\r\n"); - startTimeout = millis() + 500; - String ver = ""; - while (!SerialGPS.available()) { - if (millis() > startTimeout) { - Serial.println("Get L76K timeout!"); - return false; - } + if (millis() > startTimeout) { + Serial.println("Wait L76K stop NMEA timeout!"); + return false; } - SerialGPS.setTimeout(10); - ver = SerialGPS.readStringUntil('\n'); - if (ver.startsWith("$GPTXT,01,01,02")) { - Serial.println("L76K GNSS init succeeded, using L76K GNSS Module\n"); - result = true; - break; + }; + Serial.println(); + SerialGPS.flush(); + delay(200); + + SerialGPS.write("$PCAS06,0*1B\r\n"); + startTimeout = millis() + 500; + String ver = ""; + while (!SerialGPS.available()) { + if (millis() > startTimeout) { + Serial.println("Get L76K timeout!"); + return false; } - delay(500); } + SerialGPS.setTimeout(10); + ver = SerialGPS.readStringUntil('\n'); + if (ver.startsWith("$GPTXT,01,01,02")) { + Serial.println("L76K GNSS init succeeded, using L76K GNSS Module\n"); + result = true; + } + delay(500); + // Initialize the L76K Chip, use GPS + GLONASS SerialGPS.write("$PCAS04,5*1C\r\n"); delay(250); diff --git a/examples/T3S3Factory/LoRaBoards.cpp b/examples/T3S3Factory/LoRaBoards.cpp index 8c90174..f5948b4 100644 --- a/examples/T3S3Factory/LoRaBoards.cpp +++ b/examples/T3S3Factory/LoRaBoards.cpp @@ -914,43 +914,43 @@ bool beginGPS() SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); bool result = false; uint32_t startTimeout ; - for (int i = 0; i < 3; ++i) { - SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); - delay(5); - // Get version information - startTimeout = millis() + 3000; - Serial.print("Try to init L76K . Wait stop ."); + SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); + delay(5); + // Get version information + startTimeout = millis() + 3000; + Serial.print("Try to init L76K . Wait stop ."); + SerialGPS.flush(); + + while (SerialGPS.available()) { + // Serial.print("."); + Serial.flush(); SerialGPS.flush(); - while (SerialGPS.available()) { - Serial.print("."); - SerialGPS.readString(); - if (millis() > startTimeout) { - Serial.println("Wait L76K stop NMEA timeout!"); - return false; - } - }; - Serial.println(); - SerialGPS.flush(); - delay(200); - - SerialGPS.write("$PCAS06,0*1B\r\n"); - startTimeout = millis() + 500; - String ver = ""; - while (!SerialGPS.available()) { - if (millis() > startTimeout) { - Serial.println("Get L76K timeout!"); - return false; - } + if (millis() > startTimeout) { + Serial.println("Wait L76K stop NMEA timeout!"); + return false; } - SerialGPS.setTimeout(10); - ver = SerialGPS.readStringUntil('\n'); - if (ver.startsWith("$GPTXT,01,01,02")) { - Serial.println("L76K GNSS init succeeded, using L76K GNSS Module\n"); - result = true; - break; + }; + Serial.println(); + SerialGPS.flush(); + delay(200); + + SerialGPS.write("$PCAS06,0*1B\r\n"); + startTimeout = millis() + 500; + String ver = ""; + while (!SerialGPS.available()) { + if (millis() > startTimeout) { + Serial.println("Get L76K timeout!"); + return false; } - delay(500); } + SerialGPS.setTimeout(10); + ver = SerialGPS.readStringUntil('\n'); + if (ver.startsWith("$GPTXT,01,01,02")) { + Serial.println("L76K GNSS init succeeded, using L76K GNSS Module\n"); + result = true; + } + delay(500); + // Initialize the L76K Chip, use GPS + GLONASS SerialGPS.write("$PCAS04,5*1C\r\n"); delay(250); diff --git a/examples/TBeamFactory/LoRaBoards.cpp b/examples/TBeamFactory/LoRaBoards.cpp index 8c90174..f5948b4 100644 --- a/examples/TBeamFactory/LoRaBoards.cpp +++ b/examples/TBeamFactory/LoRaBoards.cpp @@ -914,43 +914,43 @@ bool beginGPS() SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); bool result = false; uint32_t startTimeout ; - for (int i = 0; i < 3; ++i) { - SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); - delay(5); - // Get version information - startTimeout = millis() + 3000; - Serial.print("Try to init L76K . Wait stop ."); + SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); + delay(5); + // Get version information + startTimeout = millis() + 3000; + Serial.print("Try to init L76K . Wait stop ."); + SerialGPS.flush(); + + while (SerialGPS.available()) { + // Serial.print("."); + Serial.flush(); SerialGPS.flush(); - while (SerialGPS.available()) { - Serial.print("."); - SerialGPS.readString(); - if (millis() > startTimeout) { - Serial.println("Wait L76K stop NMEA timeout!"); - return false; - } - }; - Serial.println(); - SerialGPS.flush(); - delay(200); - - SerialGPS.write("$PCAS06,0*1B\r\n"); - startTimeout = millis() + 500; - String ver = ""; - while (!SerialGPS.available()) { - if (millis() > startTimeout) { - Serial.println("Get L76K timeout!"); - return false; - } + if (millis() > startTimeout) { + Serial.println("Wait L76K stop NMEA timeout!"); + return false; } - SerialGPS.setTimeout(10); - ver = SerialGPS.readStringUntil('\n'); - if (ver.startsWith("$GPTXT,01,01,02")) { - Serial.println("L76K GNSS init succeeded, using L76K GNSS Module\n"); - result = true; - break; + }; + Serial.println(); + SerialGPS.flush(); + delay(200); + + SerialGPS.write("$PCAS06,0*1B\r\n"); + startTimeout = millis() + 500; + String ver = ""; + while (!SerialGPS.available()) { + if (millis() > startTimeout) { + Serial.println("Get L76K timeout!"); + return false; } - delay(500); } + SerialGPS.setTimeout(10); + ver = SerialGPS.readStringUntil('\n'); + if (ver.startsWith("$GPTXT,01,01,02")) { + Serial.println("L76K GNSS init succeeded, using L76K GNSS Module\n"); + result = true; + } + delay(500); + // Initialize the L76K Chip, use GPS + GLONASS SerialGPS.write("$PCAS04,5*1C\r\n"); delay(250);