mirror of
https://github.com/meshtastic/firmware.git
synced 2025-08-25 06:20:23 +00:00
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>
This commit is contained in:
parent
ec3971bce5
commit
5047468d9f
@ -17,6 +17,10 @@
|
|||||||
#include "sleep.h"
|
#include "sleep.h"
|
||||||
#include "target_specific.h"
|
#include "target_specific.h"
|
||||||
|
|
||||||
|
#ifndef SLEEP_TIME
|
||||||
|
#define SLEEP_TIME 30
|
||||||
|
#endif
|
||||||
|
|
||||||
/// Should we behave as if we have AC power now?
|
/// Should we behave as if we have AC power now?
|
||||||
static bool isPowered()
|
static bool isPowered()
|
||||||
{
|
{
|
||||||
@ -81,7 +85,7 @@ static void lsIdle()
|
|||||||
// If some other service would stall sleep, don't let sleep happen yet
|
// If some other service would stall sleep, don't let sleep happen yet
|
||||||
if (doPreflightSleep()) {
|
if (doPreflightSleep()) {
|
||||||
// Briefly come out of sleep long enough to blink the led once every few seconds
|
// 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
|
setLed(false); // Never leave led on while in light sleep
|
||||||
esp_sleep_source_t wakeCause2 = doLightSleep(sleepTime * 1000LL);
|
esp_sleep_source_t wakeCause2 = doLightSleep(sleepTime * 1000LL);
|
||||||
|
@ -561,8 +561,10 @@ void TFTDisplay::sendCommand(uint8_t com)
|
|||||||
#elif defined(ST7735_BL_V05)
|
#elif defined(ST7735_BL_V05)
|
||||||
pinMode(ST7735_BL_V05, OUTPUT);
|
pinMode(ST7735_BL_V05, OUTPUT);
|
||||||
digitalWrite(ST7735_BL_V05, TFT_BACKLIGHT_ON);
|
digitalWrite(ST7735_BL_V05, TFT_BACKLIGHT_ON);
|
||||||
#endif
|
#elif !defined(RAK14014) && !defined(M5STACK) && !defined(UNPHONE)
|
||||||
#if defined(TFT_BL) && defined(TFT_BACKLIGHT_ON)
|
tft->wakeup();
|
||||||
|
tft->powerSaveOff();
|
||||||
|
#elif defined(TFT_BL) && defined(TFT_BACKLIGHT_ON)
|
||||||
digitalWrite(TFT_BL, TFT_BACKLIGHT_ON);
|
digitalWrite(TFT_BL, TFT_BACKLIGHT_ON);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -596,10 +598,13 @@ void TFTDisplay::sendCommand(uint8_t com)
|
|||||||
#elif defined(ST7735_BL_V05)
|
#elif defined(ST7735_BL_V05)
|
||||||
pinMode(ST7735_BL_V05, OUTPUT);
|
pinMode(ST7735_BL_V05, OUTPUT);
|
||||||
digitalWrite(ST7735_BL_V05, !TFT_BACKLIGHT_ON);
|
digitalWrite(ST7735_BL_V05, !TFT_BACKLIGHT_ON);
|
||||||
#endif
|
#elif !defined(RAK14014) && !defined(M5STACK) && !defined(UNPHONE)
|
||||||
#if defined(TFT_BL) && defined(TFT_BACKLIGHT_ON)
|
tft->sleep();
|
||||||
|
tft->powerSaveOn();
|
||||||
|
#elif defined(TFT_BL) && defined(TFT_BACKLIGHT_ON)
|
||||||
digitalWrite(TFT_BL, !TFT_BACKLIGHT_ON);
|
digitalWrite(TFT_BL, !TFT_BACKLIGHT_ON);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef VTFT_CTRL_V03
|
#ifdef VTFT_CTRL_V03
|
||||||
digitalWrite(VTFT_CTRL_V03, HIGH);
|
digitalWrite(VTFT_CTRL_V03, HIGH);
|
||||||
#endif
|
#endif
|
||||||
|
@ -311,6 +311,12 @@ void NodeDB::initConfigIntervals()
|
|||||||
config.power.wait_bluetooth_secs = default_wait_bluetooth_secs;
|
config.power.wait_bluetooth_secs = default_wait_bluetooth_secs;
|
||||||
|
|
||||||
config.display.screen_on_secs = default_screen_on_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()
|
void NodeDB::installDefaultModuleConfig()
|
||||||
|
@ -113,8 +113,8 @@ void NimbleBluetooth::shutdown()
|
|||||||
pAdvertising->reset();
|
pAdvertising->reset();
|
||||||
pAdvertising->stop();
|
pAdvertising->stop();
|
||||||
|
|
||||||
#if defined(ARCH_ESP32)
|
#if defined(HELTEC_WIRELESS_PAPER) || defined(HELTEC_WIRELESS_PAPER_V1_0)
|
||||||
// Saving of ~1mA for esp32-s3 and 0.1mA for esp32
|
// Saving of ~1mA
|
||||||
// Probably applicable to other ESP32 boards - unverified
|
// Probably applicable to other ESP32 boards - unverified
|
||||||
NimBLEDevice::deinit();
|
NimBLEDevice::deinit();
|
||||||
#endif
|
#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);
|
gpio_wakeup_enable(pin, GPIO_INTR_LOW_LEVEL);
|
||||||
esp_sleep_enable_gpio_wakeup();
|
esp_sleep_enable_gpio_wakeup();
|
||||||
|
#endif
|
||||||
|
#ifdef T_WATCH_S3
|
||||||
|
gpio_wakeup_enable((gpio_num_t)SCREEN_TOUCH_INT, GPIO_INTR_LOW_LEVEL);
|
||||||
#endif
|
#endif
|
||||||
enableLoraInterrupt();
|
enableLoraInterrupt();
|
||||||
#ifdef PMU_IRQ
|
#ifdef PMU_IRQ
|
||||||
@ -385,6 +388,10 @@ esp_sleep_wakeup_cause_t doLightSleep(uint64_t sleepMsec) // FIXME, use a more r
|
|||||||
buttonThread->attachButtonInterrupts();
|
buttonThread->attachButtonInterrupts();
|
||||||
#endif
|
#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 !defined(SOC_PM_SUPPORT_EXT_WAKEUP) && defined(LORA_DIO1) && (LORA_DIO1 != RADIOLIB_NC)
|
||||||
if (radioType != RF95_RADIO) {
|
if (radioType != RF95_RADIO) {
|
||||||
gpio_wakeup_disable((gpio_num_t)LORA_DIO1);
|
gpio_wakeup_disable((gpio_num_t)LORA_DIO1);
|
||||||
|
@ -24,6 +24,8 @@
|
|||||||
#define TOUCH_I2C_PORT 0
|
#define TOUCH_I2C_PORT 0
|
||||||
#define TOUCH_SLAVE_ADDRESS 0x5D // GT911
|
#define TOUCH_SLAVE_ADDRESS 0x5D // GT911
|
||||||
|
|
||||||
|
#define SLEEP_TIME 120
|
||||||
|
|
||||||
#define BUTTON_PIN 0
|
#define BUTTON_PIN 0
|
||||||
// #define BUTTON_NEED_PULLUP
|
// #define BUTTON_NEED_PULLUP
|
||||||
|
|
||||||
|
@ -3,8 +3,6 @@
|
|||||||
extends = esp32s3_base
|
extends = esp32s3_base
|
||||||
board = t-watch-s3
|
board = t-watch-s3
|
||||||
upload_protocol = esptool
|
upload_protocol = esptool
|
||||||
upload_speed = 115200
|
|
||||||
upload_port = /dev/tty.usbmodem3485188D636C1
|
|
||||||
|
|
||||||
build_flags = ${esp32_base.build_flags}
|
build_flags = ${esp32_base.build_flags}
|
||||||
-DT_WATCH_S3
|
-DT_WATCH_S3
|
||||||
|
@ -25,6 +25,8 @@
|
|||||||
#define TOUCH_I2C_PORT 1
|
#define TOUCH_I2C_PORT 1
|
||||||
#define TOUCH_SLAVE_ADDRESS 0x38
|
#define TOUCH_SLAVE_ADDRESS 0x38
|
||||||
|
|
||||||
|
#define SLEEP_TIME 180
|
||||||
|
|
||||||
#define I2C_SDA1 39 // Used for capacitive touch
|
#define I2C_SDA1 39 // Used for capacitive touch
|
||||||
#define I2C_SCL1 40 // Used for capacitive touch
|
#define I2C_SCL1 40 // Used for capacitive touch
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user