This led to the effect that e.g. the confirmation messages where not shown. It is somehow related to ESPAsyncWebServer 3.3.0
37 lines
750 B
C++
37 lines
750 B
C++
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
/*
|
|
* Copyright (C) 2024 Thomas Basler and others
|
|
*/
|
|
#include "RestartHelper.h"
|
|
#include "Display_Graphic.h"
|
|
#include "Led_Single.h"
|
|
#include <Esp.h>
|
|
|
|
RestartHelperClass RestartHelper;
|
|
|
|
RestartHelperClass::RestartHelperClass()
|
|
: _rebootTask(2 * TASK_SECOND, TASK_FOREVER, std::bind(&RestartHelperClass::loop, this))
|
|
{
|
|
}
|
|
|
|
void RestartHelperClass::init(Scheduler& scheduler)
|
|
{
|
|
scheduler.addTask(_rebootTask);
|
|
}
|
|
|
|
void RestartHelperClass::triggerRestart()
|
|
{
|
|
_rebootTask.enable();
|
|
_rebootTask.restart();
|
|
}
|
|
|
|
void RestartHelperClass::loop()
|
|
{
|
|
if (_rebootTask.isFirstIteration()) {
|
|
LedSingle.turnAllOff();
|
|
Display.setStatus(false);
|
|
} else {
|
|
ESP.restart();
|
|
}
|
|
}
|