Added sleep and wake support on T114

master
Mark Qvist 1 month ago
parent 2119d381b3
commit 3073677b82
  1. 20
      RNode_Firmware.ino

@ -105,7 +105,7 @@ void setup() {
led_init(); led_init();
#endif #endif
#if BOARD_MODEL != BOARD_RAK4631 && BOARD_MODEL != BOARD_HELTEC_T114 && BOARD_MODEL != BOARD_RNODE_NG_22 && BOARD_MODEL != BOARD_TBEAM_S_V1 #if BOARD_MODEL != BOARD_RAK4631 && BOARD_MODEL != BOARD_HELTEC_T114 && BOARD_MODEL != BOARD_T3S3 && BOARD_MODEL != BOARD_TBEAM_S_V1
// Some boards need to wait until the hardware UART is set up before booting // Some boards need to wait until the hardware UART is set up before booting
// the full firmware. In the case of the RAK4631 and Heltec T114, the line below will wait // the full firmware. In the case of the RAK4631 and Heltec T114, the line below will wait
// until a serial connection is actually established with a master. Thus, it // until a serial connection is actually established with a master. Thus, it
@ -161,7 +161,7 @@ void setup() {
#if MCU_VARIANT == MCU_ESP32 || MCU_VARIANT == MCU_NRF52 #if MCU_VARIANT == MCU_ESP32 || MCU_VARIANT == MCU_NRF52
init_channel_stats(); init_channel_stats();
#if BOARD_MODEL == BOARD_RNODE_NG_22 #if BOARD_MODEL == BOARD_T3S3
#if MODEM == SX1280 #if MODEM == SX1280
delay(300); delay(300);
LoRa->reset(); LoRa->reset();
@ -246,7 +246,7 @@ void setup() {
if (ia_conf == 0x00) { avoid_interference = true; } if (ia_conf == 0x00) { avoid_interference = true; }
else { avoid_interference = false; } else { avoid_interference = false; }
#elif MCU_VARIANT == MCU_NRF52 #elif MCU_VARIANT == MCU_NRF52
uint8_t ia_conf == eeprom_read(eeprom_addr(ADDR_CONF_DIA)); uint8_t ia_conf = eeprom_read(eeprom_addr(ADDR_CONF_DIA));
if (ia_conf == 0x00) { avoid_interference = true; } if (ia_conf == 0x00) { avoid_interference = true; }
else { avoid_interference = false; } else { avoid_interference = false; }
#endif #endif
@ -1592,7 +1592,8 @@ void loop() {
void sleep_now() { void sleep_now() {
#if HAS_SLEEP == true #if HAS_SLEEP == true
#if BOARD_MODEL == BOARD_RNODE_NG_22 #if PLATFORM == PLATFORM_ESP32
#if BOARD_MODEL == BOARD_T3S3
display_intensity = 0; display_intensity = 0;
update_display(true); update_display(true);
#endif #endif
@ -1608,6 +1609,17 @@ void sleep_now() {
#endif #endif
esp_sleep_enable_ext0_wakeup(PIN_WAKEUP, WAKEUP_LEVEL); esp_sleep_enable_ext0_wakeup(PIN_WAKEUP, WAKEUP_LEVEL);
esp_deep_sleep_start(); esp_deep_sleep_start();
#elif PLATFORM == PLATFORM_NRF52
#if BOARD_MODEL == BOARD_HELTEC_T114
npset(0,0,0);
digitalWrite(PIN_T114_VEXT_EN, LOW);
digitalWrite(PIN_T114_TFT_BLGT, HIGH);
digitalWrite(PIN_T114_TFT_EN, HIGH);
#endif
sd_power_gpregret_set(0, 0x6d);
nrf_gpio_cfg_sense_input(pin_btn_usr1, NRF_GPIO_PIN_PULLUP, NRF_GPIO_PIN_SENSE_LOW);
NRF_POWER->SYSTEMOFF = 1;
#endif
#endif #endif
} }

Loading…
Cancel
Save