kopia lustrzana https://github.com/meshtastic/firmware
fix/enhancement: TFT device powersave (part 3) (#3600)
* fix: device TFT powersave (part 3) * trunk fmt * trunk fmt * undo bluetooth deinit from #3596 * revert code for heltec tracker --------- Co-authored-by: Ben Meadors <benmmeadors@gmail.com>pull/3621/head
rodzic
ec3971bce5
commit
5047468d9f
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue