Fixing a number of T-Beam poweroff display issues (#1876)

This commit is contained in:
Ben Meadors 2022-10-30 20:40:30 -05:00 committed by GitHub
parent 311835a231
commit afafb3ba32
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 10 deletions

View File

@ -233,14 +233,14 @@ bool Power::setup()
void Power::shutdown()
{
screen->setOn(false);
#if defined(USE_EINK) && defined(PIN_EINK_EN)
digitalWrite(PIN_EINK_EN, LOW); //power off backlight first
#endif
#ifdef HAS_PMU
DEBUG_MSG("Shutting down\n");
if(PMU){
if(PMU) {
PMU->setChargingLedMode(XPOWERS_CHG_LED_OFF);
PMU->shutdown();
}
@ -315,7 +315,7 @@ int32_t Power::runOnce()
#ifdef HAS_PMU
// WE no longer use the IRQ line to wake the CPU (due to false wakes from sleep), but we do poll
// the IRQ status by reading the registers over I2C
if(PMU){
if(PMU) {
PMU->getIrqStatus();
@ -344,10 +344,11 @@ int32_t Power::runOnce()
if (PMU->isBatRemoveIrq()) {
DEBUG_MSG("Battery removed\n");
}
if (PMU->isPekeyShortPressIrq()) {
DEBUG_MSG("PEK short button press\n");
}
*/
if (PMU->isPekeyLongPressIrq()) {
DEBUG_MSG("PEK long button press\n");
screen->setOn(false);
}
PMU->clearIrqStatus();
}
@ -454,7 +455,6 @@ bool Power::axpChipInit()
// Set constant current charging current
PMU->setChargerConstantCurr(XPOWERS_AXP192_CHG_CUR_450MA);
} else if (PMU->getChipModel() == XPOWERS_AXP2101) {
// t-beam s3 core

View File

@ -131,8 +131,7 @@ class Screen : public concurrency::OSThread
void setOn(bool on)
{
if (!on)
handleSetOn(
false); // We handle off commands immediately, because they might be called because the CPU is shutting down
handleSetOn(false); // We handle off commands immediately, because they might be called because the CPU is shutting down
else
enqueueCmd(ScreenCmd{.cmd = on ? Cmd::SET_ON : Cmd::SET_OFF});
}

View File

@ -17,7 +17,7 @@ void powerCommandsCheck()
#endif
}
#if defined(ARCH_NRF52)
#if defined(ARCH_NRF52) || defined(HAS_PMU)
if (shutdownAtMsec) {
screen->startShutdownScreen();
playBeep();