PowerSaving changes to variants:

- Fixed powerOff, shutdownPeripherals and added enterDeepSleep()
- Keep time across reset for NRF52
- Minor fixes
This commit is contained in:
Kevin Le committed 2026-10-17 11:40:02 +07:00
1 parent 2d94fe325d
commit 48a8e9ee8c
51 files changed
+201 -115

No files matched your search

@@ -43,11 +43,11 @@ public:
}
#endif
void powerOff() override {
void shutdownPeripherals() override {
NRF52Board::shutdownPeripherals();
uint32_t button_pin = PIN_BUTTON1;
nrf_gpio_cfg_input(button_pin, NRF_GPIO_PIN_PULLUP);
nrf_gpio_cfg_sense_set(button_pin, NRF_GPIO_PIN_SENSE_LOW);
NRF52Board::powerOff();
}
};
@@ -2,6 +2,7 @@
extends = nrf52_base
board = rak4631
board_check = true
board_build.ldscript = boards/nrf52840_s140_v6.ld
build_flags = ${nrf52_base.build_flags}
${sensor_base.build_flags}
-I variants/gat562_30s_mesh_kit
@@ -43,11 +43,11 @@ public:
}
#endif
void powerOff() override {
void shutdownPeripherals() override {
NRF52Board::shutdownPeripherals();
uint32_t button_pin = PIN_BUTTON1;
nrf_gpio_cfg_input(button_pin, NRF_GPIO_PIN_PULLUP);
nrf_gpio_cfg_sense_set(button_pin, NRF_GPIO_PIN_SENSE_LOW);
NRF52Board::powerOff();
}
};
@@ -43,11 +43,11 @@ public:
}
#endif
void powerOff() override {
void shutdownPeripherals() override {
NRF52Board::shutdownPeripherals();
uint32_t button_pin = PIN_BUTTON1;
nrf_gpio_cfg_input(button_pin, NRF_GPIO_PIN_PULLUP);
nrf_gpio_cfg_sense_set(button_pin, NRF_GPIO_PIN_SENSE_LOW);
NRF52Board::powerOff();
}
};
@@ -2,9 +2,11 @@
extends = nrf52_base
board = rak4631
board_check = true
board_build.ldscript = boards/nrf52840_s140_v6.ld
build_flags = ${nrf52_base.build_flags}
${sensor_base.build_flags}
-I variants/gat562_mesh_tracker_pro
; -D NRF52_POWER_MANAGEMENT
-D PIN_BOARD_SCL=14
-D PIN_BOARD_SDA=13
-D PIN_OLED_RESET=-1
@@ -34,11 +34,11 @@ public:
}
void powerOff() override {
void shutdownPeripherals() override {
NRF52Board::shutdownPeripherals();
uint32_t button_pin = PIN_BUTTON1;
nrf_gpio_cfg_input(button_pin, NRF_GPIO_PIN_PULLUP);
nrf_gpio_cfg_sense_set(button_pin, NRF_GPIO_PIN_SENSE_LOW);
NRF52Board::powerOff();
}
};
-4
View File
@@ -31,10 +31,6 @@ void HeltecRC32Board::begin() {
}
}
void HeltecRC32Board::powerOff() {
enterDeepSleep(0);
}
void HeltecRC32Board::onBeforeTransmit() {
digitalWrite(P_LORA_TX_LED, HIGH);
}
-1
View File
@@ -21,7 +21,6 @@ public:
void begin();
void onBeforeTransmit() override;
void onAfterTransmit() override;
void powerOff() override;
uint16_t getBattMilliVolts() override;
bool setAdcMultiplier(float multiplier) override;
float getAdcMultiplier() const override { return adc_mult; }
+3 -2
View File
@@ -111,10 +111,11 @@ void T096Board::variant_shutdown() {
nrf_gpio_cfg_default(PIN_GPS_TX);
}
void T096Board::powerOff() {
void T096Board::shutdownPeripherals() {
NRF52Board::shutdownPeripherals();
loRaFEMControl.setSleepModeEnable();
nrf_gpio_cfg_default(PIN_GPS_EN); // 363uA down to 39uA
NRF52Board::powerOff();
}
const char* T096Board::getManufacturerName() const {
+1 -1
View File
@@ -32,5 +32,5 @@ public:
void onAfterTransmit(void) override;
uint16_t getBattMilliVolts() override;
const char* getManufacturerName() const override ;
void powerOff() override;
void shutdownPeripherals() override;
};
+2
View File
@@ -68,6 +68,7 @@ build_flags =
-D MAX_NEIGHBOURS=50
; -D MESH_PACKET_LOGGING=1
; -D MESH_DEBUG=1
; -D POWERSAVING_DEBUG=1
[env:Heltec_t096_repeater_bridge_rs232]
extends = Heltec_t096
@@ -134,6 +135,7 @@ build_flags =
-D OFFLINE_QUEUE_SIZE=256
; -D MESH_PACKET_LOGGING=1
; -D MESH_DEBUG=1
; -D POWERSAVING_DEBUG=1
build_src_filter = ${Heltec_t096.build_src_filter}
+<helpers/nrf52/SerialBLEInterface.cpp>
+<../examples/companion_radio/*.cpp>
+3 -2
View File
@@ -97,9 +97,10 @@ void T1Board::variant_shutdown() {
digitalWrite(PIN_BAT_CTL, !ADC_CTRL_ENABLED);
}
void T1Board::powerOff() {
void T1Board::shutdownPeripherals() {
NRF52Board::shutdownPeripherals();
variant_shutdown();
NRF52Board::powerOff();
}
const char* T1Board::getManufacturerName() const {
+1 -1
View File
@@ -22,5 +22,5 @@ public:
void onAfterTransmit() override;
uint16_t getBattMilliVolts() override;
const char* getManufacturerName() const override;
void powerOff() override;
void shutdownPeripherals() override;
};
+3 -3
View File
@@ -46,11 +46,11 @@ public:
return "Heltec T114";
}
void powerOff() override {
void shutdownPeripherals() override {
NRF52Board::shutdownPeripherals();
#ifdef LED_PIN
digitalWrite(LED_PIN, HIGH);
#endif
NRF52Board::powerOff();
}
};
+18
View File
@@ -12,6 +12,7 @@ build_flags = ${nrf52_base.build_flags}
-I variants/heltec_t114
-I src/helpers/ui
-D HELTEC_T114
; -D NRF52_POWER_MANAGEMENT
-D P_LORA_DIO_1=20
-D P_LORA_NSS=24
-D P_LORA_RESET=25
@@ -172,6 +173,7 @@ build_flags =
-D MAX_NEIGHBOURS=50
; -D MESH_PACKET_LOGGING=1
; -D MESH_DEBUG=1
; -D POWERSAVING_DEBUG=1
[env:Heltec_t114_repeater_bridge_rs232]
extends = Heltec_t114
@@ -221,6 +223,7 @@ build_flags =
-D OFFLINE_QUEUE_SIZE=256
; -D MESH_PACKET_LOGGING=1
; -D MESH_DEBUG=1
; -D POWERSAVING_DEBUG=1
build_src_filter = ${Heltec_t114_with_display.build_src_filter}
+<helpers/nrf52/SerialBLEInterface.cpp>
+<../examples/companion_radio/*.cpp>
@@ -255,3 +258,18 @@ lib_deps =
extends = Heltec_t114
build_src_filter = ${Heltec_t114.build_src_filter}
+<../examples/kiss_modem/>
[env:Heltec_t114_sensor]
extends = Heltec_t114_with_display
build_src_filter = ${Heltec_t114_with_display.build_src_filter}
+<../examples/simple_sensor>
build_flags =
${Heltec_t114_with_display.build_flags}
-D ADVERT_NAME='"Heltec_T114 Sensor"'
-D ADVERT_LAT=0.0
-D ADVERT_LON=0.0
-D ADMIN_PASSWORD='"password"'
-D MAX_NEIGHBOURS=50
; -D MESH_PACKET_LOGGING=1
; -D MESH_DEBUG=1
; -D POWERSAVING_DEBUG=1
@@ -88,7 +88,9 @@ const char* HeltecTowerV2Board::getManufacturerName() const {
return "Heltec Tower V2";
}
void HeltecTowerV2Board::powerOff() {
void HeltecTowerV2Board::shutdownPeripherals() {
NRF52Board::shutdownPeripherals();
pinMode(PIN_GPS_EN, OUTPUT);
digitalWrite(PIN_GPS_EN, !PIN_GPS_EN_ACTIVE);
pinMode(PIN_GPS_STANDBY, OUTPUT);
@@ -99,5 +101,4 @@ void HeltecTowerV2Board::powerOff() {
pinMode(PIN_BAT_CTL, OUTPUT);
digitalWrite(PIN_BAT_CTL, LOW);
variant_shutdown();
sd_power_system_off();
}
}
@@ -20,5 +20,5 @@ public:
void onAfterTransmit() override;
uint16_t getBattMilliVolts() override;
const char* getManufacturerName() const override;
void powerOff() override;
void shutdownPeripherals() override;
};
@@ -35,12 +35,12 @@ void HeltecTrackerV2Board::begin() {
loRaFEMControl.setRxModeEnable();
}
void HeltecTrackerV2Board::powerOff() {
void HeltecTrackerV2Board::shutdownPeripherals() {
ESP32Board::shutdownPeripherals();
// Turn off PA
digitalWrite(P_LORA_PA_POWER, LOW);
rtc_gpio_hold_en((gpio_num_t)P_LORA_PA_POWER);
ESP32Board::powerOff();
}
uint16_t HeltecTrackerV2Board::getBattMilliVolts() {
@@ -23,7 +23,7 @@ public:
void onBeforeTransmit(void) override;
void onAfterTransmit(void) override;
void powerOff() override;
void shutdownPeripherals() override;
uint16_t getBattMilliVolts() override;
const char* getManufacturerName() const override ;
+23
View File
@@ -99,6 +99,29 @@ lib_deps =
${Heltec_tracker_v2.lib_deps}
${esp32_ota.lib_deps}
[env:heltec_tracker_v2_repeater_bridge_rs232]
extends = Heltec_tracker_v2
build_flags =
${Heltec_tracker_v2.build_flags}
-D ADVERT_NAME='"RS232 Bridge"'
-D ADVERT_LAT=0.0
-D ADVERT_LON=0.0
-D ADMIN_PASSWORD='"password"'
-D MAX_NEIGHBOURS=50
-D WITH_RS232_BRIDGE=Serial2
-D WITH_RS232_BRIDGE_RX=44
-D WITH_RS232_BRIDGE_TX=43
; -D MESH_PACKET_LOGGING=1
; -D MESH_DEBUG=1
build_src_filter = ${Heltec_tracker_v2.build_src_filter}
+<helpers/bridges/RS232Bridge.cpp>
+<helpers/ui/ST7735Display.cpp>
+<../examples/simple_repeater>
lib_deps =
${Heltec_tracker_v2.lib_deps}
${esp32_ota.lib_deps}
bakercp/CRC32 @ ^2.0.0
[env:heltec_tracker_v2_room_server]
extends = Heltec_tracker_v2
build_flags =
+3 -3
View File
@@ -32,12 +32,12 @@ void HeltecV4Board::begin() {
loRaFEMControl.setRxModeEnable();
}
void HeltecV4Board::powerOff() {
void HeltecV4Board::shutdownPeripherals() {
ESP32Board::shutdownPeripherals();
// Turn off PA
digitalWrite(P_LORA_PA_POWER, LOW);
rtc_gpio_hold_en((gpio_num_t)P_LORA_PA_POWER);
ESP32Board::powerOff();
}
uint16_t HeltecV4Board::getBattMilliVolts() {
+1 -1
View File
@@ -29,7 +29,7 @@ public:
void onBeforeTransmit(void) override;
void onAfterTransmit(void) override;
void powerOff() override;
void shutdownPeripherals() override;
uint16_t getBattMilliVolts() override;
bool setAdcMultiplier(float multiplier) override {
if (multiplier == 0.0f) {
+8
View File
@@ -7,6 +7,7 @@ build_flags =
-I variants/heltec_v4
-D HELTEC_LORA_V4
-D USE_SX1262
-D ARDUINO_USB_MODE=1 ; ARDUINO_USB_MODE in heltec_v4.json has no effect
-D ESP32_CPU_FREQ=80
-D RADIO_CLASS=CustomSX1262
-D WRAPPER_CLASS=CustomSX1262Wrapper
@@ -392,6 +393,13 @@ lib_deps =
${heltec_v4_tft.lib_deps}
densaugeo/base64 @ ~1.4.0
[env:heltec_v4_expansionkit_tft_companion_radio_ble]
extends = env:heltec_v4_tft_companion_radio_ble
build_flags =
${env:heltec_v4_tft_companion_radio_ble.build_flags}
-D ENV_PIN_SDA=4
-D ENV_PIN_SCL=3
[env:heltec_v4_tft_companion_radio_wifi]
extends = heltec_v4_tft
build_flags =
+3 -23
View File
@@ -39,30 +39,10 @@ void HeltecV4R8Board::onAfterTransmit(void) {
loRaFEMControl.setRxModeEnable();
}
void HeltecV4R8Board::enterDeepSleep(uint32_t secs, int pin_wake_btn) {
esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_PERIPH, ESP_PD_OPTION_ON);
rtc_gpio_set_direction((gpio_num_t)P_LORA_DIO_1, RTC_GPIO_MODE_INPUT_ONLY);
rtc_gpio_pulldown_en((gpio_num_t)P_LORA_DIO_1);
rtc_gpio_hold_en((gpio_num_t)P_LORA_NSS);
void HeltecV4R8Board::shutdownPeripherals() {
ESP32Board::shutdownPeripherals();
loRaFEMControl.setRxModeEnableWhenMCUSleep();
if (pin_wake_btn < 0) {
esp_sleep_enable_ext1_wakeup((1L << P_LORA_DIO_1), ESP_EXT1_WAKEUP_ANY_HIGH);
} else {
esp_sleep_enable_ext1_wakeup((1L << P_LORA_DIO_1) | (1L << pin_wake_btn), ESP_EXT1_WAKEUP_ANY_HIGH);
}
if (secs > 0) {
esp_sleep_enable_timer_wakeup(secs * 1000000);
}
esp_deep_sleep_start();
}
void HeltecV4R8Board::powerOff() {
enterDeepSleep(0);
}
uint16_t HeltecV4R8Board::getBattMilliVolts() {
+1 -2
View File
@@ -30,8 +30,7 @@ public:
void onBeforeTransmit(void) override;
void onAfterTransmit(void) override;
void enterDeepSleep(uint32_t secs, int pin_wake_btn = -1);
void powerOff() override;
void shutdownPeripherals() override;
uint16_t getBattMilliVolts() override;
bool setAdcMultiplier(float multiplier) override {
if (multiplier == 0.0f) {
+2 -2
View File
@@ -22,8 +22,8 @@ void initVariant() {
pinMode(LED_RED, OUTPUT);
pinMode(LED_GREEN, OUTPUT);
pinMode(LED_BLUE, OUTPUT);
digitalWrite(LED_BLUE, HIGH);
// pinMode(LED_BLUE, OUTPUT);
// digitalWrite(LED_BLUE, HIGH);
digitalWrite(LED_GREEN, HIGH);
digitalWrite(LED_RED, HIGH);
@@ -52,6 +52,7 @@ build_flags =
; -D MESH_PACKET_LOGGING=1
; -D MESH_DEBUG=1
; -D CORE_DEBUG_LEVEL=3
-D PIN_USER_BTN=-1 ; Disabled button press which prevents repeater to boot
lib_deps =
${LilyGo_TLora_V2_1_1_6.lib_deps}
${esp32_ota.lib_deps}
+3 -5
View File
@@ -9,7 +9,7 @@ protected:
uint8_t btn_prev_state;
public:
MeshtinyBoard() : NRF52Board("Meshtiny_OTA") {}
MeshtinyBoard() : NRF52Board("Meshtiny OTA") {}
void begin();
#if defined(P_LORA_TX_LED)
@@ -34,7 +34,8 @@ public:
void reboot() override { NVIC_SystemReset(); }
void powerOff() override {
void shutdownPeripherals() override {
NRF52Board::shutdownPeripherals();
#ifdef PIN_USER_BTN
while (digitalRead(PIN_USER_BTN) == LOW) {
@@ -59,8 +60,5 @@ public:
#ifdef PIN_USER_BTN
nrf_gpio_cfg_sense_input(g_ADigitalPinMap[PIN_USER_BTN], NRF_GPIO_PIN_PULLUP, NRF_GPIO_PIN_SENSE_LOW);
#endif
NRF52Board::powerOff();
}
};
@@ -45,7 +45,9 @@ public:
return "Minewsemi";
}
void powerOff() override {
void shutdownPeripherals() override {
NRF52Board::shutdownPeripherals();
#ifdef HAS_GPS
digitalWrite(GPS_VRTC_EN, LOW);
digitalWrite(GPS_RESET, LOW);
@@ -65,7 +67,6 @@ public:
#ifdef BUTTON_PIN
nrf_gpio_cfg_sense_input(digitalPinToInterrupt(BUTTON_PIN), NRF_GPIO_PIN_PULLUP, NRF_GPIO_PIN_SENSE_LOW);
#endif
NRF52Board::powerOff();
}
#if defined(P_LORA_TX_LED)
+2
View File
@@ -20,6 +20,8 @@ public:
#ifdef NRF52_POWER_MANAGEMENT
void powerOff() override {
shutdownPeripherals();
initiateShutdown(SHUTDOWN_REASON_USER);
}
#endif
+3 -3
View File
@@ -43,7 +43,9 @@ public:
const char *getManufacturerName() const override { return "Nano G2 Ultra"; }
void powerOff() override {
void shutdownPeripherals() override {
NRF52Board::shutdownPeripherals();
// put GPS chip to sleep
digitalWrite(PIN_GPS_STANDBY, LOW);
// TODO: unset buzzer to prevent notification circuit activating on hibernate
@@ -51,7 +53,5 @@ public:
nrf_gpio_cfg_sense_input(digitalPinToInterrupt(PIN_USER_BTN), NRF_GPIO_PIN_NOPULL,
NRF_GPIO_PIN_SENSE_LOW);
NRF52Board::powerOff();
}
};
+1
View File
@@ -1,6 +1,7 @@
[Promicro]
extends = nrf52_base
board = promicro_nrf52840
board_build.ldscript = boards/nrf52840_s140_v6.ld
build_flags = ${nrf52_base.build_flags}
-I variants/promicro
-D PROMICRO
+4 -1
View File
@@ -2,6 +2,7 @@
extends = nrf52_base
board = rak4631
board_check = true
board_build.ldscript = boards/nrf52840_s140_v6.ld
extra_scripts = ${nrf52_base.extra_scripts}
post:variants/rak4631/fix_bsec_lib.py
build_flags = ${nrf52_base.build_flags}
@@ -48,6 +49,7 @@ build_flags =
-D MAX_NEIGHBOURS=50
; -D MESH_PACKET_LOGGING=1
; -D MESH_DEBUG=1
; -D POWERSAVING_DEBUG=1
build_src_filter = ${rak4631.build_src_filter}
+<helpers/ui/SSD1306Display.cpp>
+<../examples/simple_repeater>
@@ -219,10 +221,11 @@ build_flags =
-D MAX_CONTACTS=350
-D MAX_GROUP_CHANNELS=40
-D BLE_PIN_CODE=123456
-D BLE_DEBUG_LOGGING=1
; -D BLE_DEBUG_LOGGING=1
-D OFFLINE_QUEUE_SIZE=256
; -D MESH_PACKET_LOGGING=1
; -D MESH_DEBUG=1
; -D POWERSAVING_DEBUG=1
build_src_filter = ${rak4631.build_src_filter}
+<helpers/nrf52/SerialBLEInterface.cpp>
+<../examples/companion_radio/*.cpp>
@@ -40,7 +40,9 @@ public:
return "RAK WisMesh Tag";
}
void powerOff() override {
void shutdownPeripherals() override {
NRF52Board::shutdownPeripherals();
#ifdef BUZZER_EN
digitalWrite(BUZZER_EN, LOW);
#endif
@@ -68,7 +70,5 @@ public:
// configure button press to wake up when in powered off state
nrf_gpio_cfg_sense_input(digitalPinToInterrupt(BUTTON_PIN), NRF_GPIO_PIN_PULLUP, NRF_GPIO_PIN_SENSE_LOW);
#endif
NRF52Board::powerOff();
}
};
+1
View File
@@ -2,6 +2,7 @@
extends = nrf52_base
board = rak4631
board_check = true
board_build.ldscript = boards/nrf52840_s140_v6.ld
build_flags = ${nrf52_base.build_flags}
${sensor_base.build_flags}
-I variants/rak_wismesh_tag
+7 -1
View File
@@ -37,7 +37,9 @@ public:
return "Seeed SenseCap Solar";
}
void powerOff() override {
void shutdownPeripherals() override {
NRF52Board::shutdownPeripherals();
digitalWrite(LED_WHITE, LOW);
digitalWrite(LED_BLUE, LOW);
@@ -50,6 +52,10 @@ public:
// Keep pull-up enabled in system-off so the wake line doesn't float low.
nrf_gpio_cfg_sense_input(digitalPinToInterrupt(g_ADigitalPinMap[PIN_BUTTON1]), NRF_GPIO_PIN_PULLUP, NRF_GPIO_PIN_SENSE_LOW);
#endif
}
void powerOff() override {
shutdownPeripherals();
#ifdef NRF52_POWER_MANAGEMENT
initiateShutdown(SHUTDOWN_REASON_USER);
+3 -3
View File
@@ -1,6 +1,8 @@
#include "StationG3Board.h"
void StationG3Board::powerOff() {
void StationG3Board::shutdownPeripherals() {
ESP32Board::shutdownPeripherals();
loRaFEMControl.setSleepModeEnable();
#ifdef P_PA1_EN
rtc_gpio_hold_en((gpio_num_t)P_PA1_EN);
@@ -9,8 +11,6 @@ void StationG3Board::powerOff() {
#ifdef P_PRIMARY_LNA_EN
rtc_gpio_hold_en((gpio_num_t)P_PRIMARY_LNA_EN);
#endif
ESP32Board::powerOff();
}
bool StationG3Board::setLoRaFemLnaEnabled(bool enable) {
+1 -1
View File
@@ -53,7 +53,7 @@ public:
loRaFEMControl.setRxModeEnable();
}
void powerOff() override;
void shutdownPeripherals() override;
uint16_t getBattMilliVolts() override {
return 0;
+3 -3
View File
@@ -49,7 +49,9 @@ public:
return 0;
}
void powerOff() override {
void shutdownPeripherals() override {
NRF52Board::shutdownPeripherals();
#ifdef HAS_GPS
digitalWrite(GPS_VRTC_EN, LOW);
digitalWrite(GPS_RESET, LOW);
@@ -83,7 +85,5 @@ public:
#ifdef BUTTON_PIN
nrf_gpio_cfg_sense_input(BUTTON_PIN, NRF_GPIO_PIN_NOPULL, NRF_GPIO_PIN_SENSE_HIGH);
#endif
NRF52Board::powerOff();
}
};
+17
View File
@@ -128,3 +128,20 @@ build_src_filter = ${t1000-e.build_src_filter}
+<../examples/kiss_modem/>
lib_deps = ${t1000-e.lib_deps}
stevemarple/MicroNMEA @ ^2.0.6
[env:t1000e_sensor]
extends = t1000-e
build_flags = ${t1000-e.build_flags}
-I examples/companion_radio/ui-orig
-D ADVERT_NAME='"t1000-e Sensor"'
-D ADVERT_LAT=0.0
-D ADVERT_LON=0.0
-D ADMIN_PASSWORD='"password"'
-D MAX_NEIGHBOURS=50
; -D MESH_PACKET_LOGGING=1
; -D MESH_DEBUG=1
; -D POWERSAVING_DEBUG=1
build_src_filter = ${t1000-e.build_src_filter}
+<../examples/simple_sensor>
lib_deps = ${t1000-e.lib_deps}
stevemarple/MicroNMEA @ ^2.0.6
+2 -4
View File
@@ -32,14 +32,12 @@ public:
return "Elecrow ThinkNode-M1";
}
void powerOff() override {
void shutdownPeripherals() override {
NRF52Board::shutdownPeripherals();
// turn off all leds, sd_power_system_off will not do this for us
#ifdef P_LORA_TX_LED
digitalWrite(P_LORA_TX_LED, LOW);
#endif
// power off board
NRF52Board::powerOff();
}
};
+3 -4
View File
@@ -42,13 +42,12 @@ public:
return 0;
}
void powerOff() override {
void shutdownPeripherals() override {
NRF52Board::shutdownPeripherals();
// turn off all leds, sd_power_system_off will not do this for us
digitalWrite(PIN_LED_BLUE, !LED_STATE_ON);
digitalWrite(PIN_LED_GREEN, !LED_STATE_ON);
digitalWrite(PIN_LED_RED, !LED_STATE_ON);
// power off board
NRF52Board::powerOff();
}
};
+2 -4
View File
@@ -65,14 +65,12 @@ public:
return isSolarChargerActive() || isUsbPowered();
}
void powerOff() override {
void shutdownPeripherals() override {
NRF52Board::shutdownPeripherals();
// turn off all leds, sd_power_system_off will not do this for us
#ifdef P_LORA_TX_LED
digitalWrite(P_LORA_TX_LED, LOW);
#endif
// power off board
NRF52Board::powerOff();
}
};
+1 -1
View File
@@ -82,7 +82,7 @@ build_flags =
-D MAX_CONTACTS=350
-D MAX_GROUP_CHANNELS=40
-D BLE_PIN_CODE=123456
-D BLE_DEBUG_LOGGING=1
; -D BLE_DEBUG_LOGGING=1
-D OFFLINE_QUEUE_SIZE=256
-D AUTO_SHUTDOWN_MILLIVOLTS=3300
; -D MESH_PACKET_LOGGING=1
@@ -33,8 +33,4 @@ public:
const char* getManufacturerName() const override {
return "Seeed Wio Tracker L1";
}
void powerOff() override {
NRF52Board::powerOff();
}
};
+4
View File
@@ -36,6 +36,8 @@ build_flags =
-D ADMIN_PASSWORD='"password"'
-D MAX_NEIGHBOURS=50
-D DISPLAY_CLASS=SH1106Display
-D ENV_PIN_SDA=PIN_WIRE1_SDA
-D ENV_PIN_SCL=PIN_WIRE1_SCL
; -D MESH_PACKET_LOGGING=1
; -D MESH_DEBUG=1
lib_deps = ${WioTrackerL1.lib_deps}
@@ -50,6 +52,8 @@ build_flags = ${WioTrackerL1.build_flags}
-D ADMIN_PASSWORD='"password"'
-D ROOM_PASSWORD='"hello"'
-D DISPLAY_CLASS=SH1106Display
-D ENV_PIN_SDA=PIN_WIRE1_SDA
-D ENV_PIN_SCL=PIN_WIRE1_SCL
; -D MESH_PACKET_LOGGING=1
; -D MESH_DEBUG=1
lib_deps = ${WioTrackerL1.lib_deps}
+6 -6
View File
@@ -30,7 +30,7 @@ build_src_filter = ${nrf52_base.build_src_filter}
+<helpers/sensors>
+<../variants/wio_wm1110>
debug_tool = jlink
upload_protocol = jlink
upload_protocol = nrfutil
lib_deps = ${nrf52_base.lib_deps}
${sensor_base.lib_deps}
adafruit/Adafruit LIS3DH @ ^1.2.4
@@ -84,8 +84,8 @@ build_src_filter = ${wio_wm1110.build_src_filter}
lib_deps =
${wio_wm1110.lib_deps}
densaugeo/base64 @ ~1.4.0
[env:wio_wm1110_kiss_modem]
extends = wio_wm1110
build_src_filter = ${wio_wm1110.build_src_filter}
+<../examples/kiss_modem/>
[env:wio_wm1110_kiss_modem]
extends = wio_wm1110
build_src_filter = ${wio_wm1110.build_src_filter}
+<../examples/kiss_modem/>
+3 -3
View File
@@ -35,7 +35,9 @@ public:
return "Seeed Xiao-nrf52";
}
void powerOff() override {
void shutdownPeripherals() override {
NRF52Board::shutdownPeripherals();
// set led on and wait for button release before poweroff
digitalWrite(PIN_LED, LOW);
#ifdef PIN_USER_BTN
@@ -49,8 +51,6 @@ public:
// configure button press to wake up when in powered off state
nrf_gpio_cfg_sense_input(digitalPinToInterrupt(g_ADigitalPinMap[PIN_USER_BTN]), NRF_GPIO_PIN_PULLUP, NRF_GPIO_PIN_SENSE_LOW);
#endif
NRF52Board::powerOff();
}
};
+19
View File
@@ -9,6 +9,7 @@ build_flags = ${nrf52_base.build_flags}
-I variants/xiao_nrf52
-UENV_INCLUDE_GPS
-D NRF52_PLATFORM
; -D NRF52_POWER_MANAGEMENT
-D XIAO_NRF52
-D USE_SX1262
-D RADIO_CLASS=CustomSX1262
@@ -110,6 +111,24 @@ build_flags =
build_src_filter = ${Xiao_nrf52.build_src_filter}
+<../examples/simple_room_server/*.cpp>
[env:Xiao_nrf52_repeater_bridge_rs232]
extends = Xiao_nrf52
build_flags =
${Xiao_nrf52.build_flags}
-D ADVERT_NAME='"RS232 Bridge"'
-D ADVERT_LAT=0.0
-D ADVERT_LON=0.0
-D ADMIN_PASSWORD='"password"'
-D MAX_NEIGHBOURS=50
-D WITH_RS232_BRIDGE=Serial1
-D WITH_RS232_BRIDGE_RX=PIN_SERIAL1_RX
-D WITH_RS232_BRIDGE_TX=PIN_SERIAL1_TX
; -D MESH_PACKET_LOGGING=1
; -D MESH_DEBUG=1
build_src_filter = ${Xiao_nrf52.build_src_filter}
+<helpers/bridges/RS232Bridge.cpp>
+<../examples/simple_repeater>
[env:Xiao_nrf52_kiss_modem]
extends = Xiao_nrf52
build_flags =
+5 -1
View File
@@ -6,8 +6,8 @@ board_build.mcu = esp32s3
build_flags = ${esp32_base.build_flags}
${sensor_base.build_flags}
-I variants/xiao_s3_wio
-UENV_INCLUDE_GPS
-D SEEED_XIAO_S3
-D PIN_VBAT_READ=D1
-D P_LORA_DIO_1=39
-D P_LORA_NSS=41
-D P_LORA_RESET=42 ; RADIOLIB_NC
@@ -29,6 +29,10 @@ build_flags = ${esp32_base.build_flags}
-D WRAPPER_CLASS=CustomSX1262Wrapper
-D LORA_TX_POWER=22
-D SX126X_RX_BOOSTED_GAIN=1
-D PIN_GPS_RX=D6
-D PIN_GPS_TX=D7
-D PIN_GPS_EN=D0
-D PIN_GPS_RESET=D2
build_src_filter = ${esp32_base.build_src_filter}
+<../variants/xiao_s3_wio>
+<helpers/sensors>
+8 -1
View File
@@ -14,7 +14,14 @@ WRAPPER_CLASS radio_driver(radio, board);
ESP32RTCClock fallback_clock;
AutoDiscoverRTCClock rtc_clock(fallback_clock);
EnvironmentSensorManager sensors;
#if ENV_INCLUDE_GPS
#include <helpers/sensors/MicroNMEALocationProvider.h>
MicroNMEALocationProvider nmea = MicroNMEALocationProvider(Serial1, &rtc_clock, GPS_RESET, GPS_EN);
EnvironmentSensorManager sensors = EnvironmentSensorManager(nmea);
#else
EnvironmentSensorManager sensors;
#endif
#ifdef DISPLAY_CLASS
DISPLAY_CLASS display;