- fix wrong debug print
- change shutdown logic for t-beam if PMU is detected
- wait for 10 seconds instead of 5 for shutdown and resurrect screen brightness adjust for @karamo
This commit is contained in:
Thomas Göttgens 2023-04-11 12:36:44 +02:00
parent f0c4c18a79
commit 29c13b5c30
3 changed files with 14 additions and 13 deletions

View File

@ -123,14 +123,12 @@ class ButtonThread : public concurrency::OSThread
static void userButtonPressedLong() static void userButtonPressedLong()
{ {
// LOG_DEBUG("Long press!\n"); // LOG_DEBUG("Long press!\n");
// If user button is held down for 5 seconds, shutdown the device. if (screen_found == true) {
if ((millis() - longPressTime > 5 * 1000) && (longPressTime > 0)) { screen->adjustBrightness();
#ifdef HAS_PMU }
if (pmu_found == true) { // If user button is held down for 10 seconds, shutdown the device.
setLed(false); if ((millis() - longPressTime > 10000) && (longPressTime > 0)) {
power->shutdown(); #if defined(ARCH_NRF52) || defined(ARCH_ESP32)
}
#elif defined(ARCH_NRF52) || defined(ARCH_ESP32)
// Do actual shutdown when button released, otherwise the button release // Do actual shutdown when button released, otherwise the button release
// may wake the board immediatedly. // may wake the board immediatedly.
if ((!shutdown_on_long_stop) && (millis() > 30 * 1000)) { if ((!shutdown_on_long_stop) && (millis() > 30 * 1000)) {

View File

@ -277,12 +277,11 @@ void Power::shutdown()
LOG_INFO("Shutting down\n"); LOG_INFO("Shutting down\n");
#ifdef HAS_PMU #ifdef HAS_PMU
if (PMU) { if (pmu_found == true) {
PMU->setChargingLedMode(XPOWERS_CHG_LED_OFF); PMU->setChargingLedMode(XPOWERS_CHG_LED_OFF);
PMU->shutdown();
} }
#endif #elif defined(ARCH_NRF52) || defined(ARCH_ESP32)
#if defined(ARCH_NRF52) || defined(ARCH_ESP32)
#ifdef PIN_LED1 #ifdef PIN_LED1
ledOff(PIN_LED1); ledOff(PIN_LED1);
#endif #endif

View File

@ -203,7 +203,11 @@ void doGPSpowersave(bool on)
void doDeepSleep(uint64_t msecToWake) void doDeepSleep(uint64_t msecToWake)
{ {
LOG_INFO("Entering deep sleep for %lu seconds\n", msecToWake / 1000); if (INCLUDE_vTaskSuspend && (msecToWake == portMAX_DELAY)) {
LOG_INFO("Entering deep sleep forever\n");
} else {
LOG_INFO("Entering deep sleep for %u seconds\n", msecToWake / 1000);
}
// not using wifi yet, but once we are this is needed to shutoff the radio hw // not using wifi yet, but once we are this is needed to shutoff the radio hw
// esp_wifi_stop(); // esp_wifi_stop();