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(); - } }