From 9244d03cf90670cb92484bfbd847dc98aea2acda Mon Sep 17 00:00:00 2001 From: lewishe Date: Thu, 8 Sep 2022 10:32:12 +0800 Subject: [PATCH] Rename axp192_found to pmu_found to avoid confusion --- src/ButtonThread.h | 2 +- src/Power.cpp | 4 ++-- src/detect/i2cScan.h | 2 +- src/main.cpp | 4 ++-- src/main.h | 2 +- src/shutdown.h | 2 +- src/sleep.cpp | 8 ++++---- 7 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/ButtonThread.h b/src/ButtonThread.h index a8cc68655..e48487c76 100644 --- a/src/ButtonThread.h +++ b/src/ButtonThread.h @@ -129,7 +129,7 @@ class ButtonThread : public concurrency::OSThread // If user button is held down for 5 seconds, shutdown the device. if ((millis() - longPressTime > 5 * 1000) && (longPressTime > 0)) { #if defined(HAS_AXP192) || defined(HAS_AXP2101) - if (axp192_found == true) { + if (pmu_found == true) { setLed(false); power->shutdown(); } diff --git a/src/Power.cpp b/src/Power.cpp index e90950e45..53837128b 100644 --- a/src/Power.cpp +++ b/src/Power.cpp @@ -564,9 +564,9 @@ bool Power::axpChipInit() readPowerStatus(); - axp192_found = true; + pmu_found = true; - return axp192_found; + return pmu_found; #else return false; diff --git a/src/detect/i2cScan.h b/src/detect/i2cScan.h index 7bb67240f..4c1de7d7f 100644 --- a/src/detect/i2cScan.h +++ b/src/detect/i2cScan.h @@ -117,7 +117,7 @@ void scanI2Cdevice(void) } #if defined(HAS_AXP192) || defined(HAS_AXP2101) if (addr == XPOWERS_AXP192_AXP2101_ADDRESS) { - axp192_found = true; + pmu_found = true; DEBUG_MSG("axp192/axp2101 PMU found\n"); } #endif diff --git a/src/main.cpp b/src/main.cpp index 794211f0a..4b86bb5f7 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -84,7 +84,7 @@ bool eink_found = true; uint32_t serialSinceMsec; -bool axp192_found; +bool pmu_found; // Array map of sensor types (as array index) and i2c address as value we'll find in the i2c scan uint8_t nodeTelemetrySensorsMap[7] = { 0, 0, 0, 0, 0, 0, 0 }; @@ -302,7 +302,7 @@ void setup() // Do this after service.init (because that clears error_code) #if defined(HAS_AXP192) || defined(HAS_AXP2101) - if (!axp192_found) + if (!pmu_found) RECORD_CRITICALERROR(CriticalErrorCode_NoAXP192); // Record a hardware fault for missing hardware #endif diff --git a/src/main.h b/src/main.h index 02dce04b3..3f4bea7e2 100644 --- a/src/main.h +++ b/src/main.h @@ -15,7 +15,7 @@ extern uint8_t faceskb_found; extern uint8_t rtc_found; extern bool eink_found; -extern bool axp192_found; +extern bool pmu_found; extern bool isCharging; extern bool isUSBPowered; diff --git a/src/shutdown.h b/src/shutdown.h index e7cb4234a..fdb68a942 100644 --- a/src/shutdown.h +++ b/src/shutdown.h @@ -36,7 +36,7 @@ void powerCommandsCheck() if (shutdownAtMsec && millis() > shutdownAtMsec) { DEBUG_MSG("Shutting down from admin command\n"); #if defined(HAS_AXP192) || defined(HAS_AXP2101) - if (axp192_found == true) { + if (pmu_found == true) { playShutdownMelody(); power->shutdown(); } diff --git a/src/sleep.cpp b/src/sleep.cpp index d4b6caa85..81fe46e25 100644 --- a/src/sleep.cpp +++ b/src/sleep.cpp @@ -79,7 +79,7 @@ void setLed(bool ledOn) #endif #if defined(HAS_AXP192) || defined(HAS_AXP2101) - if (axp192_found) { + if (pmu_found) { // blink the axp led PMU->setChargingLedMode(ledOn ? XPOWERS_CHG_LED_ON : XPOWERS_CHG_LED_OFF); } @@ -91,7 +91,7 @@ void setGPSPower(bool on) DEBUG_MSG("Setting GPS power=%d\n", on); #if defined(HAS_AXP192) || defined(HAS_AXP2101) - if (axp192_found){ + if (pmu_found){ #ifdef LILYGO_TBEAM_S3_CORE on ? PMU->enablePowerOutput(XPOWERS_ALDO4) : PMU->disablePowerOutput(XPOWERS_ALDO4); #else @@ -191,7 +191,7 @@ void doDeepSleep(uint64_t msecToWake) #endif #if defined(HAS_AXP192) || defined(HAS_AXP2101) - if (axp192_found) { + if (pmu_found) { // Obsolete comment: from back when we we used to receive lora packets while CPU was in deep sleep. // We no longer do that, because our light-sleep current draws are low enough and it provides fast start/low cost // wake. We currently use deep sleep only for 'we want our device to actually be off - because our battery is @@ -264,7 +264,7 @@ esp_sleep_wakeup_cause_t doLightSleep(uint64_t sleepMsec) // FIXME, use a more r #endif #ifdef PMU_IRQ // wake due to PMU can happen repeatedly if there is no battery installed or the battery fills - if (axp192_found) + if (pmu_found) gpio_wakeup_enable((gpio_num_t)PMU_IRQ, GPIO_INTR_LOW_LEVEL); // pmu irq #endif assert(esp_sleep_enable_gpio_wakeup() == ESP_OK);