diff --git a/examples/ArduinoLoRa/LoRaReceiver/LoRaBoards.cpp b/examples/ArduinoLoRa/LoRaReceiver/LoRaBoards.cpp index f5948b4..7e24151 100644 --- a/examples/ArduinoLoRa/LoRaReceiver/LoRaBoards.cpp +++ b/examples/ArduinoLoRa/LoRaReceiver/LoRaBoards.cpp @@ -909,9 +909,9 @@ void scanDevices(TwoWire *w) #ifdef HAS_GPS -bool beginGPS() + +bool l76kProbe() { - SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); bool result = false; uint32_t startTimeout ; SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); @@ -919,12 +919,13 @@ bool beginGPS() // Get version information startTimeout = millis() + 3000; Serial.print("Try to init L76K . Wait stop ."); - SerialGPS.flush(); - + // SerialGPS.flush(); while (SerialGPS.available()) { + int c = SerialGPS.read(); + // Serial.write(c); // Serial.print("."); - Serial.flush(); - SerialGPS.flush(); + // Serial.flush(); + // SerialGPS.flush(); if (millis() > startTimeout) { Serial.println("Wait L76K stop NMEA timeout!"); return false; @@ -962,6 +963,19 @@ bool beginGPS() return result; } +bool beginGPS() +{ + SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); + bool result = false; + for ( int i = 0; i < 3; ++i) { + result = l76kProbe(); + if (result) { + return result; + } + } + return result; +} + static int getAck(uint8_t *buffer, uint16_t size, uint8_t requestedClass, uint8_t requestedID) diff --git a/examples/ArduinoLoRa/LoRaSender/LoRaBoards.cpp b/examples/ArduinoLoRa/LoRaSender/LoRaBoards.cpp index f5948b4..7e24151 100644 --- a/examples/ArduinoLoRa/LoRaSender/LoRaBoards.cpp +++ b/examples/ArduinoLoRa/LoRaSender/LoRaBoards.cpp @@ -909,9 +909,9 @@ void scanDevices(TwoWire *w) #ifdef HAS_GPS -bool beginGPS() + +bool l76kProbe() { - SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); bool result = false; uint32_t startTimeout ; SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); @@ -919,12 +919,13 @@ bool beginGPS() // Get version information startTimeout = millis() + 3000; Serial.print("Try to init L76K . Wait stop ."); - SerialGPS.flush(); - + // SerialGPS.flush(); while (SerialGPS.available()) { + int c = SerialGPS.read(); + // Serial.write(c); // Serial.print("."); - Serial.flush(); - SerialGPS.flush(); + // Serial.flush(); + // SerialGPS.flush(); if (millis() > startTimeout) { Serial.println("Wait L76K stop NMEA timeout!"); return false; @@ -962,6 +963,19 @@ bool beginGPS() return result; } +bool beginGPS() +{ + SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); + bool result = false; + for ( int i = 0; i < 3; ++i) { + result = l76kProbe(); + if (result) { + return result; + } + } + return result; +} + static int getAck(uint8_t *buffer, uint16_t size, uint8_t requestedClass, uint8_t requestedID) diff --git a/examples/BPFFactory/LoRaBoards.cpp b/examples/BPFFactory/LoRaBoards.cpp index f5948b4..7e24151 100644 --- a/examples/BPFFactory/LoRaBoards.cpp +++ b/examples/BPFFactory/LoRaBoards.cpp @@ -909,9 +909,9 @@ void scanDevices(TwoWire *w) #ifdef HAS_GPS -bool beginGPS() + +bool l76kProbe() { - SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); bool result = false; uint32_t startTimeout ; SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); @@ -919,12 +919,13 @@ bool beginGPS() // Get version information startTimeout = millis() + 3000; Serial.print("Try to init L76K . Wait stop ."); - SerialGPS.flush(); - + // SerialGPS.flush(); while (SerialGPS.available()) { + int c = SerialGPS.read(); + // Serial.write(c); // Serial.print("."); - Serial.flush(); - SerialGPS.flush(); + // Serial.flush(); + // SerialGPS.flush(); if (millis() > startTimeout) { Serial.println("Wait L76K stop NMEA timeout!"); return false; @@ -962,6 +963,19 @@ bool beginGPS() return result; } +bool beginGPS() +{ + SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); + bool result = false; + for ( int i = 0; i < 3; ++i) { + result = l76kProbe(); + if (result) { + return result; + } + } + return result; +} + static int getAck(uint8_t *buffer, uint16_t size, uint8_t requestedClass, uint8_t requestedID) diff --git a/examples/Display/Free_Font_Demo/LoRaBoards.cpp b/examples/Display/Free_Font_Demo/LoRaBoards.cpp index f5948b4..7e24151 100644 --- a/examples/Display/Free_Font_Demo/LoRaBoards.cpp +++ b/examples/Display/Free_Font_Demo/LoRaBoards.cpp @@ -909,9 +909,9 @@ void scanDevices(TwoWire *w) #ifdef HAS_GPS -bool beginGPS() + +bool l76kProbe() { - SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); bool result = false; uint32_t startTimeout ; SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); @@ -919,12 +919,13 @@ bool beginGPS() // Get version information startTimeout = millis() + 3000; Serial.print("Try to init L76K . Wait stop ."); - SerialGPS.flush(); - + // SerialGPS.flush(); while (SerialGPS.available()) { + int c = SerialGPS.read(); + // Serial.write(c); // Serial.print("."); - Serial.flush(); - SerialGPS.flush(); + // Serial.flush(); + // SerialGPS.flush(); if (millis() > startTimeout) { Serial.println("Wait L76K stop NMEA timeout!"); return false; @@ -962,6 +963,19 @@ bool beginGPS() return result; } +bool beginGPS() +{ + SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); + bool result = false; + for ( int i = 0; i < 3; ++i) { + result = l76kProbe(); + if (result) { + return result; + } + } + return result; +} + static int getAck(uint8_t *buffer, uint16_t size, uint8_t requestedClass, uint8_t requestedID) diff --git a/examples/Display/TBeam_TFT_Shield/LoRaBoards.cpp b/examples/Display/TBeam_TFT_Shield/LoRaBoards.cpp index f5948b4..7e24151 100644 --- a/examples/Display/TBeam_TFT_Shield/LoRaBoards.cpp +++ b/examples/Display/TBeam_TFT_Shield/LoRaBoards.cpp @@ -909,9 +909,9 @@ void scanDevices(TwoWire *w) #ifdef HAS_GPS -bool beginGPS() + +bool l76kProbe() { - SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); bool result = false; uint32_t startTimeout ; SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); @@ -919,12 +919,13 @@ bool beginGPS() // Get version information startTimeout = millis() + 3000; Serial.print("Try to init L76K . Wait stop ."); - SerialGPS.flush(); - + // SerialGPS.flush(); while (SerialGPS.available()) { + int c = SerialGPS.read(); + // Serial.write(c); // Serial.print("."); - Serial.flush(); - SerialGPS.flush(); + // Serial.flush(); + // SerialGPS.flush(); if (millis() > startTimeout) { Serial.println("Wait L76K stop NMEA timeout!"); return false; @@ -962,6 +963,19 @@ bool beginGPS() return result; } +bool beginGPS() +{ + SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); + bool result = false; + for ( int i = 0; i < 3; ++i) { + result = l76kProbe(); + if (result) { + return result; + } + } + return result; +} + static int getAck(uint8_t *buffer, uint16_t size, uint8_t requestedClass, uint8_t requestedID) diff --git a/examples/Display/TFT_Char_times/LoRaBoards.cpp b/examples/Display/TFT_Char_times/LoRaBoards.cpp index f5948b4..7e24151 100644 --- a/examples/Display/TFT_Char_times/LoRaBoards.cpp +++ b/examples/Display/TFT_Char_times/LoRaBoards.cpp @@ -909,9 +909,9 @@ void scanDevices(TwoWire *w) #ifdef HAS_GPS -bool beginGPS() + +bool l76kProbe() { - SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); bool result = false; uint32_t startTimeout ; SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); @@ -919,12 +919,13 @@ bool beginGPS() // Get version information startTimeout = millis() + 3000; Serial.print("Try to init L76K . Wait stop ."); - SerialGPS.flush(); - + // SerialGPS.flush(); while (SerialGPS.available()) { + int c = SerialGPS.read(); + // Serial.write(c); // Serial.print("."); - Serial.flush(); - SerialGPS.flush(); + // Serial.flush(); + // SerialGPS.flush(); if (millis() > startTimeout) { Serial.println("Wait L76K stop NMEA timeout!"); return false; @@ -962,6 +963,19 @@ bool beginGPS() return result; } +bool beginGPS() +{ + SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); + bool result = false; + for ( int i = 0; i < 3; ++i) { + result = l76kProbe(); + if (result) { + return result; + } + } + return result; +} + static int getAck(uint8_t *buffer, uint16_t size, uint8_t requestedClass, uint8_t requestedID) diff --git a/examples/Display/UTFT_demo/LoRaBoards.cpp b/examples/Display/UTFT_demo/LoRaBoards.cpp index f5948b4..7e24151 100644 --- a/examples/Display/UTFT_demo/LoRaBoards.cpp +++ b/examples/Display/UTFT_demo/LoRaBoards.cpp @@ -909,9 +909,9 @@ void scanDevices(TwoWire *w) #ifdef HAS_GPS -bool beginGPS() + +bool l76kProbe() { - SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); bool result = false; uint32_t startTimeout ; SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); @@ -919,12 +919,13 @@ bool beginGPS() // Get version information startTimeout = millis() + 3000; Serial.print("Try to init L76K . Wait stop ."); - SerialGPS.flush(); - + // SerialGPS.flush(); while (SerialGPS.available()) { + int c = SerialGPS.read(); + // Serial.write(c); // Serial.print("."); - Serial.flush(); - SerialGPS.flush(); + // Serial.flush(); + // SerialGPS.flush(); if (millis() > startTimeout) { Serial.println("Wait L76K stop NMEA timeout!"); return false; @@ -962,6 +963,19 @@ bool beginGPS() return result; } +bool beginGPS() +{ + SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); + bool result = false; + for ( int i = 0; i < 3; ++i) { + result = l76kProbe(); + if (result) { + return result; + } + } + return result; +} + static int getAck(uint8_t *buffer, uint16_t size, uint8_t requestedClass, uint8_t requestedID) diff --git a/examples/Factory/LoRaBoards.cpp b/examples/Factory/LoRaBoards.cpp index f5948b4..7e24151 100644 --- a/examples/Factory/LoRaBoards.cpp +++ b/examples/Factory/LoRaBoards.cpp @@ -909,9 +909,9 @@ void scanDevices(TwoWire *w) #ifdef HAS_GPS -bool beginGPS() + +bool l76kProbe() { - SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); bool result = false; uint32_t startTimeout ; SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); @@ -919,12 +919,13 @@ bool beginGPS() // Get version information startTimeout = millis() + 3000; Serial.print("Try to init L76K . Wait stop ."); - SerialGPS.flush(); - + // SerialGPS.flush(); while (SerialGPS.available()) { + int c = SerialGPS.read(); + // Serial.write(c); // Serial.print("."); - Serial.flush(); - SerialGPS.flush(); + // Serial.flush(); + // SerialGPS.flush(); if (millis() > startTimeout) { Serial.println("Wait L76K stop NMEA timeout!"); return false; @@ -962,6 +963,19 @@ bool beginGPS() return result; } +bool beginGPS() +{ + SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); + bool result = false; + for ( int i = 0; i < 3; ++i) { + result = l76kProbe(); + if (result) { + return result; + } + } + return result; +} + static int getAck(uint8_t *buffer, uint16_t size, uint8_t requestedClass, uint8_t requestedID) diff --git a/examples/GPS/TinyGPS_Example/LoRaBoards.cpp b/examples/GPS/TinyGPS_Example/LoRaBoards.cpp index f5948b4..7e24151 100644 --- a/examples/GPS/TinyGPS_Example/LoRaBoards.cpp +++ b/examples/GPS/TinyGPS_Example/LoRaBoards.cpp @@ -909,9 +909,9 @@ void scanDevices(TwoWire *w) #ifdef HAS_GPS -bool beginGPS() + +bool l76kProbe() { - SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); bool result = false; uint32_t startTimeout ; SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); @@ -919,12 +919,13 @@ bool beginGPS() // Get version information startTimeout = millis() + 3000; Serial.print("Try to init L76K . Wait stop ."); - SerialGPS.flush(); - + // SerialGPS.flush(); while (SerialGPS.available()) { + int c = SerialGPS.read(); + // Serial.write(c); // Serial.print("."); - Serial.flush(); - SerialGPS.flush(); + // Serial.flush(); + // SerialGPS.flush(); if (millis() > startTimeout) { Serial.println("Wait L76K stop NMEA timeout!"); return false; @@ -962,6 +963,19 @@ bool beginGPS() return result; } +bool beginGPS() +{ + SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); + bool result = false; + for ( int i = 0; i < 3; ++i) { + result = l76kProbe(); + if (result) { + return result; + } + } + return result; +} + static int getAck(uint8_t *buffer, uint16_t size, uint8_t requestedClass, uint8_t requestedID) diff --git a/examples/GPS/TinyGPS_FullExample/LoRaBoards.cpp b/examples/GPS/TinyGPS_FullExample/LoRaBoards.cpp index f5948b4..7e24151 100644 --- a/examples/GPS/TinyGPS_FullExample/LoRaBoards.cpp +++ b/examples/GPS/TinyGPS_FullExample/LoRaBoards.cpp @@ -909,9 +909,9 @@ void scanDevices(TwoWire *w) #ifdef HAS_GPS -bool beginGPS() + +bool l76kProbe() { - SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); bool result = false; uint32_t startTimeout ; SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); @@ -919,12 +919,13 @@ bool beginGPS() // Get version information startTimeout = millis() + 3000; Serial.print("Try to init L76K . Wait stop ."); - SerialGPS.flush(); - + // SerialGPS.flush(); while (SerialGPS.available()) { + int c = SerialGPS.read(); + // Serial.write(c); // Serial.print("."); - Serial.flush(); - SerialGPS.flush(); + // Serial.flush(); + // SerialGPS.flush(); if (millis() > startTimeout) { Serial.println("Wait L76K stop NMEA timeout!"); return false; @@ -962,6 +963,19 @@ bool beginGPS() return result; } +bool beginGPS() +{ + SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); + bool result = false; + for ( int i = 0; i < 3; ++i) { + result = l76kProbe(); + if (result) { + return result; + } + } + return result; +} + static int getAck(uint8_t *buffer, uint16_t size, uint8_t requestedClass, uint8_t requestedID) diff --git a/examples/GPS/TinyGPS_KitchenSink/LoRaBoards.cpp b/examples/GPS/TinyGPS_KitchenSink/LoRaBoards.cpp index f5948b4..7e24151 100644 --- a/examples/GPS/TinyGPS_KitchenSink/LoRaBoards.cpp +++ b/examples/GPS/TinyGPS_KitchenSink/LoRaBoards.cpp @@ -909,9 +909,9 @@ void scanDevices(TwoWire *w) #ifdef HAS_GPS -bool beginGPS() + +bool l76kProbe() { - SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); bool result = false; uint32_t startTimeout ; SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); @@ -919,12 +919,13 @@ bool beginGPS() // Get version information startTimeout = millis() + 3000; Serial.print("Try to init L76K . Wait stop ."); - SerialGPS.flush(); - + // SerialGPS.flush(); while (SerialGPS.available()) { + int c = SerialGPS.read(); + // Serial.write(c); // Serial.print("."); - Serial.flush(); - SerialGPS.flush(); + // Serial.flush(); + // SerialGPS.flush(); if (millis() > startTimeout) { Serial.println("Wait L76K stop NMEA timeout!"); return false; @@ -962,6 +963,19 @@ bool beginGPS() return result; } +bool beginGPS() +{ + SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); + bool result = false; + for ( int i = 0; i < 3; ++i) { + result = l76kProbe(); + if (result) { + return result; + } + } + return result; +} + static int getAck(uint8_t *buffer, uint16_t size, uint8_t requestedClass, uint8_t requestedID) diff --git a/examples/GPS/UBlox_BasicNMEARead/LoRaBoards.cpp b/examples/GPS/UBlox_BasicNMEARead/LoRaBoards.cpp index f5948b4..7e24151 100644 --- a/examples/GPS/UBlox_BasicNMEARead/LoRaBoards.cpp +++ b/examples/GPS/UBlox_BasicNMEARead/LoRaBoards.cpp @@ -909,9 +909,9 @@ void scanDevices(TwoWire *w) #ifdef HAS_GPS -bool beginGPS() + +bool l76kProbe() { - SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); bool result = false; uint32_t startTimeout ; SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); @@ -919,12 +919,13 @@ bool beginGPS() // Get version information startTimeout = millis() + 3000; Serial.print("Try to init L76K . Wait stop ."); - SerialGPS.flush(); - + // SerialGPS.flush(); while (SerialGPS.available()) { + int c = SerialGPS.read(); + // Serial.write(c); // Serial.print("."); - Serial.flush(); - SerialGPS.flush(); + // Serial.flush(); + // SerialGPS.flush(); if (millis() > startTimeout) { Serial.println("Wait L76K stop NMEA timeout!"); return false; @@ -962,6 +963,19 @@ bool beginGPS() return result; } +bool beginGPS() +{ + SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); + bool result = false; + for ( int i = 0; i < 3; ++i) { + result = l76kProbe(); + if (result) { + return result; + } + } + return result; +} + static int getAck(uint8_t *buffer, uint16_t size, uint8_t requestedClass, uint8_t requestedID) diff --git a/examples/GPS/UBlox_NMEAParsing/LoRaBoards.cpp b/examples/GPS/UBlox_NMEAParsing/LoRaBoards.cpp index f5948b4..7e24151 100644 --- a/examples/GPS/UBlox_NMEAParsing/LoRaBoards.cpp +++ b/examples/GPS/UBlox_NMEAParsing/LoRaBoards.cpp @@ -909,9 +909,9 @@ void scanDevices(TwoWire *w) #ifdef HAS_GPS -bool beginGPS() + +bool l76kProbe() { - SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); bool result = false; uint32_t startTimeout ; SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); @@ -919,12 +919,13 @@ bool beginGPS() // Get version information startTimeout = millis() + 3000; Serial.print("Try to init L76K . Wait stop ."); - SerialGPS.flush(); - + // SerialGPS.flush(); while (SerialGPS.available()) { + int c = SerialGPS.read(); + // Serial.write(c); // Serial.print("."); - Serial.flush(); - SerialGPS.flush(); + // Serial.flush(); + // SerialGPS.flush(); if (millis() > startTimeout) { Serial.println("Wait L76K stop NMEA timeout!"); return false; @@ -962,6 +963,19 @@ bool beginGPS() return result; } +bool beginGPS() +{ + SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); + bool result = false; + for ( int i = 0; i < 3; ++i) { + result = l76kProbe(); + if (result) { + return result; + } + } + return result; +} + static int getAck(uint8_t *buffer, uint16_t size, uint8_t requestedClass, uint8_t requestedID) diff --git a/examples/GPS/UBlox_OutputRate/LoRaBoards.cpp b/examples/GPS/UBlox_OutputRate/LoRaBoards.cpp index f5948b4..7e24151 100644 --- a/examples/GPS/UBlox_OutputRate/LoRaBoards.cpp +++ b/examples/GPS/UBlox_OutputRate/LoRaBoards.cpp @@ -909,9 +909,9 @@ void scanDevices(TwoWire *w) #ifdef HAS_GPS -bool beginGPS() + +bool l76kProbe() { - SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); bool result = false; uint32_t startTimeout ; SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); @@ -919,12 +919,13 @@ bool beginGPS() // Get version information startTimeout = millis() + 3000; Serial.print("Try to init L76K . Wait stop ."); - SerialGPS.flush(); - + // SerialGPS.flush(); while (SerialGPS.available()) { + int c = SerialGPS.read(); + // Serial.write(c); // Serial.print("."); - Serial.flush(); - SerialGPS.flush(); + // Serial.flush(); + // SerialGPS.flush(); if (millis() > startTimeout) { Serial.println("Wait L76K stop NMEA timeout!"); return false; @@ -962,6 +963,19 @@ bool beginGPS() return result; } +bool beginGPS() +{ + SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); + bool result = false; + for ( int i = 0; i < 3; ++i) { + result = l76kProbe(); + if (result) { + return result; + } + } + return result; +} + static int getAck(uint8_t *buffer, uint16_t size, uint8_t requestedClass, uint8_t requestedID) diff --git a/examples/GPS/UBlox_Recovery/LoRaBoards.cpp b/examples/GPS/UBlox_Recovery/LoRaBoards.cpp index f5948b4..7e24151 100644 --- a/examples/GPS/UBlox_Recovery/LoRaBoards.cpp +++ b/examples/GPS/UBlox_Recovery/LoRaBoards.cpp @@ -909,9 +909,9 @@ void scanDevices(TwoWire *w) #ifdef HAS_GPS -bool beginGPS() + +bool l76kProbe() { - SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); bool result = false; uint32_t startTimeout ; SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); @@ -919,12 +919,13 @@ bool beginGPS() // Get version information startTimeout = millis() + 3000; Serial.print("Try to init L76K . Wait stop ."); - SerialGPS.flush(); - + // SerialGPS.flush(); while (SerialGPS.available()) { + int c = SerialGPS.read(); + // Serial.write(c); // Serial.print("."); - Serial.flush(); - SerialGPS.flush(); + // Serial.flush(); + // SerialGPS.flush(); if (millis() > startTimeout) { Serial.println("Wait L76K stop NMEA timeout!"); return false; @@ -962,6 +963,19 @@ bool beginGPS() return result; } +bool beginGPS() +{ + SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); + bool result = false; + for ( int i = 0; i < 3; ++i) { + result = l76kProbe(); + if (result) { + return result; + } + } + return result; +} + static int getAck(uint8_t *buffer, uint16_t size, uint8_t requestedClass, uint8_t requestedID) diff --git a/examples/LoRaWAN/LMIC_Library_OTTA/LoRaBoards.cpp b/examples/LoRaWAN/LMIC_Library_OTTA/LoRaBoards.cpp index f5948b4..7e24151 100644 --- a/examples/LoRaWAN/LMIC_Library_OTTA/LoRaBoards.cpp +++ b/examples/LoRaWAN/LMIC_Library_OTTA/LoRaBoards.cpp @@ -909,9 +909,9 @@ void scanDevices(TwoWire *w) #ifdef HAS_GPS -bool beginGPS() + +bool l76kProbe() { - SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); bool result = false; uint32_t startTimeout ; SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); @@ -919,12 +919,13 @@ bool beginGPS() // Get version information startTimeout = millis() + 3000; Serial.print("Try to init L76K . Wait stop ."); - SerialGPS.flush(); - + // SerialGPS.flush(); while (SerialGPS.available()) { + int c = SerialGPS.read(); + // Serial.write(c); // Serial.print("."); - Serial.flush(); - SerialGPS.flush(); + // Serial.flush(); + // SerialGPS.flush(); if (millis() > startTimeout) { Serial.println("Wait L76K stop NMEA timeout!"); return false; @@ -962,6 +963,19 @@ bool beginGPS() return result; } +bool beginGPS() +{ + SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); + bool result = false; + for ( int i = 0; i < 3; ++i) { + result = l76kProbe(); + if (result) { + return result; + } + } + return result; +} + static int getAck(uint8_t *buffer, uint16_t size, uint8_t requestedClass, uint8_t requestedID) diff --git a/examples/LoRaWAN/LoRaWAN_ABP/LoRaBoards.cpp b/examples/LoRaWAN/LoRaWAN_ABP/LoRaBoards.cpp index f5948b4..7e24151 100644 --- a/examples/LoRaWAN/LoRaWAN_ABP/LoRaBoards.cpp +++ b/examples/LoRaWAN/LoRaWAN_ABP/LoRaBoards.cpp @@ -909,9 +909,9 @@ void scanDevices(TwoWire *w) #ifdef HAS_GPS -bool beginGPS() + +bool l76kProbe() { - SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); bool result = false; uint32_t startTimeout ; SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); @@ -919,12 +919,13 @@ bool beginGPS() // Get version information startTimeout = millis() + 3000; Serial.print("Try to init L76K . Wait stop ."); - SerialGPS.flush(); - + // SerialGPS.flush(); while (SerialGPS.available()) { + int c = SerialGPS.read(); + // Serial.write(c); // Serial.print("."); - Serial.flush(); - SerialGPS.flush(); + // Serial.flush(); + // SerialGPS.flush(); if (millis() > startTimeout) { Serial.println("Wait L76K stop NMEA timeout!"); return false; @@ -962,6 +963,19 @@ bool beginGPS() return result; } +bool beginGPS() +{ + SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); + bool result = false; + for ( int i = 0; i < 3; ++i) { + result = l76kProbe(); + if (result) { + return result; + } + } + return result; +} + static int getAck(uint8_t *buffer, uint16_t size, uint8_t requestedClass, uint8_t requestedID) diff --git a/examples/LoRaWAN/RadioLib_OTAA/LoRaBoards.cpp b/examples/LoRaWAN/RadioLib_OTAA/LoRaBoards.cpp index f5948b4..7e24151 100644 --- a/examples/LoRaWAN/RadioLib_OTAA/LoRaBoards.cpp +++ b/examples/LoRaWAN/RadioLib_OTAA/LoRaBoards.cpp @@ -909,9 +909,9 @@ void scanDevices(TwoWire *w) #ifdef HAS_GPS -bool beginGPS() + +bool l76kProbe() { - SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); bool result = false; uint32_t startTimeout ; SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); @@ -919,12 +919,13 @@ bool beginGPS() // Get version information startTimeout = millis() + 3000; Serial.print("Try to init L76K . Wait stop ."); - SerialGPS.flush(); - + // SerialGPS.flush(); while (SerialGPS.available()) { + int c = SerialGPS.read(); + // Serial.write(c); // Serial.print("."); - Serial.flush(); - SerialGPS.flush(); + // Serial.flush(); + // SerialGPS.flush(); if (millis() > startTimeout) { Serial.println("Wait L76K stop NMEA timeout!"); return false; @@ -962,6 +963,19 @@ bool beginGPS() return result; } +bool beginGPS() +{ + SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); + bool result = false; + for ( int i = 0; i < 3; ++i) { + result = l76kProbe(); + if (result) { + return result; + } + } + return result; +} + static int getAck(uint8_t *buffer, uint16_t size, uint8_t requestedClass, uint8_t requestedID) diff --git a/examples/OLED/SH1106FontUsage/LoRaBoards.cpp b/examples/OLED/SH1106FontUsage/LoRaBoards.cpp index f5948b4..7e24151 100644 --- a/examples/OLED/SH1106FontUsage/LoRaBoards.cpp +++ b/examples/OLED/SH1106FontUsage/LoRaBoards.cpp @@ -909,9 +909,9 @@ void scanDevices(TwoWire *w) #ifdef HAS_GPS -bool beginGPS() + +bool l76kProbe() { - SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); bool result = false; uint32_t startTimeout ; SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); @@ -919,12 +919,13 @@ bool beginGPS() // Get version information startTimeout = millis() + 3000; Serial.print("Try to init L76K . Wait stop ."); - SerialGPS.flush(); - + // SerialGPS.flush(); while (SerialGPS.available()) { + int c = SerialGPS.read(); + // Serial.write(c); // Serial.print("."); - Serial.flush(); - SerialGPS.flush(); + // Serial.flush(); + // SerialGPS.flush(); if (millis() > startTimeout) { Serial.println("Wait L76K stop NMEA timeout!"); return false; @@ -962,6 +963,19 @@ bool beginGPS() return result; } +bool beginGPS() +{ + SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); + bool result = false; + for ( int i = 0; i < 3; ++i) { + result = l76kProbe(); + if (result) { + return result; + } + } + return result; +} + static int getAck(uint8_t *buffer, uint16_t size, uint8_t requestedClass, uint8_t requestedID) diff --git a/examples/OLED/SH1106GraphicsTest/LoRaBoards.cpp b/examples/OLED/SH1106GraphicsTest/LoRaBoards.cpp index f5948b4..7e24151 100644 --- a/examples/OLED/SH1106GraphicsTest/LoRaBoards.cpp +++ b/examples/OLED/SH1106GraphicsTest/LoRaBoards.cpp @@ -909,9 +909,9 @@ void scanDevices(TwoWire *w) #ifdef HAS_GPS -bool beginGPS() + +bool l76kProbe() { - SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); bool result = false; uint32_t startTimeout ; SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); @@ -919,12 +919,13 @@ bool beginGPS() // Get version information startTimeout = millis() + 3000; Serial.print("Try to init L76K . Wait stop ."); - SerialGPS.flush(); - + // SerialGPS.flush(); while (SerialGPS.available()) { + int c = SerialGPS.read(); + // Serial.write(c); // Serial.print("."); - Serial.flush(); - SerialGPS.flush(); + // Serial.flush(); + // SerialGPS.flush(); if (millis() > startTimeout) { Serial.println("Wait L76K stop NMEA timeout!"); return false; @@ -962,6 +963,19 @@ bool beginGPS() return result; } +bool beginGPS() +{ + SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); + bool result = false; + for ( int i = 0; i < 3; ++i) { + result = l76kProbe(); + if (result) { + return result; + } + } + return result; +} + static int getAck(uint8_t *buffer, uint16_t size, uint8_t requestedClass, uint8_t requestedID) diff --git a/examples/OLED/SH1106IconMenu/LoRaBoards.cpp b/examples/OLED/SH1106IconMenu/LoRaBoards.cpp index f5948b4..7e24151 100644 --- a/examples/OLED/SH1106IconMenu/LoRaBoards.cpp +++ b/examples/OLED/SH1106IconMenu/LoRaBoards.cpp @@ -909,9 +909,9 @@ void scanDevices(TwoWire *w) #ifdef HAS_GPS -bool beginGPS() + +bool l76kProbe() { - SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); bool result = false; uint32_t startTimeout ; SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); @@ -919,12 +919,13 @@ bool beginGPS() // Get version information startTimeout = millis() + 3000; Serial.print("Try to init L76K . Wait stop ."); - SerialGPS.flush(); - + // SerialGPS.flush(); while (SerialGPS.available()) { + int c = SerialGPS.read(); + // Serial.write(c); // Serial.print("."); - Serial.flush(); - SerialGPS.flush(); + // Serial.flush(); + // SerialGPS.flush(); if (millis() > startTimeout) { Serial.println("Wait L76K stop NMEA timeout!"); return false; @@ -962,6 +963,19 @@ bool beginGPS() return result; } +bool beginGPS() +{ + SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); + bool result = false; + for ( int i = 0; i < 3; ++i) { + result = l76kProbe(); + if (result) { + return result; + } + } + return result; +} + static int getAck(uint8_t *buffer, uint16_t size, uint8_t requestedClass, uint8_t requestedID) diff --git a/examples/OLED/SH1106PrintUTF8/LoRaBoards.cpp b/examples/OLED/SH1106PrintUTF8/LoRaBoards.cpp index f5948b4..7e24151 100644 --- a/examples/OLED/SH1106PrintUTF8/LoRaBoards.cpp +++ b/examples/OLED/SH1106PrintUTF8/LoRaBoards.cpp @@ -909,9 +909,9 @@ void scanDevices(TwoWire *w) #ifdef HAS_GPS -bool beginGPS() + +bool l76kProbe() { - SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); bool result = false; uint32_t startTimeout ; SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); @@ -919,12 +919,13 @@ bool beginGPS() // Get version information startTimeout = millis() + 3000; Serial.print("Try to init L76K . Wait stop ."); - SerialGPS.flush(); - + // SerialGPS.flush(); while (SerialGPS.available()) { + int c = SerialGPS.read(); + // Serial.write(c); // Serial.print("."); - Serial.flush(); - SerialGPS.flush(); + // Serial.flush(); + // SerialGPS.flush(); if (millis() > startTimeout) { Serial.println("Wait L76K stop NMEA timeout!"); return false; @@ -962,6 +963,19 @@ bool beginGPS() return result; } +bool beginGPS() +{ + SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); + bool result = false; + for ( int i = 0; i < 3; ++i) { + result = l76kProbe(); + if (result) { + return result; + } + } + return result; +} + static int getAck(uint8_t *buffer, uint16_t size, uint8_t requestedClass, uint8_t requestedID) diff --git a/examples/OLED/SSD1306SimpleDemo/LoRaBoards.cpp b/examples/OLED/SSD1306SimpleDemo/LoRaBoards.cpp index f5948b4..7e24151 100644 --- a/examples/OLED/SSD1306SimpleDemo/LoRaBoards.cpp +++ b/examples/OLED/SSD1306SimpleDemo/LoRaBoards.cpp @@ -909,9 +909,9 @@ void scanDevices(TwoWire *w) #ifdef HAS_GPS -bool beginGPS() + +bool l76kProbe() { - SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); bool result = false; uint32_t startTimeout ; SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); @@ -919,12 +919,13 @@ bool beginGPS() // Get version information startTimeout = millis() + 3000; Serial.print("Try to init L76K . Wait stop ."); - SerialGPS.flush(); - + // SerialGPS.flush(); while (SerialGPS.available()) { + int c = SerialGPS.read(); + // Serial.write(c); // Serial.print("."); - Serial.flush(); - SerialGPS.flush(); + // Serial.flush(); + // SerialGPS.flush(); if (millis() > startTimeout) { Serial.println("Wait L76K stop NMEA timeout!"); return false; @@ -962,6 +963,19 @@ bool beginGPS() return result; } +bool beginGPS() +{ + SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); + bool result = false; + for ( int i = 0; i < 3; ++i) { + result = l76kProbe(); + if (result) { + return result; + } + } + return result; +} + static int getAck(uint8_t *buffer, uint16_t size, uint8_t requestedClass, uint8_t requestedID) diff --git a/examples/OLED/SSD1306UiDemo/LoRaBoards.cpp b/examples/OLED/SSD1306UiDemo/LoRaBoards.cpp index f5948b4..7e24151 100644 --- a/examples/OLED/SSD1306UiDemo/LoRaBoards.cpp +++ b/examples/OLED/SSD1306UiDemo/LoRaBoards.cpp @@ -909,9 +909,9 @@ void scanDevices(TwoWire *w) #ifdef HAS_GPS -bool beginGPS() + +bool l76kProbe() { - SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); bool result = false; uint32_t startTimeout ; SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); @@ -919,12 +919,13 @@ bool beginGPS() // Get version information startTimeout = millis() + 3000; Serial.print("Try to init L76K . Wait stop ."); - SerialGPS.flush(); - + // SerialGPS.flush(); while (SerialGPS.available()) { + int c = SerialGPS.read(); + // Serial.write(c); // Serial.print("."); - Serial.flush(); - SerialGPS.flush(); + // Serial.flush(); + // SerialGPS.flush(); if (millis() > startTimeout) { Serial.println("Wait L76K stop NMEA timeout!"); return false; @@ -962,6 +963,19 @@ bool beginGPS() return result; } +bool beginGPS() +{ + SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); + bool result = false; + for ( int i = 0; i < 3; ++i) { + result = l76kProbe(); + if (result) { + return result; + } + } + return result; +} + static int getAck(uint8_t *buffer, uint16_t size, uint8_t requestedClass, uint8_t requestedID) diff --git a/examples/PMU/LoRaBoards.cpp b/examples/PMU/LoRaBoards.cpp index f5948b4..7e24151 100644 --- a/examples/PMU/LoRaBoards.cpp +++ b/examples/PMU/LoRaBoards.cpp @@ -909,9 +909,9 @@ void scanDevices(TwoWire *w) #ifdef HAS_GPS -bool beginGPS() + +bool l76kProbe() { - SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); bool result = false; uint32_t startTimeout ; SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); @@ -919,12 +919,13 @@ bool beginGPS() // Get version information startTimeout = millis() + 3000; Serial.print("Try to init L76K . Wait stop ."); - SerialGPS.flush(); - + // SerialGPS.flush(); while (SerialGPS.available()) { + int c = SerialGPS.read(); + // Serial.write(c); // Serial.print("."); - Serial.flush(); - SerialGPS.flush(); + // Serial.flush(); + // SerialGPS.flush(); if (millis() > startTimeout) { Serial.println("Wait L76K stop NMEA timeout!"); return false; @@ -962,6 +963,19 @@ bool beginGPS() return result; } +bool beginGPS() +{ + SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); + bool result = false; + for ( int i = 0; i < 3; ++i) { + result = l76kProbe(); + if (result) { + return result; + } + } + return result; +} + static int getAck(uint8_t *buffer, uint16_t size, uint8_t requestedClass, uint8_t requestedID) diff --git a/examples/RadioLibExamples/Receive_Interrupt/LoRaBoards.cpp b/examples/RadioLibExamples/Receive_Interrupt/LoRaBoards.cpp index f5948b4..7e24151 100644 --- a/examples/RadioLibExamples/Receive_Interrupt/LoRaBoards.cpp +++ b/examples/RadioLibExamples/Receive_Interrupt/LoRaBoards.cpp @@ -909,9 +909,9 @@ void scanDevices(TwoWire *w) #ifdef HAS_GPS -bool beginGPS() + +bool l76kProbe() { - SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); bool result = false; uint32_t startTimeout ; SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); @@ -919,12 +919,13 @@ bool beginGPS() // Get version information startTimeout = millis() + 3000; Serial.print("Try to init L76K . Wait stop ."); - SerialGPS.flush(); - + // SerialGPS.flush(); while (SerialGPS.available()) { + int c = SerialGPS.read(); + // Serial.write(c); // Serial.print("."); - Serial.flush(); - SerialGPS.flush(); + // Serial.flush(); + // SerialGPS.flush(); if (millis() > startTimeout) { Serial.println("Wait L76K stop NMEA timeout!"); return false; @@ -962,6 +963,19 @@ bool beginGPS() return result; } +bool beginGPS() +{ + SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); + bool result = false; + for ( int i = 0; i < 3; ++i) { + result = l76kProbe(); + if (result) { + return result; + } + } + return result; +} + static int getAck(uint8_t *buffer, uint16_t size, uint8_t requestedClass, uint8_t requestedID) diff --git a/examples/RadioLibExamples/Transmit_Interrupt/LoRaBoards.cpp b/examples/RadioLibExamples/Transmit_Interrupt/LoRaBoards.cpp index f5948b4..7e24151 100644 --- a/examples/RadioLibExamples/Transmit_Interrupt/LoRaBoards.cpp +++ b/examples/RadioLibExamples/Transmit_Interrupt/LoRaBoards.cpp @@ -909,9 +909,9 @@ void scanDevices(TwoWire *w) #ifdef HAS_GPS -bool beginGPS() + +bool l76kProbe() { - SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); bool result = false; uint32_t startTimeout ; SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); @@ -919,12 +919,13 @@ bool beginGPS() // Get version information startTimeout = millis() + 3000; Serial.print("Try to init L76K . Wait stop ."); - SerialGPS.flush(); - + // SerialGPS.flush(); while (SerialGPS.available()) { + int c = SerialGPS.read(); + // Serial.write(c); // Serial.print("."); - Serial.flush(); - SerialGPS.flush(); + // Serial.flush(); + // SerialGPS.flush(); if (millis() > startTimeout) { Serial.println("Wait L76K stop NMEA timeout!"); return false; @@ -962,6 +963,19 @@ bool beginGPS() return result; } +bool beginGPS() +{ + SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); + bool result = false; + for ( int i = 0; i < 3; ++i) { + result = l76kProbe(); + if (result) { + return result; + } + } + return result; +} + static int getAck(uint8_t *buffer, uint16_t size, uint8_t requestedClass, uint8_t requestedID) diff --git a/examples/Sensor/BME280_AdvancedsettingsExample/LoRaBoards.cpp b/examples/Sensor/BME280_AdvancedsettingsExample/LoRaBoards.cpp index f5948b4..7e24151 100644 --- a/examples/Sensor/BME280_AdvancedsettingsExample/LoRaBoards.cpp +++ b/examples/Sensor/BME280_AdvancedsettingsExample/LoRaBoards.cpp @@ -909,9 +909,9 @@ void scanDevices(TwoWire *w) #ifdef HAS_GPS -bool beginGPS() + +bool l76kProbe() { - SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); bool result = false; uint32_t startTimeout ; SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); @@ -919,12 +919,13 @@ bool beginGPS() // Get version information startTimeout = millis() + 3000; Serial.print("Try to init L76K . Wait stop ."); - SerialGPS.flush(); - + // SerialGPS.flush(); while (SerialGPS.available()) { + int c = SerialGPS.read(); + // Serial.write(c); // Serial.print("."); - Serial.flush(); - SerialGPS.flush(); + // Serial.flush(); + // SerialGPS.flush(); if (millis() > startTimeout) { Serial.println("Wait L76K stop NMEA timeout!"); return false; @@ -962,6 +963,19 @@ bool beginGPS() return result; } +bool beginGPS() +{ + SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); + bool result = false; + for ( int i = 0; i < 3; ++i) { + result = l76kProbe(); + if (result) { + return result; + } + } + return result; +} + static int getAck(uint8_t *buffer, uint16_t size, uint8_t requestedClass, uint8_t requestedID) diff --git a/examples/Sensor/BME280_TestExample/LoRaBoards.cpp b/examples/Sensor/BME280_TestExample/LoRaBoards.cpp index f5948b4..7e24151 100644 --- a/examples/Sensor/BME280_TestExample/LoRaBoards.cpp +++ b/examples/Sensor/BME280_TestExample/LoRaBoards.cpp @@ -909,9 +909,9 @@ void scanDevices(TwoWire *w) #ifdef HAS_GPS -bool beginGPS() + +bool l76kProbe() { - SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); bool result = false; uint32_t startTimeout ; SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); @@ -919,12 +919,13 @@ bool beginGPS() // Get version information startTimeout = millis() + 3000; Serial.print("Try to init L76K . Wait stop ."); - SerialGPS.flush(); - + // SerialGPS.flush(); while (SerialGPS.available()) { + int c = SerialGPS.read(); + // Serial.write(c); // Serial.print("."); - Serial.flush(); - SerialGPS.flush(); + // Serial.flush(); + // SerialGPS.flush(); if (millis() > startTimeout) { Serial.println("Wait L76K stop NMEA timeout!"); return false; @@ -962,6 +963,19 @@ bool beginGPS() return result; } +bool beginGPS() +{ + SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); + bool result = false; + for ( int i = 0; i < 3; ++i) { + result = l76kProbe(); + if (result) { + return result; + } + } + return result; +} + static int getAck(uint8_t *buffer, uint16_t size, uint8_t requestedClass, uint8_t requestedID) diff --git a/examples/Sensor/BME280_UnifiedExample/LoRaBoards.cpp b/examples/Sensor/BME280_UnifiedExample/LoRaBoards.cpp index f5948b4..7e24151 100644 --- a/examples/Sensor/BME280_UnifiedExample/LoRaBoards.cpp +++ b/examples/Sensor/BME280_UnifiedExample/LoRaBoards.cpp @@ -909,9 +909,9 @@ void scanDevices(TwoWire *w) #ifdef HAS_GPS -bool beginGPS() + +bool l76kProbe() { - SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); bool result = false; uint32_t startTimeout ; SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); @@ -919,12 +919,13 @@ bool beginGPS() // Get version information startTimeout = millis() + 3000; Serial.print("Try to init L76K . Wait stop ."); - SerialGPS.flush(); - + // SerialGPS.flush(); while (SerialGPS.available()) { + int c = SerialGPS.read(); + // Serial.write(c); // Serial.print("."); - Serial.flush(); - SerialGPS.flush(); + // Serial.flush(); + // SerialGPS.flush(); if (millis() > startTimeout) { Serial.println("Wait L76K stop NMEA timeout!"); return false; @@ -962,6 +963,19 @@ bool beginGPS() return result; } +bool beginGPS() +{ + SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); + bool result = false; + for ( int i = 0; i < 3; ++i) { + result = l76kProbe(); + if (result) { + return result; + } + } + return result; +} + static int getAck(uint8_t *buffer, uint16_t size, uint8_t requestedClass, uint8_t requestedID) diff --git a/examples/Sensor/PCF8563_AlarmByUnits/LoRaBoards.cpp b/examples/Sensor/PCF8563_AlarmByUnits/LoRaBoards.cpp index f5948b4..7e24151 100644 --- a/examples/Sensor/PCF8563_AlarmByUnits/LoRaBoards.cpp +++ b/examples/Sensor/PCF8563_AlarmByUnits/LoRaBoards.cpp @@ -909,9 +909,9 @@ void scanDevices(TwoWire *w) #ifdef HAS_GPS -bool beginGPS() + +bool l76kProbe() { - SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); bool result = false; uint32_t startTimeout ; SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); @@ -919,12 +919,13 @@ bool beginGPS() // Get version information startTimeout = millis() + 3000; Serial.print("Try to init L76K . Wait stop ."); - SerialGPS.flush(); - + // SerialGPS.flush(); while (SerialGPS.available()) { + int c = SerialGPS.read(); + // Serial.write(c); // Serial.print("."); - Serial.flush(); - SerialGPS.flush(); + // Serial.flush(); + // SerialGPS.flush(); if (millis() > startTimeout) { Serial.println("Wait L76K stop NMEA timeout!"); return false; @@ -962,6 +963,19 @@ bool beginGPS() return result; } +bool beginGPS() +{ + SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); + bool result = false; + for ( int i = 0; i < 3; ++i) { + result = l76kProbe(); + if (result) { + return result; + } + } + return result; +} + static int getAck(uint8_t *buffer, uint16_t size, uint8_t requestedClass, uint8_t requestedID) diff --git a/examples/Sensor/PCF8563_SimpleTime/LoRaBoards.cpp b/examples/Sensor/PCF8563_SimpleTime/LoRaBoards.cpp index f5948b4..7e24151 100644 --- a/examples/Sensor/PCF8563_SimpleTime/LoRaBoards.cpp +++ b/examples/Sensor/PCF8563_SimpleTime/LoRaBoards.cpp @@ -909,9 +909,9 @@ void scanDevices(TwoWire *w) #ifdef HAS_GPS -bool beginGPS() + +bool l76kProbe() { - SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); bool result = false; uint32_t startTimeout ; SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); @@ -919,12 +919,13 @@ bool beginGPS() // Get version information startTimeout = millis() + 3000; Serial.print("Try to init L76K . Wait stop ."); - SerialGPS.flush(); - + // SerialGPS.flush(); while (SerialGPS.available()) { + int c = SerialGPS.read(); + // Serial.write(c); // Serial.print("."); - Serial.flush(); - SerialGPS.flush(); + // Serial.flush(); + // SerialGPS.flush(); if (millis() > startTimeout) { Serial.println("Wait L76K stop NMEA timeout!"); return false; @@ -962,6 +963,19 @@ bool beginGPS() return result; } +bool beginGPS() +{ + SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); + bool result = false; + for ( int i = 0; i < 3; ++i) { + result = l76kProbe(); + if (result) { + return result; + } + } + return result; +} + static int getAck(uint8_t *buffer, uint16_t size, uint8_t requestedClass, uint8_t requestedID) diff --git a/examples/Sensor/PCF8563_TimeLib/LoRaBoards.cpp b/examples/Sensor/PCF8563_TimeLib/LoRaBoards.cpp index f5948b4..7e24151 100644 --- a/examples/Sensor/PCF8563_TimeLib/LoRaBoards.cpp +++ b/examples/Sensor/PCF8563_TimeLib/LoRaBoards.cpp @@ -909,9 +909,9 @@ void scanDevices(TwoWire *w) #ifdef HAS_GPS -bool beginGPS() + +bool l76kProbe() { - SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); bool result = false; uint32_t startTimeout ; SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); @@ -919,12 +919,13 @@ bool beginGPS() // Get version information startTimeout = millis() + 3000; Serial.print("Try to init L76K . Wait stop ."); - SerialGPS.flush(); - + // SerialGPS.flush(); while (SerialGPS.available()) { + int c = SerialGPS.read(); + // Serial.write(c); // Serial.print("."); - Serial.flush(); - SerialGPS.flush(); + // Serial.flush(); + // SerialGPS.flush(); if (millis() > startTimeout) { Serial.println("Wait L76K stop NMEA timeout!"); return false; @@ -962,6 +963,19 @@ bool beginGPS() return result; } +bool beginGPS() +{ + SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); + bool result = false; + for ( int i = 0; i < 3; ++i) { + result = l76kProbe(); + if (result) { + return result; + } + } + return result; +} + static int getAck(uint8_t *buffer, uint16_t size, uint8_t requestedClass, uint8_t requestedID) diff --git a/examples/Sensor/PCF8563_TimeSynchronization/LoRaBoards.cpp b/examples/Sensor/PCF8563_TimeSynchronization/LoRaBoards.cpp index f5948b4..7e24151 100644 --- a/examples/Sensor/PCF8563_TimeSynchronization/LoRaBoards.cpp +++ b/examples/Sensor/PCF8563_TimeSynchronization/LoRaBoards.cpp @@ -909,9 +909,9 @@ void scanDevices(TwoWire *w) #ifdef HAS_GPS -bool beginGPS() + +bool l76kProbe() { - SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); bool result = false; uint32_t startTimeout ; SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); @@ -919,12 +919,13 @@ bool beginGPS() // Get version information startTimeout = millis() + 3000; Serial.print("Try to init L76K . Wait stop ."); - SerialGPS.flush(); - + // SerialGPS.flush(); while (SerialGPS.available()) { + int c = SerialGPS.read(); + // Serial.write(c); // Serial.print("."); - Serial.flush(); - SerialGPS.flush(); + // Serial.flush(); + // SerialGPS.flush(); if (millis() > startTimeout) { Serial.println("Wait L76K stop NMEA timeout!"); return false; @@ -962,6 +963,19 @@ bool beginGPS() return result; } +bool beginGPS() +{ + SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); + bool result = false; + for ( int i = 0; i < 3; ++i) { + result = l76kProbe(); + if (result) { + return result; + } + } + return result; +} + static int getAck(uint8_t *buffer, uint16_t size, uint8_t requestedClass, uint8_t requestedID) diff --git a/examples/Sensor/QMC6310_CalibrateExample/LoRaBoards.cpp b/examples/Sensor/QMC6310_CalibrateExample/LoRaBoards.cpp index f5948b4..7e24151 100644 --- a/examples/Sensor/QMC6310_CalibrateExample/LoRaBoards.cpp +++ b/examples/Sensor/QMC6310_CalibrateExample/LoRaBoards.cpp @@ -909,9 +909,9 @@ void scanDevices(TwoWire *w) #ifdef HAS_GPS -bool beginGPS() + +bool l76kProbe() { - SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); bool result = false; uint32_t startTimeout ; SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); @@ -919,12 +919,13 @@ bool beginGPS() // Get version information startTimeout = millis() + 3000; Serial.print("Try to init L76K . Wait stop ."); - SerialGPS.flush(); - + // SerialGPS.flush(); while (SerialGPS.available()) { + int c = SerialGPS.read(); + // Serial.write(c); // Serial.print("."); - Serial.flush(); - SerialGPS.flush(); + // Serial.flush(); + // SerialGPS.flush(); if (millis() > startTimeout) { Serial.println("Wait L76K stop NMEA timeout!"); return false; @@ -962,6 +963,19 @@ bool beginGPS() return result; } +bool beginGPS() +{ + SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); + bool result = false; + for ( int i = 0; i < 3; ++i) { + result = l76kProbe(); + if (result) { + return result; + } + } + return result; +} + static int getAck(uint8_t *buffer, uint16_t size, uint8_t requestedClass, uint8_t requestedID) diff --git a/examples/Sensor/QMC6310_CompassExample/LoRaBoards.cpp b/examples/Sensor/QMC6310_CompassExample/LoRaBoards.cpp index f5948b4..7e24151 100644 --- a/examples/Sensor/QMC6310_CompassExample/LoRaBoards.cpp +++ b/examples/Sensor/QMC6310_CompassExample/LoRaBoards.cpp @@ -909,9 +909,9 @@ void scanDevices(TwoWire *w) #ifdef HAS_GPS -bool beginGPS() + +bool l76kProbe() { - SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); bool result = false; uint32_t startTimeout ; SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); @@ -919,12 +919,13 @@ bool beginGPS() // Get version information startTimeout = millis() + 3000; Serial.print("Try to init L76K . Wait stop ."); - SerialGPS.flush(); - + // SerialGPS.flush(); while (SerialGPS.available()) { + int c = SerialGPS.read(); + // Serial.write(c); // Serial.print("."); - Serial.flush(); - SerialGPS.flush(); + // Serial.flush(); + // SerialGPS.flush(); if (millis() > startTimeout) { Serial.println("Wait L76K stop NMEA timeout!"); return false; @@ -962,6 +963,19 @@ bool beginGPS() return result; } +bool beginGPS() +{ + SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); + bool result = false; + for ( int i = 0; i < 3; ++i) { + result = l76kProbe(); + if (result) { + return result; + } + } + return result; +} + static int getAck(uint8_t *buffer, uint16_t size, uint8_t requestedClass, uint8_t requestedID) diff --git a/examples/Sensor/QMC6310_GetDataExample/LoRaBoards.cpp b/examples/Sensor/QMC6310_GetDataExample/LoRaBoards.cpp index f5948b4..7e24151 100644 --- a/examples/Sensor/QMC6310_GetDataExample/LoRaBoards.cpp +++ b/examples/Sensor/QMC6310_GetDataExample/LoRaBoards.cpp @@ -909,9 +909,9 @@ void scanDevices(TwoWire *w) #ifdef HAS_GPS -bool beginGPS() + +bool l76kProbe() { - SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); bool result = false; uint32_t startTimeout ; SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); @@ -919,12 +919,13 @@ bool beginGPS() // Get version information startTimeout = millis() + 3000; Serial.print("Try to init L76K . Wait stop ."); - SerialGPS.flush(); - + // SerialGPS.flush(); while (SerialGPS.available()) { + int c = SerialGPS.read(); + // Serial.write(c); // Serial.print("."); - Serial.flush(); - SerialGPS.flush(); + // Serial.flush(); + // SerialGPS.flush(); if (millis() > startTimeout) { Serial.println("Wait L76K stop NMEA timeout!"); return false; @@ -962,6 +963,19 @@ bool beginGPS() return result; } +bool beginGPS() +{ + SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); + bool result = false; + for ( int i = 0; i < 3; ++i) { + result = l76kProbe(); + if (result) { + return result; + } + } + return result; +} + static int getAck(uint8_t *buffer, uint16_t size, uint8_t requestedClass, uint8_t requestedID) diff --git a/examples/Sensor/QMC6310_GetPolarExample/LoRaBoards.cpp b/examples/Sensor/QMC6310_GetPolarExample/LoRaBoards.cpp index f5948b4..7e24151 100644 --- a/examples/Sensor/QMC6310_GetPolarExample/LoRaBoards.cpp +++ b/examples/Sensor/QMC6310_GetPolarExample/LoRaBoards.cpp @@ -909,9 +909,9 @@ void scanDevices(TwoWire *w) #ifdef HAS_GPS -bool beginGPS() + +bool l76kProbe() { - SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); bool result = false; uint32_t startTimeout ; SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); @@ -919,12 +919,13 @@ bool beginGPS() // Get version information startTimeout = millis() + 3000; Serial.print("Try to init L76K . Wait stop ."); - SerialGPS.flush(); - + // SerialGPS.flush(); while (SerialGPS.available()) { + int c = SerialGPS.read(); + // Serial.write(c); // Serial.print("."); - Serial.flush(); - SerialGPS.flush(); + // Serial.flush(); + // SerialGPS.flush(); if (millis() > startTimeout) { Serial.println("Wait L76K stop NMEA timeout!"); return false; @@ -962,6 +963,19 @@ bool beginGPS() return result; } +bool beginGPS() +{ + SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); + bool result = false; + for ( int i = 0; i < 3; ++i) { + result = l76kProbe(); + if (result) { + return result; + } + } + return result; +} + static int getAck(uint8_t *buffer, uint16_t size, uint8_t requestedClass, uint8_t requestedID) diff --git a/examples/Sensor/QMI8658_BlockExample/LoRaBoards.cpp b/examples/Sensor/QMI8658_BlockExample/LoRaBoards.cpp index f5948b4..7e24151 100644 --- a/examples/Sensor/QMI8658_BlockExample/LoRaBoards.cpp +++ b/examples/Sensor/QMI8658_BlockExample/LoRaBoards.cpp @@ -909,9 +909,9 @@ void scanDevices(TwoWire *w) #ifdef HAS_GPS -bool beginGPS() + +bool l76kProbe() { - SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); bool result = false; uint32_t startTimeout ; SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); @@ -919,12 +919,13 @@ bool beginGPS() // Get version information startTimeout = millis() + 3000; Serial.print("Try to init L76K . Wait stop ."); - SerialGPS.flush(); - + // SerialGPS.flush(); while (SerialGPS.available()) { + int c = SerialGPS.read(); + // Serial.write(c); // Serial.print("."); - Serial.flush(); - SerialGPS.flush(); + // Serial.flush(); + // SerialGPS.flush(); if (millis() > startTimeout) { Serial.println("Wait L76K stop NMEA timeout!"); return false; @@ -962,6 +963,19 @@ bool beginGPS() return result; } +bool beginGPS() +{ + SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); + bool result = false; + for ( int i = 0; i < 3; ++i) { + result = l76kProbe(); + if (result) { + return result; + } + } + return result; +} + static int getAck(uint8_t *buffer, uint16_t size, uint8_t requestedClass, uint8_t requestedID) diff --git a/examples/Sensor/QMI8658_GetDataExample/LoRaBoards.cpp b/examples/Sensor/QMI8658_GetDataExample/LoRaBoards.cpp index f5948b4..7e24151 100644 --- a/examples/Sensor/QMI8658_GetDataExample/LoRaBoards.cpp +++ b/examples/Sensor/QMI8658_GetDataExample/LoRaBoards.cpp @@ -909,9 +909,9 @@ void scanDevices(TwoWire *w) #ifdef HAS_GPS -bool beginGPS() + +bool l76kProbe() { - SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); bool result = false; uint32_t startTimeout ; SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); @@ -919,12 +919,13 @@ bool beginGPS() // Get version information startTimeout = millis() + 3000; Serial.print("Try to init L76K . Wait stop ."); - SerialGPS.flush(); - + // SerialGPS.flush(); while (SerialGPS.available()) { + int c = SerialGPS.read(); + // Serial.write(c); // Serial.print("."); - Serial.flush(); - SerialGPS.flush(); + // Serial.flush(); + // SerialGPS.flush(); if (millis() > startTimeout) { Serial.println("Wait L76K stop NMEA timeout!"); return false; @@ -962,6 +963,19 @@ bool beginGPS() return result; } +bool beginGPS() +{ + SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); + bool result = false; + for ( int i = 0; i < 3; ++i) { + result = l76kProbe(); + if (result) { + return result; + } + } + return result; +} + static int getAck(uint8_t *buffer, uint16_t size, uint8_t requestedClass, uint8_t requestedID) diff --git a/examples/Sensor/QMI8658_InterruptBlockExample/LoRaBoards.cpp b/examples/Sensor/QMI8658_InterruptBlockExample/LoRaBoards.cpp index f5948b4..7e24151 100644 --- a/examples/Sensor/QMI8658_InterruptBlockExample/LoRaBoards.cpp +++ b/examples/Sensor/QMI8658_InterruptBlockExample/LoRaBoards.cpp @@ -909,9 +909,9 @@ void scanDevices(TwoWire *w) #ifdef HAS_GPS -bool beginGPS() + +bool l76kProbe() { - SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); bool result = false; uint32_t startTimeout ; SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); @@ -919,12 +919,13 @@ bool beginGPS() // Get version information startTimeout = millis() + 3000; Serial.print("Try to init L76K . Wait stop ."); - SerialGPS.flush(); - + // SerialGPS.flush(); while (SerialGPS.available()) { + int c = SerialGPS.read(); + // Serial.write(c); // Serial.print("."); - Serial.flush(); - SerialGPS.flush(); + // Serial.flush(); + // SerialGPS.flush(); if (millis() > startTimeout) { Serial.println("Wait L76K stop NMEA timeout!"); return false; @@ -962,6 +963,19 @@ bool beginGPS() return result; } +bool beginGPS() +{ + SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); + bool result = false; + for ( int i = 0; i < 3; ++i) { + result = l76kProbe(); + if (result) { + return result; + } + } + return result; +} + static int getAck(uint8_t *buffer, uint16_t size, uint8_t requestedClass, uint8_t requestedID) diff --git a/examples/Sensor/QMI8658_InterruptExample/LoRaBoards.cpp b/examples/Sensor/QMI8658_InterruptExample/LoRaBoards.cpp index f5948b4..7e24151 100644 --- a/examples/Sensor/QMI8658_InterruptExample/LoRaBoards.cpp +++ b/examples/Sensor/QMI8658_InterruptExample/LoRaBoards.cpp @@ -909,9 +909,9 @@ void scanDevices(TwoWire *w) #ifdef HAS_GPS -bool beginGPS() + +bool l76kProbe() { - SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); bool result = false; uint32_t startTimeout ; SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); @@ -919,12 +919,13 @@ bool beginGPS() // Get version information startTimeout = millis() + 3000; Serial.print("Try to init L76K . Wait stop ."); - SerialGPS.flush(); - + // SerialGPS.flush(); while (SerialGPS.available()) { + int c = SerialGPS.read(); + // Serial.write(c); // Serial.print("."); - Serial.flush(); - SerialGPS.flush(); + // Serial.flush(); + // SerialGPS.flush(); if (millis() > startTimeout) { Serial.println("Wait L76K stop NMEA timeout!"); return false; @@ -962,6 +963,19 @@ bool beginGPS() return result; } +bool beginGPS() +{ + SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); + bool result = false; + for ( int i = 0; i < 3; ++i) { + result = l76kProbe(); + if (result) { + return result; + } + } + return result; +} + static int getAck(uint8_t *buffer, uint16_t size, uint8_t requestedClass, uint8_t requestedID) diff --git a/examples/Sensor/QMI8658_LockingMechanismExample/LoRaBoards.cpp b/examples/Sensor/QMI8658_LockingMechanismExample/LoRaBoards.cpp index f5948b4..7e24151 100644 --- a/examples/Sensor/QMI8658_LockingMechanismExample/LoRaBoards.cpp +++ b/examples/Sensor/QMI8658_LockingMechanismExample/LoRaBoards.cpp @@ -909,9 +909,9 @@ void scanDevices(TwoWire *w) #ifdef HAS_GPS -bool beginGPS() + +bool l76kProbe() { - SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); bool result = false; uint32_t startTimeout ; SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); @@ -919,12 +919,13 @@ bool beginGPS() // Get version information startTimeout = millis() + 3000; Serial.print("Try to init L76K . Wait stop ."); - SerialGPS.flush(); - + // SerialGPS.flush(); while (SerialGPS.available()) { + int c = SerialGPS.read(); + // Serial.write(c); // Serial.print("."); - Serial.flush(); - SerialGPS.flush(); + // Serial.flush(); + // SerialGPS.flush(); if (millis() > startTimeout) { Serial.println("Wait L76K stop NMEA timeout!"); return false; @@ -962,6 +963,19 @@ bool beginGPS() return result; } +bool beginGPS() +{ + SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); + bool result = false; + for ( int i = 0; i < 3; ++i) { + result = l76kProbe(); + if (result) { + return result; + } + } + return result; +} + static int getAck(uint8_t *buffer, uint16_t size, uint8_t requestedClass, uint8_t requestedID) diff --git a/examples/Sensor/QMI8658_MadgwickAHRS/LoRaBoards.cpp b/examples/Sensor/QMI8658_MadgwickAHRS/LoRaBoards.cpp index f5948b4..7e24151 100644 --- a/examples/Sensor/QMI8658_MadgwickAHRS/LoRaBoards.cpp +++ b/examples/Sensor/QMI8658_MadgwickAHRS/LoRaBoards.cpp @@ -909,9 +909,9 @@ void scanDevices(TwoWire *w) #ifdef HAS_GPS -bool beginGPS() + +bool l76kProbe() { - SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); bool result = false; uint32_t startTimeout ; SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); @@ -919,12 +919,13 @@ bool beginGPS() // Get version information startTimeout = millis() + 3000; Serial.print("Try to init L76K . Wait stop ."); - SerialGPS.flush(); - + // SerialGPS.flush(); while (SerialGPS.available()) { + int c = SerialGPS.read(); + // Serial.write(c); // Serial.print("."); - Serial.flush(); - SerialGPS.flush(); + // Serial.flush(); + // SerialGPS.flush(); if (millis() > startTimeout) { Serial.println("Wait L76K stop NMEA timeout!"); return false; @@ -962,6 +963,19 @@ bool beginGPS() return result; } +bool beginGPS() +{ + SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); + bool result = false; + for ( int i = 0; i < 3; ++i) { + result = l76kProbe(); + if (result) { + return result; + } + } + return result; +} + static int getAck(uint8_t *buffer, uint16_t size, uint8_t requestedClass, uint8_t requestedID) diff --git a/examples/Sensor/QMI8658_PedometerExample/LoRaBoards.cpp b/examples/Sensor/QMI8658_PedometerExample/LoRaBoards.cpp index f5948b4..7e24151 100644 --- a/examples/Sensor/QMI8658_PedometerExample/LoRaBoards.cpp +++ b/examples/Sensor/QMI8658_PedometerExample/LoRaBoards.cpp @@ -909,9 +909,9 @@ void scanDevices(TwoWire *w) #ifdef HAS_GPS -bool beginGPS() + +bool l76kProbe() { - SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); bool result = false; uint32_t startTimeout ; SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); @@ -919,12 +919,13 @@ bool beginGPS() // Get version information startTimeout = millis() + 3000; Serial.print("Try to init L76K . Wait stop ."); - SerialGPS.flush(); - + // SerialGPS.flush(); while (SerialGPS.available()) { + int c = SerialGPS.read(); + // Serial.write(c); // Serial.print("."); - Serial.flush(); - SerialGPS.flush(); + // Serial.flush(); + // SerialGPS.flush(); if (millis() > startTimeout) { Serial.println("Wait L76K stop NMEA timeout!"); return false; @@ -962,6 +963,19 @@ bool beginGPS() return result; } +bool beginGPS() +{ + SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); + bool result = false; + for ( int i = 0; i < 3; ++i) { + result = l76kProbe(); + if (result) { + return result; + } + } + return result; +} + static int getAck(uint8_t *buffer, uint16_t size, uint8_t requestedClass, uint8_t requestedID) diff --git a/examples/Sensor/QMI8658_ReadFromFifoExample/LoRaBoards.cpp b/examples/Sensor/QMI8658_ReadFromFifoExample/LoRaBoards.cpp index f5948b4..7e24151 100644 --- a/examples/Sensor/QMI8658_ReadFromFifoExample/LoRaBoards.cpp +++ b/examples/Sensor/QMI8658_ReadFromFifoExample/LoRaBoards.cpp @@ -909,9 +909,9 @@ void scanDevices(TwoWire *w) #ifdef HAS_GPS -bool beginGPS() + +bool l76kProbe() { - SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); bool result = false; uint32_t startTimeout ; SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); @@ -919,12 +919,13 @@ bool beginGPS() // Get version information startTimeout = millis() + 3000; Serial.print("Try to init L76K . Wait stop ."); - SerialGPS.flush(); - + // SerialGPS.flush(); while (SerialGPS.available()) { + int c = SerialGPS.read(); + // Serial.write(c); // Serial.print("."); - Serial.flush(); - SerialGPS.flush(); + // Serial.flush(); + // SerialGPS.flush(); if (millis() > startTimeout) { Serial.println("Wait L76K stop NMEA timeout!"); return false; @@ -962,6 +963,19 @@ bool beginGPS() return result; } +bool beginGPS() +{ + SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); + bool result = false; + for ( int i = 0; i < 3; ++i) { + result = l76kProbe(); + if (result) { + return result; + } + } + return result; +} + static int getAck(uint8_t *buffer, uint16_t size, uint8_t requestedClass, uint8_t requestedID) diff --git a/examples/Sensor/QMI8658_WakeOnMotion/LoRaBoards.cpp b/examples/Sensor/QMI8658_WakeOnMotion/LoRaBoards.cpp index f5948b4..7e24151 100644 --- a/examples/Sensor/QMI8658_WakeOnMotion/LoRaBoards.cpp +++ b/examples/Sensor/QMI8658_WakeOnMotion/LoRaBoards.cpp @@ -909,9 +909,9 @@ void scanDevices(TwoWire *w) #ifdef HAS_GPS -bool beginGPS() + +bool l76kProbe() { - SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); bool result = false; uint32_t startTimeout ; SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); @@ -919,12 +919,13 @@ bool beginGPS() // Get version information startTimeout = millis() + 3000; Serial.print("Try to init L76K . Wait stop ."); - SerialGPS.flush(); - + // SerialGPS.flush(); while (SerialGPS.available()) { + int c = SerialGPS.read(); + // Serial.write(c); // Serial.print("."); - Serial.flush(); - SerialGPS.flush(); + // Serial.flush(); + // SerialGPS.flush(); if (millis() > startTimeout) { Serial.println("Wait L76K stop NMEA timeout!"); return false; @@ -962,6 +963,19 @@ bool beginGPS() return result; } +bool beginGPS() +{ + SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); + bool result = false; + for ( int i = 0; i < 3; ++i) { + result = l76kProbe(); + if (result) { + return result; + } + } + return result; +} + static int getAck(uint8_t *buffer, uint16_t size, uint8_t requestedClass, uint8_t requestedID) diff --git a/examples/T3S3Factory/LoRaBoards.cpp b/examples/T3S3Factory/LoRaBoards.cpp index f5948b4..7e24151 100644 --- a/examples/T3S3Factory/LoRaBoards.cpp +++ b/examples/T3S3Factory/LoRaBoards.cpp @@ -909,9 +909,9 @@ void scanDevices(TwoWire *w) #ifdef HAS_GPS -bool beginGPS() + +bool l76kProbe() { - SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); bool result = false; uint32_t startTimeout ; SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); @@ -919,12 +919,13 @@ bool beginGPS() // Get version information startTimeout = millis() + 3000; Serial.print("Try to init L76K . Wait stop ."); - SerialGPS.flush(); - + // SerialGPS.flush(); while (SerialGPS.available()) { + int c = SerialGPS.read(); + // Serial.write(c); // Serial.print("."); - Serial.flush(); - SerialGPS.flush(); + // Serial.flush(); + // SerialGPS.flush(); if (millis() > startTimeout) { Serial.println("Wait L76K stop NMEA timeout!"); return false; @@ -962,6 +963,19 @@ bool beginGPS() return result; } +bool beginGPS() +{ + SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); + bool result = false; + for ( int i = 0; i < 3; ++i) { + result = l76kProbe(); + if (result) { + return result; + } + } + return result; +} + static int getAck(uint8_t *buffer, uint16_t size, uint8_t requestedClass, uint8_t requestedID) diff --git a/examples/TBeamFactory/LoRaBoards.cpp b/examples/TBeamFactory/LoRaBoards.cpp index f5948b4..7e24151 100644 --- a/examples/TBeamFactory/LoRaBoards.cpp +++ b/examples/TBeamFactory/LoRaBoards.cpp @@ -909,9 +909,9 @@ void scanDevices(TwoWire *w) #ifdef HAS_GPS -bool beginGPS() + +bool l76kProbe() { - SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); bool result = false; uint32_t startTimeout ; SerialGPS.write("$PCAS03,0,0,0,0,0,0,0,0,0,0,,,0,0*02\r\n"); @@ -919,12 +919,13 @@ bool beginGPS() // Get version information startTimeout = millis() + 3000; Serial.print("Try to init L76K . Wait stop ."); - SerialGPS.flush(); - + // SerialGPS.flush(); while (SerialGPS.available()) { + int c = SerialGPS.read(); + // Serial.write(c); // Serial.print("."); - Serial.flush(); - SerialGPS.flush(); + // Serial.flush(); + // SerialGPS.flush(); if (millis() > startTimeout) { Serial.println("Wait L76K stop NMEA timeout!"); return false; @@ -962,6 +963,19 @@ bool beginGPS() return result; } +bool beginGPS() +{ + SerialGPS.begin(GPS_BAUD_RATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); + bool result = false; + for ( int i = 0; i < 3; ++i) { + result = l76kProbe(); + if (result) { + return result; + } + } + return result; +} + static int getAck(uint8_t *buffer, uint16_t size, uint8_t requestedClass, uint8_t requestedID)