Browse Source

diag build

pull/1914/head
Wessel Nieboer 3 months ago
parent
commit
fcdd982273
No known key found for this signature in database GPG Key ID: 929C8E45E33B5FD2
  1. 34
      variants/rak4631/RAK4631Board.cpp
  2. 17
      variants/rak4631/platformio.ini

34
variants/rak4631/RAK4631Board.cpp

@ -3,6 +3,22 @@
#include "RAK4631Board.h"
#ifdef BOOT_DIAG
// Diagnostic LED blink: N short blinks on green LED to indicate boot stage
static void diag_blink(uint8_t count) {
pinMode(PIN_LED1, OUTPUT);
for (uint8_t i = 0; i < count; i++) {
digitalWrite(PIN_LED1, HIGH);
delay(100);
digitalWrite(PIN_LED1, LOW);
delay(150);
}
delay(300);
}
#else
#define diag_blink(n) ((void)0)
#endif
#ifdef NRF52_POWER_MANAGEMENT
// Static configuration for power management
// Values set in variant.h defines
@ -28,7 +44,16 @@ void RAK4631Board::initiateShutdown(uint8_t reason) {
#endif // NRF52_POWER_MANAGEMENT
void RAK4631Board::begin() {
diag_blink(1); // Stage 1: entering begin()
#ifdef DISABLE_DCDC
NRF52Board::begin();
#else
NRF52BoardDCDC::begin();
#endif
diag_blink(2); // Stage 2: board base init done
pinMode(PIN_VBAT_READ, INPUT);
#ifdef PIN_USER_BTN
pinMode(PIN_USER_BTN, INPUT_PULLUP);
@ -44,12 +69,19 @@ void RAK4631Board::begin() {
Wire.begin();
diag_blink(3); // Stage 3: I2C done, about to configure LoRa power
pinMode(SX126X_POWER_EN, OUTPUT);
#ifdef NRF52_POWER_MANAGEMENT
#if defined(NRF52_POWER_MANAGEMENT) && !defined(DISABLE_BOOT_PROTECTION)
// Boot voltage protection check (may not return if voltage too low)
// We need to call this after we configure SX126X_POWER_EN as output but before we pull high
checkBootVoltage(&power_config);
#endif
diag_blink(4); // Stage 4: power check passed
digitalWrite(SX126X_POWER_EN, HIGH);
delay(10); // give sx1262 some time to power up
diag_blink(5); // Stage 5: board.begin() complete
}

17
variants/rak4631/platformio.ini

@ -53,6 +53,23 @@ build_src_filter = ${rak4631.build_src_filter}
+<helpers/ui/SSD1306Display.cpp>
+<../examples/simple_repeater>
; Diagnostic build: LED blinks at boot stages + boot protection disabled
[env:RAK_4631_repeater_diag]
extends = env:RAK_4631_repeater
build_flags =
${env:RAK_4631_repeater.build_flags}
-D BOOT_DIAG
-D DISABLE_BOOT_PROTECTION
; Diagnostic build: LED blinks + boot protection disabled + DC/DC disabled
[env:RAK_4631_repeater_diag_no_dcdc]
extends = env:RAK_4631_repeater
build_flags =
${env:RAK_4631_repeater.build_flags}
-D BOOT_DIAG
-D DISABLE_BOOT_PROTECTION
-D DISABLE_DCDC
[env:RAK_4631_repeater_bridge_rs232_serial1]
extends = rak4631
build_flags =

Loading…
Cancel
Save