webserver cleanups
This commit is contained in:
@ -218,6 +218,7 @@ set(headers
|
||||
webserver_ota.h
|
||||
webserver_settings.h
|
||||
webserver_stringsettings.h
|
||||
webserver_newsettings.h
|
||||
widgets/doubleprogressbar.h
|
||||
displays/menudisplaywithtime.h
|
||||
wifi_bobbycar.h
|
||||
@ -444,6 +445,7 @@ set(sources
|
||||
webserver_ota.cpp
|
||||
webserver_settings.cpp
|
||||
webserver_stringsettings.cpp
|
||||
webserver_newsettings.cpp
|
||||
widgets/doubleprogressbar.cpp
|
||||
wifi_bobbycar.cpp
|
||||
wifitexthelpers.cpp
|
||||
|
@ -1,19 +1,50 @@
|
||||
#include "webserver.h"
|
||||
#include "sdkconfig.h"
|
||||
|
||||
// system includes
|
||||
#include <chrono>
|
||||
|
||||
// esp-idf includes
|
||||
#include <esp_log.h>
|
||||
|
||||
// 3rdparty lib includes
|
||||
#include <menuitem.h>
|
||||
#include <espcppmacros.h>
|
||||
#include <esphttpdutils.h>
|
||||
#include <display.h>
|
||||
#include <screenmanager.h>
|
||||
#include <menudisplay.h>
|
||||
#include <lockhelper.h>
|
||||
#include <tickchrono.h>
|
||||
|
||||
// local includes
|
||||
#include "webserver_lock.h"
|
||||
#include "webserver_displaycontrol.h"
|
||||
#ifdef FEATURE_OTA
|
||||
#include "webserver_ota.h"
|
||||
#endif
|
||||
#include "webserver_settings.h"
|
||||
#include "webserver_stringsettings.h"
|
||||
#ifdef OLD_NVS
|
||||
#include "webserver_dumpnvs.h"
|
||||
#endif
|
||||
#include "globals.h"
|
||||
|
||||
using namespace std::chrono_literals;
|
||||
|
||||
#ifdef FEATURE_WEBSERVER
|
||||
namespace {
|
||||
constexpr const char * const TAG = "BOBBYWEB";
|
||||
} // namespace
|
||||
|
||||
namespace bobbywebserver {
|
||||
bool forceRefresh{false};
|
||||
//bool forceRefresh{false};
|
||||
bool lastScreenWasMenu{};
|
||||
int8_t lastSelectIndex{};
|
||||
std::vector<std::pair<std::string, const espgui::MenuItemIcon*>> menuBuf{};
|
||||
}
|
||||
|
||||
esp_err_t webserver_reboot_handler(httpd_req_t *req);
|
||||
bool menuDisplayChanged();
|
||||
esp_err_t webserver_status_handler(httpd_req_t *req);
|
||||
} // namespace bobbywebserver
|
||||
|
||||
httpd_handle_t httpdHandle;
|
||||
|
||||
@ -72,6 +103,8 @@ void handleWebserver()
|
||||
#endif
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
||||
esp_err_t webserver_reboot_handler(httpd_req_t *req)
|
||||
{
|
||||
esp_restart();
|
||||
@ -81,7 +114,6 @@ esp_err_t webserver_reboot_handler(httpd_req_t *req)
|
||||
|
||||
bool menuDisplayChanged()
|
||||
{
|
||||
using namespace bobbywebserver;
|
||||
if (auto currentDisplay = static_cast<const espgui::Display *>(espgui::currentDisplay.get()))
|
||||
{
|
||||
lastScreenWasMenu = true;
|
||||
@ -170,4 +202,5 @@ esp_err_t webserver_status_handler(httpd_req_t *req)
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace
|
||||
#endif
|
||||
|
@ -1,30 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
// system includes
|
||||
#include <atomic>
|
||||
#include <string_view>
|
||||
|
||||
// esp-idf includes
|
||||
#ifdef FEATURE_WEBSERVER
|
||||
#include <esp_http_server.h>
|
||||
#endif
|
||||
#include <esp_log.h>
|
||||
|
||||
// 3rdparty lib includes
|
||||
#include <espcppmacros.h>
|
||||
#include <esphttpdutils.h>
|
||||
|
||||
// local includes
|
||||
#include "webserver_lock.h"
|
||||
#include "webserver_displaycontrol.h"
|
||||
#ifdef FEATURE_OTA
|
||||
#include "webserver_ota.h"
|
||||
#endif
|
||||
#include "webserver_settings.h"
|
||||
#include "webserver_stringsettings.h"
|
||||
#ifdef OLD_NVS
|
||||
#include "webserver_dumpnvs.h"
|
||||
#endif
|
||||
|
||||
#ifdef FEATURE_WEBSERVER
|
||||
extern httpd_handle_t httpdHandle;
|
||||
@ -32,13 +11,4 @@ extern httpd_handle_t httpdHandle;
|
||||
void initWebserver();
|
||||
void handleWebserver();
|
||||
bool MenuDisplayChanged();
|
||||
esp_err_t webserver_reboot_handler(httpd_req_t *req);
|
||||
esp_err_t webserver_status_handler(httpd_req_t *req);
|
||||
|
||||
namespace bobbywebserver {
|
||||
extern bool forceRefresh;
|
||||
extern bool lastScreenWasMenu;
|
||||
extern int8_t lastSelectIndex;
|
||||
extern std::vector<std::pair<std::string, const espgui::MenuItemIcon*>> menuBuf;
|
||||
}
|
||||
#endif
|
||||
|
@ -1,5 +1,29 @@
|
||||
#include "webserver_displaycontrol.h"
|
||||
|
||||
// esp-idf includes
|
||||
#ifdef FEATURE_WEBSERVER
|
||||
#include <esp_http_server.h>
|
||||
#endif
|
||||
#include <esp_log.h>
|
||||
|
||||
// 3rdparty lib includes
|
||||
#include <htmlbuilder.h>
|
||||
#include <fmt/core.h>
|
||||
#include <espcppmacros.h>
|
||||
#include <numberparsing.h>
|
||||
#include <esphttpdutils.h>
|
||||
#include <textinterface.h>
|
||||
#include <menudisplay.h>
|
||||
#include <changevaluedisplay.h>
|
||||
#include <lockhelper.h>
|
||||
#include <tickchrono.h>
|
||||
#include <screenmanager.h>
|
||||
|
||||
// local includes
|
||||
#include "buttons.h"
|
||||
#include "globals.h"
|
||||
#include "webserver_lock.h"
|
||||
|
||||
#ifdef FEATURE_WEBSERVER
|
||||
using esphttpdutils::HtmlTag;
|
||||
using namespace std::chrono_literals;
|
||||
|
@ -4,25 +4,7 @@
|
||||
#ifdef FEATURE_WEBSERVER
|
||||
#include <esp_http_server.h>
|
||||
#endif
|
||||
#include <esp_log.h>
|
||||
|
||||
// 3rdparty lib includes
|
||||
#include <htmlbuilder.h>
|
||||
#include <fmt/core.h>
|
||||
#include <espcppmacros.h>
|
||||
#include <numberparsing.h>
|
||||
#include <esphttpdutils.h>
|
||||
#include <textinterface.h>
|
||||
#include <menudisplay.h>
|
||||
#include <changevaluedisplay.h>
|
||||
#include <lockhelper.h>
|
||||
#include <tickchrono.h>
|
||||
#include <screenmanager.h>
|
||||
|
||||
// local includes
|
||||
#include "buttons.h"
|
||||
#include "globals.h"
|
||||
#include "webserver_lock.h"
|
||||
#include <esp_err.h>
|
||||
|
||||
#ifdef FEATURE_WEBSERVER
|
||||
esp_err_t webserver_root_handler(httpd_req_t *req);
|
||||
|
@ -1,5 +1,26 @@
|
||||
#include "webserver_dumpnvs.h"
|
||||
|
||||
// esp-idf includes
|
||||
#ifdef FEATURE_WEBSERVER
|
||||
#include <esp_http_server.h>
|
||||
#endif
|
||||
#include <esp_log.h>
|
||||
|
||||
// 3rdparty lib includes
|
||||
#include <htmlbuilder.h>
|
||||
#include <fmt/core.h>
|
||||
#include <espcppmacros.h>
|
||||
#include <esphttpdutils.h>
|
||||
#include <espchrono.h>
|
||||
#include <lockhelper.h>
|
||||
#include <tickchrono.h>
|
||||
#include <ArduinoJson.h>
|
||||
|
||||
// local includes
|
||||
#include "globals.h"
|
||||
#include "webserver_lock.h"
|
||||
#include "settingsutils.h"
|
||||
|
||||
using esphttpdutils::HtmlTag;
|
||||
using namespace espchrono;
|
||||
using namespace std::chrono_literals;
|
||||
|
@ -4,22 +4,7 @@
|
||||
#ifdef FEATURE_WEBSERVER
|
||||
#include <esp_http_server.h>
|
||||
#endif
|
||||
#include <esp_log.h>
|
||||
|
||||
// 3rdparty lib includes
|
||||
#include <htmlbuilder.h>
|
||||
#include <fmt/core.h>
|
||||
#include <espcppmacros.h>
|
||||
#include <esphttpdutils.h>
|
||||
#include <espchrono.h>
|
||||
#include <lockhelper.h>
|
||||
#include <tickchrono.h>
|
||||
#include <ArduinoJson.h>
|
||||
|
||||
// local includes
|
||||
#include "globals.h"
|
||||
#include "webserver_lock.h"
|
||||
#include "settingsutils.h"
|
||||
#include <esp_err.h>
|
||||
|
||||
#ifdef FEATURE_WEBSERVER
|
||||
esp_err_t webserver_dump_nvs_handler(httpd_req_t *req);
|
||||
|
0
main/webserver_newsettings.cpp
Normal file
0
main/webserver_newsettings.cpp
Normal file
0
main/webserver_newsettings.h
Normal file
0
main/webserver_newsettings.h
Normal file
@ -1,6 +1,26 @@
|
||||
#include "webserver_ota.h"
|
||||
|
||||
// esp-idf includes
|
||||
#ifdef FEATURE_WEBSERVER
|
||||
#include <esp_http_server.h>
|
||||
#endif
|
||||
#include <esp_log.h>
|
||||
#include <esp_ota_ops.h>
|
||||
|
||||
// 3rdparty lib includes
|
||||
#include <htmlbuilder.h>
|
||||
#include <fmt/core.h>
|
||||
#include <espcppmacros.h>
|
||||
#include <esphttpdutils.h>
|
||||
#include <lockhelper.h>
|
||||
#include <tickchrono.h>
|
||||
#include <espstrutils.h>
|
||||
|
||||
// local includes
|
||||
#ifdef FEATURE_OTA
|
||||
#include "ota.h"
|
||||
#endif
|
||||
#include "webserver_lock.h"
|
||||
#include "globals.h"
|
||||
|
||||
#if defined(FEATURE_WEBSERVER) && defined(FEATURE_OTA)
|
||||
|
@ -4,23 +4,7 @@
|
||||
#ifdef FEATURE_WEBSERVER
|
||||
#include <esp_http_server.h>
|
||||
#endif
|
||||
#include <esp_log.h>
|
||||
#include <esp_ota_ops.h>
|
||||
|
||||
// 3rdparty lib includes
|
||||
#include <htmlbuilder.h>
|
||||
#include <fmt/core.h>
|
||||
#include <espcppmacros.h>
|
||||
#include <esphttpdutils.h>
|
||||
#include <lockhelper.h>
|
||||
#include <tickchrono.h>
|
||||
#include <espstrutils.h>
|
||||
|
||||
// local includes
|
||||
#ifdef FEATURE_OTA
|
||||
#include "ota.h"
|
||||
#endif
|
||||
#include "webserver_lock.h"
|
||||
#include <esp_err.h>
|
||||
|
||||
#if defined(FEATURE_WEBSERVER) && defined(FEATURE_OTA)
|
||||
esp_err_t webserver_ota_handler(httpd_req_t *req);
|
||||
|
@ -1,5 +1,27 @@
|
||||
#include "webserver_settings.h"
|
||||
|
||||
// system includes
|
||||
#include <limits>
|
||||
|
||||
// esp-idf includes
|
||||
#ifdef FEATURE_WEBSERVER
|
||||
#include <esp_http_server.h>
|
||||
#endif
|
||||
#include <esp_log.h>
|
||||
|
||||
// 3rdparty lib includes
|
||||
#include <htmlbuilder.h>
|
||||
#include <fmt/core.h>
|
||||
#include <espcppmacros.h>
|
||||
#include <esphttpdutils.h>
|
||||
#include <numberparsing.h>
|
||||
#include <lockhelper.h>
|
||||
#include <tickchrono.h>
|
||||
|
||||
// local includes
|
||||
#include "globals.h"
|
||||
#include "webserver_lock.h"
|
||||
|
||||
#ifdef FEATURE_WEBSERVER
|
||||
using namespace std::chrono_literals;
|
||||
using esphttpdutils::HtmlTag;
|
||||
|
@ -1,26 +1,10 @@
|
||||
#pragma once
|
||||
|
||||
// system includes
|
||||
#include <limits>
|
||||
|
||||
// esp-idf includes
|
||||
#ifdef FEATURE_WEBSERVER
|
||||
#include <esp_http_server.h>
|
||||
#endif
|
||||
#include <esp_log.h>
|
||||
|
||||
// 3rdparty lib includes
|
||||
#include <htmlbuilder.h>
|
||||
#include <fmt/core.h>
|
||||
#include <espcppmacros.h>
|
||||
#include <esphttpdutils.h>
|
||||
#include <numberparsing.h>
|
||||
#include <lockhelper.h>
|
||||
#include <tickchrono.h>
|
||||
|
||||
// local includes
|
||||
#include "globals.h"
|
||||
#include "webserver_lock.h"
|
||||
#include <esp_err.h>
|
||||
|
||||
#ifdef FEATURE_WEBSERVER
|
||||
esp_err_t webserver_settings_handler(httpd_req_t *req);
|
||||
|
@ -1,5 +1,22 @@
|
||||
#include "webserver_stringsettings.h"
|
||||
|
||||
// esp-idf includes
|
||||
#ifdef FEATURE_WEBSERVER
|
||||
#include <esp_http_server.h>
|
||||
#endif
|
||||
|
||||
// 3rdparty lib includes
|
||||
#include <htmlbuilder.h>
|
||||
#include <fmt/core.h>
|
||||
#include <espcppmacros.h>
|
||||
#include <esphttpdutils.h>
|
||||
#include <lockhelper.h>
|
||||
#include <tickchrono.h>
|
||||
|
||||
// local includes
|
||||
#include "globals.h"
|
||||
#include "webserver_lock.h"
|
||||
|
||||
#ifdef FEATURE_WEBSERVER
|
||||
using namespace std::chrono_literals;
|
||||
using esphttpdutils::HtmlTag;
|
||||
|
@ -4,19 +4,7 @@
|
||||
#ifdef FEATURE_WEBSERVER
|
||||
#include <esp_http_server.h>
|
||||
#endif
|
||||
#include <esp_log.h>
|
||||
|
||||
// 3rdparty lib includes
|
||||
#include <htmlbuilder.h>
|
||||
#include <fmt/core.h>
|
||||
#include <espcppmacros.h>
|
||||
#include <esphttpdutils.h>
|
||||
#include <lockhelper.h>
|
||||
#include <tickchrono.h>
|
||||
|
||||
// local includes
|
||||
#include "globals.h"
|
||||
#include "webserver_lock.h"
|
||||
#include <esp_err.h>
|
||||
|
||||
#ifdef FEATURE_WEBSERVER
|
||||
esp_err_t webserver_stringSettings_handler(httpd_req_t *req);
|
||||
|
Reference in New Issue
Block a user