From 97b6f0115f737ec3df002bc54ba85b2e8d882a89 Mon Sep 17 00:00:00 2001 From: paulchilton Date: Sat, 31 Dec 2022 20:51:02 +0000 Subject: [PATCH] Moved restart code to the correct place for the M5Tough --- components/axp192/axp192.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/components/axp192/axp192.cpp b/components/axp192/axp192.cpp index 2e25e56..7e60609 100644 --- a/components/axp192/axp192.cpp +++ b/components/axp192/axp192.cpp @@ -22,6 +22,15 @@ void AXP192Component::setup() case AXP192_M5TOUGH: { begin(false, false, false, false, false); + + // If we're waking from a cold boot + if (GetStartupReason() == "ESP_RST_POWERON") + { + ESP_LOGD(TAG, "First power on, restarting ESP..."); + + // Reboot the ESP with the axp initialised + ESP.restart(); + } } } } @@ -50,15 +59,6 @@ void AXP192Component::update() { } UpdateBrightness(); - - // If we're waking from a cold boot - if (GetStartupReason() == "ESP_RST_POWERON") - { - ESP_LOGD(TAG, "First power on, restarting ESP..."); - - // Reboot the ESP with the axp initialised - ESP.restart(); - } }