mirror of
https://github.com/mikecarper/MeshCore.git
synced 2026-09-02 15:03:44 +00:00
For RAK only, fixed reset pin and honour FORCE_GPS_ALIVE
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ build_flags = ${nrf52_base.build_flags}
|
||||
${sensor_base.build_flags}
|
||||
-I variants/rak3401
|
||||
-D RAK_3401
|
||||
-D RAK_BOARD
|
||||
; -D NRF52_POWER_MANAGEMENT
|
||||
-D RADIO_CLASS=CustomSX1262
|
||||
-D WRAPPER_CLASS=CustomSX1262Wrapper
|
||||
@@ -14,6 +15,9 @@ build_flags = ${nrf52_base.build_flags}
|
||||
-D SX126X_CURRENT_LIMIT=140
|
||||
-D SX126X_RX_BOOSTED_GAIN=1
|
||||
-D SX126X_REGISTER_PATCH=1 ; Patch register 0x8B5 for improved RX with SKY66122 FEM
|
||||
-D FORCE_GPS_ALIVE ; on RAK3401, gpsResetPin ends up = WB_IO2 (kills 3V3_S rail) or
|
||||
; pin 4 (= SX126X_RESET, holds radio in reset). stop_gps() must not run.
|
||||
-D PIN_GPS_EN=-1 ; -1 = no dedicated GPS enable pin (power is the shared 3V3_S rail), same as rak4631
|
||||
build_src_filter = ${nrf52_base.build_src_filter}
|
||||
+<../variants/rak3401>
|
||||
+<helpers/sensors>
|
||||
|
||||
@@ -188,8 +188,8 @@ static const uint8_t AREF = PIN_AREF;
|
||||
// Power is on the controllable 3V3_S rail
|
||||
#define PIN_GPS_PPS (17) // Pulse per second input from the GPS
|
||||
|
||||
#define PIN_GPS_RX PIN_SERIAL1_RX
|
||||
#define PIN_GPS_TX PIN_SERIAL1_TX
|
||||
#define PIN_GPS_RX PIN_SERIAL1_TX
|
||||
#define PIN_GPS_TX PIN_SERIAL1_RX
|
||||
|
||||
#define PIN_GPS_1PPS PIN_GPS_PPS
|
||||
#define GPS_BAUD_RATE 9600
|
||||
|
||||
@@ -13,8 +13,6 @@ build_flags = ${nrf52_base.build_flags}
|
||||
; -D NRF52_POWER_MANAGEMENT
|
||||
-D PIN_BOARD_SCL=14
|
||||
-D PIN_BOARD_SDA=13
|
||||
-D PIN_GPS_TX=PIN_SERIAL1_RX
|
||||
-D PIN_GPS_RX=PIN_SERIAL1_TX
|
||||
-D PIN_GPS_EN=-1
|
||||
-D PIN_OLED_RESET=-1
|
||||
-D USE_SX1262
|
||||
|
||||
@@ -182,6 +182,9 @@ extern "C"
|
||||
#define EXTERNAL_FLASH_DEVICES IS25LP080D
|
||||
#define EXTERNAL_FLASH_USE_QSPI
|
||||
|
||||
#define PIN_GPS_RX PIN_SERIAL1_TX
|
||||
#define PIN_GPS_TX PIN_SERIAL1_RX
|
||||
|
||||
#define PIN_GPS_1PPS 17 //GPS PPS pin
|
||||
#define GPS_BAUD_RATE 9600
|
||||
#define GPS_ADDRESS 0x42 //i2c address for GPS
|
||||
|
||||
Reference in New Issue
Block a user