Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions examples/companion_radio/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,11 @@ void setup() {
#endif

#ifdef DISPLAY_CLASS
#ifdef RAK_BOARD
// sensors.begin() GPS probe may power-cycle 3V3_S rail (via WB_IO2),
// which resets the SSD1306. Re-init the display before starting UI.
if (disp) display.begin();
#endif
ui_task.begin(disp, &sensors, the_mesh.getNodePrefs()); // still want to pass this in as dependency, as prefs might be moved
#endif
}
Expand Down
7 changes: 2 additions & 5 deletions src/helpers/ArduinoSerialInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,8 @@ class ArduinoSerialInterface : public BaseSerialInterface {
public:
ArduinoSerialInterface() { _isEnabled = false; _state = 0; }

void begin(Stream& serial) {
_serial = &serial;
#ifdef RAK_4631
pinMode(WB_IO2, OUTPUT);
#endif
void begin(Stream& serial) {
_serial = &serial;
}

// BaseSerialInterface methods
Expand Down
9 changes: 8 additions & 1 deletion src/helpers/sensors/EnvironmentSensorManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -655,7 +655,14 @@ void EnvironmentSensorManager::rakGPSInit(){
// MESH_DEBUG_PRINTLN("RAK base board is RAK19007/10");
// MESH_DEBUG_PRINTLN("GPS is installed on Socket A");
}
else if(gpsIsAwake(WB_IO4)){

// WB_IO2 controls the 3V3_S switched peripheral rail on RAK these boards.
// gpsIsAwake() leaves the pin as INPUT on failure, killing the rail.
// Restore it now, before probing other sockets.
pinMode(WB_IO2, OUTPUT);
digitalWrite(WB_IO2, HIGH);

if(gpsIsAwake(WB_IO4)){
// MESH_DEBUG_PRINTLN("RAK base board is RAK19003/9");
// MESH_DEBUG_PRINTLN("GPS is installed on Socket C");
}
Expand Down
3 changes: 3 additions & 0 deletions variants/rak4631/RAK4631Board.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ void RAK4631Board::initiateShutdown(uint8_t reason) {
// Disable LoRa module power before shutdown
digitalWrite(SX126X_POWER_EN, LOW);

// Disable 3V3 switched peripherals
digitalWrite(PIN_3V3_EN, LOW);

if (reason == SHUTDOWN_REASON_LOW_VOLTAGE ||
reason == SHUTDOWN_REASON_BOOT_PROTECT) {
configureVoltageWake(power_config.lpcomp_ain_channel, power_config.lpcomp_refsel);
Expand Down
7 changes: 5 additions & 2 deletions variants/rak4631/variant.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ void initVariant()
ledOff(PIN_LED1);

pinMode(PIN_LED2, OUTPUT);
ledOff(PIN_LED2);;
}
ledOff(PIN_LED2);

// 3V3 Power Rail
pinMode(PIN_3V3_EN, OUTPUT);
digitalWrite(PIN_3V3_EN, HIGH);
}
2 changes: 2 additions & 0 deletions variants/rak4631/variant.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ extern "C"
static const uint8_t WB_SPI_MISO = 29; // IO_SLOT
static const uint8_t WB_SPI_MOSI = 30; // IO_SLOT

#define PIN_3V3_EN WB_IO2 // 3V3_S switched peripheral rail control

// Number of pins defined in PinDescription array
#define PINS_COUNT (48)
#define NUM_DIGITAL_PINS (48)
Expand Down