Repository navigation
feat: Reliable GPS on all RAK WisBlock GPS boards (RAK12500 ublox + RAK12501 Quectel) #2640
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
b6e6730
c9dfd1b
f2ad72e
160ad79
a13098a
9e8cbf6
14f9d08
13d3496
47d3753
ff82e66
8f867bf
d2e4748
503ed85
b3a592d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -168,16 +168,21 @@ class RAK12500LocationProvider : public LocationProvider { | |
| void begin() override { } | ||
| void stop() override { } | ||
| void loop() override { | ||
| if (ublox_GNSS.getGnssFixOk(8)) { | ||
| // The numeric arg is maxWait (ms) for the I²C poll, not a field index. | ||
| // The previous 2/8 ms values were below the ublox response window, so polls | ||
| // routinely timed out and returned stale/garbage PVT data (observed: random | ||
| // wrong-hemisphere longitudes despite getGnssFixOk() returning true). | ||
| // 250 ms matches the SparkFun library's typical response time. | ||
| if (ublox_GNSS.getGnssFixOk(250)) { | ||
| _fix = true; | ||
| _lat = ublox_GNSS.getLatitude(2) / 10; | ||
| _lng = ublox_GNSS.getLongitude(2) / 10; | ||
| _alt = ublox_GNSS.getAltitude(2); | ||
| _sats = ublox_GNSS.getSIV(2); | ||
| _lat = ublox_GNSS.getLatitude(250) / 10; | ||
| _lng = ublox_GNSS.getLongitude(250) / 10; | ||
|
disq marked this conversation as resolved.
Outdated
|
||
| _alt = ublox_GNSS.getAltitudeMSL(250); // height above mean sea level, not ellipsoid | ||
| _sats = ublox_GNSS.getSIV(250); | ||
| } else { | ||
| _fix = false; | ||
| } | ||
| _epoch = ublox_GNSS.getUnixEpoch(2); | ||
| _epoch = ublox_GNSS.getUnixEpoch(250); | ||
| } | ||
| bool isEnabled() override { return true; } | ||
| }; | ||
|
|
@@ -702,16 +707,25 @@ void EnvironmentSensorManager::rakGPSInit(){ | |
| //search for the correct IO standby pin depending on socket used | ||
| if(gpsIsAwake(WB_IO2)){ | ||
| } | ||
| else if(gpsIsAwake(WB_IO4)){ | ||
| } | ||
| else if(gpsIsAwake(WB_IO5)){ | ||
| } | ||
| else{ | ||
| MESH_DEBUG_PRINTLN("No GPS found"); | ||
| gps_active = false; | ||
| gps_detected = false; | ||
| Serial1.end(); | ||
| return; | ||
| else { | ||
| // WB_IO2 controls the 3V3_S switched peripheral rail on these RAK boards. | ||
| // gpsIsAwake() leaves the pin as INPUT on failure, which drops the rail and | ||
| // takes I²C peripherals (RTC, display, the GPS itself) down with it. | ||
| // Restore it before probing other sockets. | ||
| pinMode(WB_IO2, OUTPUT); | ||
| digitalWrite(WB_IO2, HIGH); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In my test, we need a delay(500) after set HIGH. |
||
|
|
||
| if(gpsIsAwake(WB_IO4)){ | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why we need to check at WB_IO4 and IO5? |
||
| } | ||
| else if(gpsIsAwake(WB_IO5)){ | ||
| } | ||
| else{ | ||
| MESH_DEBUG_PRINTLN("No GPS found"); | ||
| gps_active = false; | ||
| gps_detected = false; | ||
| Serial1.end(); | ||
| return; | ||
| } | ||
| } | ||
|
|
||
| #ifndef FORCE_GPS_ALIVE // for use with repeaters, until GPS toggle is implimented | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.