mirror of
https://github.com/markqvist/RNode_Firmware.git
synced 2025-06-04 13:08:52 -04:00
Added sleep and wake support on T114
This commit is contained in:
parent
2119d381b3
commit
3073677b82
1 changed files with 30 additions and 18 deletions
|
@ -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,22 +1592,34 @@ 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
|
||||||
display_intensity = 0;
|
#if BOARD_MODEL == BOARD_T3S3
|
||||||
update_display(true);
|
display_intensity = 0;
|
||||||
|
update_display(true);
|
||||||
|
#endif
|
||||||
|
#if PIN_DISP_SLEEP >= 0
|
||||||
|
pinMode(PIN_DISP_SLEEP, OUTPUT);
|
||||||
|
digitalWrite(PIN_DISP_SLEEP, DISP_SLEEP_LEVEL);
|
||||||
|
#endif
|
||||||
|
#if HAS_BLUETOOTH
|
||||||
|
if (bt_state == BT_STATE_CONNECTED) {
|
||||||
|
bt_stop();
|
||||||
|
delay(100);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
esp_sleep_enable_ext0_wakeup(PIN_WAKEUP, WAKEUP_LEVEL);
|
||||||
|
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
|
||||||
#if PIN_DISP_SLEEP >= 0
|
|
||||||
pinMode(PIN_DISP_SLEEP, OUTPUT);
|
|
||||||
digitalWrite(PIN_DISP_SLEEP, DISP_SLEEP_LEVEL);
|
|
||||||
#endif
|
|
||||||
#if HAS_BLUETOOTH
|
|
||||||
if (bt_state == BT_STATE_CONNECTED) {
|
|
||||||
bt_stop();
|
|
||||||
delay(100);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
esp_sleep_enable_ext0_wakeup(PIN_WAKEUP, WAKEUP_LEVEL);
|
|
||||||
esp_deep_sleep_start();
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue