mirror of
https://github.com/mikecarper/MeshCore.git
synced 2026-10-25 10:52:38 +00:00
For RAK only, fixed reset pin and honour FORCE_GPS_ALIVE
This commit is contained in:
1 parent
d3539e8810
commit
1bf80992b9
5 files changed
+18
-19
No files matched your search
@@ -169,7 +169,9 @@ static RAK12035_SoilMoisture RAK12035;
|
||||
#endif
|
||||
|
||||
#ifdef RAK_WISBLOCK_GPS
|
||||
static uint32_t gpsResetPin = 0;
|
||||
// -1 = no enable pin; out-of-range values are no-ops in pinMode/digitalWrite,
|
||||
// while 0 would be a real GPIO (P0.00 = LFXO crystal on nRF52)
|
||||
static uint32_t gpsResetPin = -1;
|
||||
static bool i2cGPSFlag = false;
|
||||
static bool serialGPSFlag = false;
|
||||
#ifndef TELEM_RAK12500_ADDRESS
|
||||
@@ -812,11 +814,7 @@ void EnvironmentSensorManager::rakGPSInit() {
|
||||
|
||||
// search for the correct IO standby pin depending on socket used
|
||||
if (gpsIsAwake(WB_IO2)) {
|
||||
_location->setPinEn(WB_IO2);
|
||||
} else if (gpsIsAwake(WB_IO4)) {
|
||||
_location->setPinEn(WB_IO4);
|
||||
} else if (gpsIsAwake(WB_IO5)) {
|
||||
_location->setPinEn(WB_IO5);
|
||||
_location->setPinEn(WB_IO2); // WB_IO2 is the power switch for all sensor and IO slots
|
||||
} else {
|
||||
MESH_DEBUG_PRINTLN("No GPS found");
|
||||
gps_active = false;
|
||||
@@ -861,11 +859,7 @@ bool EnvironmentSensorManager::gpsIsAwake(uint8_t ioPin) {
|
||||
return true;
|
||||
} else if (Serial1.available()) { // RAK12501 (L76K) on UART
|
||||
MESH_DEBUG_PRINTLN("Serial GPS init correctly and is turned on");
|
||||
#ifdef PIN_GPS_EN
|
||||
if (PIN_GPS_EN) {
|
||||
gpsResetPin = PIN_GPS_EN;
|
||||
}
|
||||
#endif
|
||||
gpsResetPin = ioPin;
|
||||
serialGPSFlag = true;
|
||||
gps_active = true;
|
||||
gps_detected = true;
|
||||
@@ -889,8 +883,7 @@ void EnvironmentSensorManager::start_gps() {
|
||||
|
||||
#ifdef RAK_WISBLOCK_GPS
|
||||
pinMode(gpsResetPin, OUTPUT);
|
||||
digitalWrite(gpsResetPin, HIGH);
|
||||
gpsIsAwake(_location->getPinEn()); // Turn on UART L76K for RAK12500 or I2C for RAK12501
|
||||
digitalWrite(gpsResetPin, HIGH); // WB_IO2
|
||||
return;
|
||||
#endif
|
||||
|
||||
@@ -913,9 +906,10 @@ void EnvironmentSensorManager::stop_gps() {
|
||||
}
|
||||
|
||||
#ifdef RAK_WISBLOCK_GPS
|
||||
#ifndef FORCE_GPS_ALIVE
|
||||
pinMode(gpsResetPin, OUTPUT);
|
||||
digitalWrite(gpsResetPin, LOW);
|
||||
digitalWrite(_location->getPinEn(), LOW); // Cut off power
|
||||
digitalWrite(gpsResetPin, LOW); // WB_IO2
|
||||
#endif
|
||||
return;
|
||||
#endif
|
||||
|
||||
|
||||
Reference in new issue
Block a user