forked from tbnobody/OpenDTU
-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix: Restart was triggered before all website data was sent
This led to the effect that e.g. the confirmation messages where not shown. It is somehow related to ESPAsyncWebServer 3.3.0
- Loading branch information
Showing
10 changed files
with
66 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// SPDX-License-Identifier: GPL-2.0-or-later | ||
#pragma once | ||
|
||
#include <TaskSchedulerDeclarations.h> | ||
|
||
class RestartHelperClass { | ||
public: | ||
RestartHelperClass(); | ||
void init(Scheduler& scheduler); | ||
void triggerRestart(); | ||
|
||
private: | ||
void loop(); | ||
|
||
Task _rebootTask; | ||
}; | ||
|
||
extern RestartHelperClass RestartHelper; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// 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(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters