Moved restart code to the correct place for the M5Tough

This commit is contained in:
paulchilton
2022-12-31 20:51:02 +00:00
committed by GitHub
parent 25fcd23de9
commit 97b6f0115f

View File

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