diff --git a/src/PowerFSM.cpp b/src/PowerFSM.cpp index a6b2aea270..ac48e664c6 100644 --- a/src/PowerFSM.cpp +++ b/src/PowerFSM.cpp @@ -17,6 +17,10 @@ #include "sleep.h" #include "target_specific.h" +#ifndef SLEEP_TIME +#define SLEEP_TIME 30 +#endif + /// Should we behave as if we have AC power now? static bool isPowered() { @@ -81,7 +85,7 @@ static void lsIdle() // If some other service would stall sleep, don't let sleep happen yet if (doPreflightSleep()) { // Briefly come out of sleep long enough to blink the led once every few seconds - uint32_t sleepTime = 30; + uint32_t sleepTime = SLEEP_TIME; setLed(false); // Never leave led on while in light sleep esp_sleep_source_t wakeCause2 = doLightSleep(sleepTime * 1000LL); diff --git a/src/graphics/TFTDisplay.cpp b/src/graphics/TFTDisplay.cpp index 8de415185a..fb64553efd 100644 --- a/src/graphics/TFTDisplay.cpp +++ b/src/graphics/TFTDisplay.cpp @@ -561,8 +561,10 @@ void TFTDisplay::sendCommand(uint8_t com) #elif defined(ST7735_BL_V05) pinMode(ST7735_BL_V05, OUTPUT); digitalWrite(ST7735_BL_V05, TFT_BACKLIGHT_ON); -#endif -#if defined(TFT_BL) && defined(TFT_BACKLIGHT_ON) +#elif !defined(RAK14014) && !defined(M5STACK) && !defined(UNPHONE) + tft->wakeup(); + tft->powerSaveOff(); +#elif defined(TFT_BL) && defined(TFT_BACKLIGHT_ON) digitalWrite(TFT_BL, TFT_BACKLIGHT_ON); #endif @@ -596,10 +598,13 @@ void TFTDisplay::sendCommand(uint8_t com) #elif defined(ST7735_BL_V05) pinMode(ST7735_BL_V05, OUTPUT); digitalWrite(ST7735_BL_V05, !TFT_BACKLIGHT_ON); -#endif -#if defined(TFT_BL) && defined(TFT_BACKLIGHT_ON) +#elif !defined(RAK14014) && !defined(M5STACK) && !defined(UNPHONE) + tft->sleep(); + tft->powerSaveOn(); +#elif defined(TFT_BL) && defined(TFT_BACKLIGHT_ON) digitalWrite(TFT_BL, !TFT_BACKLIGHT_ON); #endif + #ifdef VTFT_CTRL_V03 digitalWrite(VTFT_CTRL_V03, HIGH); #endif diff --git a/src/mesh/NodeDB.cpp b/src/mesh/NodeDB.cpp index ea0a279925..921935593f 100644 --- a/src/mesh/NodeDB.cpp +++ b/src/mesh/NodeDB.cpp @@ -311,6 +311,12 @@ void NodeDB::initConfigIntervals() config.power.wait_bluetooth_secs = default_wait_bluetooth_secs; config.display.screen_on_secs = default_screen_on_secs; + +#if defined(T_WATCH_S3) || defined(T_DECK) + config.power.is_power_saving = true; + config.display.screen_on_secs = 30; + config.power.wait_bluetooth_secs = 30; +#endif } void NodeDB::installDefaultModuleConfig() diff --git a/src/nimble/NimbleBluetooth.cpp b/src/nimble/NimbleBluetooth.cpp index 42b296e457..0b91bf44f4 100644 --- a/src/nimble/NimbleBluetooth.cpp +++ b/src/nimble/NimbleBluetooth.cpp @@ -113,8 +113,8 @@ void NimbleBluetooth::shutdown() pAdvertising->reset(); pAdvertising->stop(); -#if defined(ARCH_ESP32) - // Saving of ~1mA for esp32-s3 and 0.1mA for esp32 +#if defined(HELTEC_WIRELESS_PAPER) || defined(HELTEC_WIRELESS_PAPER_V1_0) + // Saving of ~1mA // Probably applicable to other ESP32 boards - unverified NimBLEDevice::deinit(); #endif diff --git a/src/sleep.cpp b/src/sleep.cpp index fdfaf5e351..6abe535d7b 100644 --- a/src/sleep.cpp +++ b/src/sleep.cpp @@ -352,6 +352,9 @@ esp_sleep_wakeup_cause_t doLightSleep(uint64_t sleepMsec) // FIXME, use a more r gpio_wakeup_enable(pin, GPIO_INTR_LOW_LEVEL); esp_sleep_enable_gpio_wakeup(); +#endif +#ifdef T_WATCH_S3 + gpio_wakeup_enable((gpio_num_t)SCREEN_TOUCH_INT, GPIO_INTR_LOW_LEVEL); #endif enableLoraInterrupt(); #ifdef PMU_IRQ @@ -385,6 +388,10 @@ esp_sleep_wakeup_cause_t doLightSleep(uint64_t sleepMsec) // FIXME, use a more r buttonThread->attachButtonInterrupts(); #endif +#ifdef T_WATCH_S3 + gpio_wakeup_disable((gpio_num_t)SCREEN_TOUCH_INT); +#endif + #if !defined(SOC_PM_SUPPORT_EXT_WAKEUP) && defined(LORA_DIO1) && (LORA_DIO1 != RADIOLIB_NC) if (radioType != RF95_RADIO) { gpio_wakeup_disable((gpio_num_t)LORA_DIO1); diff --git a/variants/t-deck/variant.h b/variants/t-deck/variant.h index 62ac0a373f..09db198ec1 100644 --- a/variants/t-deck/variant.h +++ b/variants/t-deck/variant.h @@ -24,6 +24,8 @@ #define TOUCH_I2C_PORT 0 #define TOUCH_SLAVE_ADDRESS 0x5D // GT911 +#define SLEEP_TIME 120 + #define BUTTON_PIN 0 // #define BUTTON_NEED_PULLUP diff --git a/variants/t-watch-s3/platformio.ini b/variants/t-watch-s3/platformio.ini index d03273ed44..5d5904b30c 100644 --- a/variants/t-watch-s3/platformio.ini +++ b/variants/t-watch-s3/platformio.ini @@ -3,8 +3,6 @@ extends = esp32s3_base board = t-watch-s3 upload_protocol = esptool -upload_speed = 115200 -upload_port = /dev/tty.usbmodem3485188D636C1 build_flags = ${esp32_base.build_flags} -DT_WATCH_S3 diff --git a/variants/t-watch-s3/variant.h b/variants/t-watch-s3/variant.h index c66fac5efa..ad7e6b56b5 100644 --- a/variants/t-watch-s3/variant.h +++ b/variants/t-watch-s3/variant.h @@ -25,6 +25,8 @@ #define TOUCH_I2C_PORT 1 #define TOUCH_SLAVE_ADDRESS 0x38 +#define SLEEP_TIME 180 + #define I2C_SDA1 39 // Used for capacitive touch #define I2C_SCL1 40 // Used for capacitive touch