http_config
Peter Buchegger 2021-07-23 22:49:49 +02:00
rodzic 904b5990a4
commit 910c089968
2 zmienionych plików z 4 dodań i 4 usunięć

Wyświetl plik

@ -5,7 +5,7 @@
#include "TaskConfig.h" #include "TaskConfig.h"
#include "configuration.h" #include "configuration.h"
ConfigTask::ConfigTask() : Task(TASK_CONFIG, TaskConfig), _server(80), _config_filename("/is-cfg.json"), _setupDone(false) { ConfigTask::ConfigTask() : Task(TASK_CONFIG, TaskConfig), _server(80), _config_filename("/is-cfg.json"), _setupDone(false), _httpServerInitDone(false) {
} }
ConfigTask::~ConfigTask() { ConfigTask::~ConfigTask() {
@ -30,10 +30,9 @@ bool ConfigTask::setup(System &system) {
bool ConfigTask::loop(System &system) { bool ConfigTask::loop(System &system) {
// we can start the http server just when we are connected to something // we can start the http server just when we are connected to something
static bool httpServerInitDone = false; if (system.isWifiEthConnected() && !_httpServerInitDone) {
if (system.isWifiEthConnected() && !httpServerInitDone) {
_server.begin(); _server.begin();
httpServerInitDone = true; _httpServerInitDone = true;
} }
if (_html.wasSaved()) { if (_html.wasSaved()) {

Wyświetl plik

@ -19,6 +19,7 @@ private:
AsyncWebServer _server; AsyncWebServer _server;
const String _config_filename; const String _config_filename;
bool _setupDone; bool _setupDone;
bool _httpServerInitDone;
}; };
#endif #endif