[Build] Reduce build size by using static functions (src/WebServer) 2nd

This commit is contained in:
TD-er committed 2026-10-18 00:53:03 +02:00
1 parent da96905f27
commit ff9a7f6150
17 files changed
+906 -964

No files matched your search

@@ -6,7 +6,7 @@
# include "../Helpers/StringConverter.h"
# include "../WebServer/Markup_Forms.h"
String DevSpecific_Security_getLabelString(SecurityStruct_deviceSpecific::KeyType keytype,
static String DevSpecific_Security_getLabelString(SecurityStruct_deviceSpecific::KeyType keytype,
uint16_t index,
bool displayString,
KVS_StorageType::Enum & storageType,
@@ -35,7 +35,7 @@ String DevSpecific_Security_getLabelString(SecurityStruct_deviceSpecific::KeyTyp
return res;
}
WebFormItemParams make_DevSpecific_Security_WebFormItemParams(
static WebFormItemParams make_DevSpecific_Security_WebFormItemParams(
SecurityStruct_deviceSpecific::KeyType keytype,
uint16_t index,
bool suppressIndex_displayString)
+80 -64
View File
@@ -15,6 +15,79 @@
# include "../Helpers/Misc.h"
# include "../Helpers/StringConverter.h"
// ********************************************************************************
// download filetype selectors
// ********************************************************************************
static void addDownloadFiletypeCheckbox(FileType::Enum filetype, unsigned int filenr) {
const String fileName = getFileName(filetype, filenr);
addRowLabel(fileName);
addCheckBox(fileName, getDownloadFiletypeChecked(filetype, filenr));
}
static void storeDownloadFiletypeCheckbox(FileType::Enum filetype, unsigned int filenr) {
const bool isChecked = isFormItemChecked(getFileName(filetype, filenr));
switch (filetype)
{
case FileType::CONFIG_DAT: ResetFactoryDefaultPreference.fetchConfigDat(isChecked);
break;
case FileType::SECURITY_DAT: ResetFactoryDefaultPreference.fetchSecurityDat(isChecked);
break;
case FileType::NOTIFICATION_DAT: ResetFactoryDefaultPreference.fetchNotificationDat(isChecked);
break;
case FileType::RULES_TXT:
{ ResetFactoryDefaultPreference.fetchRulesTXT(filenr, isChecked);
break;
}
case FileType::PROVISIONING_DAT:
{ ResetFactoryDefaultPreference.fetchProvisioningDat(isChecked);
break;
}
# if FEATURE_STORE_CREDENTIALS_SEPARATE_FILE
case FileType::DEV_SECURITY_DAT:
{ ResetFactoryDefaultPreference.fetchDeviceSecurityDat(isChecked);
break;
}
# endif // if FEATURE_STORE_CREDENTIALS_SEPARATE_FILE
case FileType::MAX_FILETYPE:
break;
}
}
# if FEATURE_CUSTOM_PROVISIONING
static void addAllowFiletypeCheckbox(const ProvisioningStruct& ProvisioningSettings, FileType::Enum filetype, unsigned int filenr)
{
const String fileName = getFileName(filetype, filenr);
addRowLabel(fileName);
addCheckBox(concat(F("allow_"), fileName), ProvisioningSettings.fetchFileTypeAllowed(filetype, filenr));
}
static void storeAllowFiletypeCheckbox(ProvisioningStruct& ProvisioningSettings, FileType::Enum filetype, unsigned int filenr)
{
const bool isChecked = isFormItemChecked(concat(F("allow_"), getFileName(filetype, filenr)));
ProvisioningSettings.setFetchFileTypeAllowed(filetype, filenr, isChecked);
}
# endif // if FEATURE_CUSTOM_PROVISIONING
static bool tryDownloadFileType(const String& url, const String& user, const String& pass, FileType::Enum filetype, unsigned int filenr) {
const String filename = getFileName(filetype, filenr);
addRowLabel(filename);
const String error = downloadFileType(url, user, pass, filetype, filenr);
if (error.length() == 0) {
addHtml(F("Success"));
return true;
}
addHtml(error);
return false;
}
// ********************************************************************************
// Web Interface to manage archived settings
@@ -41,7 +114,7 @@ void handle_settingsarchive() {
storeDownloadFiletypeCheckbox(FileType::RULES_TXT, i);
}
} else {
storeDownloadFiletypeCheckbox(ft);
storeDownloadFiletypeCheckbox(ft, 0);
}
}
@@ -62,6 +135,7 @@ void handle_settingsarchive() {
ProvisioningSettings->ResetFactoryDefaultPreference = ResetFactoryDefaultPreference.getPreference();
ProvisioningSettings->allowedFlags.allowFetchFirmware = isFormItemChecked(F("firmware"));
for (int i = 0; i < FileType::MAX_FILETYPE; ++i) {
const FileType::Enum ft = static_cast<FileType::Enum>(i);
@@ -70,7 +144,7 @@ void handle_settingsarchive() {
storeAllowFiletypeCheckbox(*ProvisioningSettings, FileType::RULES_TXT, i);
}
} else {
storeAllowFiletypeCheckbox(*ProvisioningSettings, ft);
storeAllowFiletypeCheckbox(*ProvisioningSettings, ft, 0);
}
}
@@ -109,7 +183,7 @@ void handle_settingsarchive() {
if (ft != FileType::RULES_TXT) {
if (getDownloadFiletypeChecked(ft, 0)) {
if (tryDownloadFileType(url, user, pass, ft)) {
if (tryDownloadFileType(url, user, pass, ft, 0)) {
somethingDownloaded = true;
}
}
@@ -174,6 +248,7 @@ void handle_settingsarchive() {
addFormTextBox(F("User"), F("user"), user, 64);
addFormPasswordBox(F("Pass"), F("pass"), pass, 64);
# if FEATURE_CUSTOM_PROVISIONING
if (ProvisioningSettings.get()) {
addFormCheckBox(F("Store Credentials"), F("savecred"), ResetFactoryDefaultPreference.storeCredentials());
@@ -184,7 +259,7 @@ void handle_settingsarchive() {
const FileType::Enum ft = static_cast<FileType::Enum>(i);
if (ft != FileType::RULES_TXT) {
addAllowFiletypeCheckbox(*ProvisioningSettings, ft);
addAllowFiletypeCheckbox(*ProvisioningSettings, ft, 0);
}
}
@@ -212,7 +287,7 @@ void handle_settingsarchive() {
const FileType::Enum ft = static_cast<FileType::Enum>(i);
if (ft != FileType::RULES_TXT) {
addDownloadFiletypeCheckbox(ft);
addDownloadFiletypeCheckbox(ft, 0);
}
}
@@ -235,63 +310,4 @@ void handle_settingsarchive() {
sendTail_stdtemplate();
}
// ********************************************************************************
// download filetype selectors
// ********************************************************************************
void addDownloadFiletypeCheckbox(FileType::Enum filetype, unsigned int filenr) {
const String fileName = getFileName(filetype, filenr);
addRowLabel(fileName);
addCheckBox(fileName, getDownloadFiletypeChecked(filetype, filenr));
}
void storeDownloadFiletypeCheckbox(FileType::Enum filetype, unsigned int filenr) {
const bool isChecked = isFormItemChecked(getFileName(filetype, filenr));
switch (filetype) {
case FileType::CONFIG_DAT: ResetFactoryDefaultPreference.fetchConfigDat(isChecked); break;
case FileType::SECURITY_DAT: ResetFactoryDefaultPreference.fetchSecurityDat(isChecked); break;
case FileType::NOTIFICATION_DAT: ResetFactoryDefaultPreference.fetchNotificationDat(isChecked); break;
case FileType::RULES_TXT: { ResetFactoryDefaultPreference.fetchRulesTXT(filenr, isChecked); break; }
case FileType::PROVISIONING_DAT: { ResetFactoryDefaultPreference.fetchProvisioningDat(isChecked); break; }
#if FEATURE_STORE_CREDENTIALS_SEPARATE_FILE
case FileType::DEV_SECURITY_DAT: { ResetFactoryDefaultPreference.fetchDeviceSecurityDat(isChecked); break; }
#endif
case FileType::MAX_FILETYPE:
break;
}
}
# if FEATURE_CUSTOM_PROVISIONING
void addAllowFiletypeCheckbox(const ProvisioningStruct& ProvisioningSettings, FileType::Enum filetype, unsigned int filenr)
{
const String fileName = getFileName(filetype, filenr);
addRowLabel(fileName);
addCheckBox(concat(F("allow_"), fileName), ProvisioningSettings.fetchFileTypeAllowed(filetype, filenr));
}
void storeAllowFiletypeCheckbox(ProvisioningStruct& ProvisioningSettings, FileType::Enum filetype, unsigned int filenr)
{
const bool isChecked = isFormItemChecked(concat(F("allow_"), getFileName(filetype, filenr)));
ProvisioningSettings.setFetchFileTypeAllowed(filetype, filenr, isChecked);
}
# endif // if FEATURE_CUSTOM_PROVISIONING
bool tryDownloadFileType(const String& url, const String& user, const String& pass, FileType::Enum filetype, unsigned int filenr) {
const String filename = getFileName(filetype, filenr);
addRowLabel(filename);
const String error = downloadFileType(url, user, pass, filetype, filenr);
if (error.length() == 0) {
addHtml(F("Success"));
return true;
}
addHtml(error);
return false;
}
#endif // if FEATURE_SETTINGS_ARCHIVE
+5 -24
View File
@@ -1,16 +1,14 @@
#ifndef WEBSERVER_WEBSERVER_SETTINGSARCHIVE_H
#define WEBSERVER_WEBSERVER_SETTINGSARCHIVE_H
#pragma once
#include "../WebServer/common.h"
#if FEATURE_SETTINGS_ARCHIVE
#include "../DataTypes/ESPEasyFileType.h"
#if FEATURE_CUSTOM_PROVISIONING
#include "../DataStructs/ProvisioningStruct.h"
#endif
# include "../DataTypes/ESPEasyFileType.h"
# if FEATURE_CUSTOM_PROVISIONING
# include "../DataStructs/ProvisioningStruct.h"
# endif
// ********************************************************************************
@@ -18,21 +16,4 @@
// ********************************************************************************
void handle_settingsarchive();
// ********************************************************************************
// download filetype selectors
// ********************************************************************************
void addDownloadFiletypeCheckbox(FileType::Enum filetype, unsigned int filenr = 0);
void storeDownloadFiletypeCheckbox(FileType::Enum filetype, unsigned int filenr = 0);
# if FEATURE_CUSTOM_PROVISIONING
void addAllowFiletypeCheckbox(const ProvisioningStruct& ProvisioningSettings, FileType::Enum filetype, unsigned int filenr = 0);
void storeAllowFiletypeCheckbox(ProvisioningStruct& ProvisioningSettings, FileType::Enum filetype, unsigned int filenr = 0);
# endif
bool tryDownloadFileType(const String& url, const String& user, const String& pass, FileType::Enum filetype, unsigned int filenr = 0);
#endif // if FEATURE_SETTINGS_ARCHIVE
#endif
+184 -181
View File
@@ -31,6 +31,190 @@
# endif
static void handle_setup_scan_and_show(const String& ssid, const String& other, const String& password) {
int8_t scanCompleteStatus = ESPEasy::net::wifi::WiFi_AP_Candidates.scanComplete();
const bool needsRescan =
(scanCompleteStatus == 0 || // No AP found
scanCompleteStatus == -2) // Scan not triggered
&& ESPEasy::net::wifi::WiFiScanAllowed();
if (needsRescan) {
WiFiMode_t cur_wifimode = WiFi.getMode();
ESPEasy::net::wifi::WifiScan(false);
scanCompleteStatus = ESPEasy::net::wifi::WiFi_AP_Candidates.scanComplete();
ESPEasy::net::wifi::setWifiMode(cur_wifimode);
}
if (scanCompleteStatus <= 0) {
addHtml(F("No Access Points found"));
}
else
{
html_table_class_multirow();
html_TR();
html_table_header(F("Pick"), 50);
html_table_header(F("Network info"));
html_table_header(F("RSSI"), 50);
for (auto it = ESPEasy::net::wifi::WiFi_AP_Candidates.scanned_begin(); it != ESPEasy::net::wifi::WiFi_AP_Candidates.scanned_end(); ++it)
{
html_TR_TD();
const String id = it->toString("");
addHtml(F("<label "));
addHtmlAttribute(F("class"), F("container2"));
addHtmlAttribute(F("for"), id);
addHtml('>');
addHtml(F("<input type='radio' name='ssid' value='"));
if (it->bits.isHidden) {
addHtml(F("#Hidden#' disabled"));
} else {
String escapeBuffer = it->ssid;
htmlStrongEscape(escapeBuffer);
addHtml(escapeBuffer);
addHtml('\'');
}
addHtmlAttribute(F("id"), id);
{
if (it->bssid_match(RTC.lastBSSID)) {
if (!ESPEasy::net::wifi::WiFi_AP_Candidates.SettingsIndexMatchCustomCredentials(RTC.lastWiFiSettingsIndex)) {
addHtml(F(" checked "));
}
}
}
addHtml(F("><span class='dotmark'></span>"));
addHtml(F("</label>"));
html_TD();
addHtml(F("<label "));
addHtmlAttribute(F("for"), id);
addHtml('>');
addHtml(it->toString(F("<BR>")));
addHtml(F("</label>"));
html_TD();
addHtml(F("<label "));
addHtmlAttribute(F("for"), id);
addHtml('>');
getWiFi_RSSI_icon(it->rssi, 45);
addHtml(F("</label>"));
}
html_end_table();
}
html_BR();
addSubmitButton(F("Rescan"), F("performrescan"));
html_BR();
html_table_class_normal();
html_TR_TD();
addHtml(F("<label "));
addHtmlAttribute(F("class"), F("container2"));
addHtml('>');
addHtml(F("other SSID:"));
addHtml(F("<input "));
addHtmlAttribute(F("type"), F("radio"));
addHtmlAttribute(F("name"), F("ssid"));
addHtmlAttribute(F("id"), F("other_ssid"));
addHtmlAttribute(F("value"), F("other"));
addHtml('>');
addHtml(F("<span class='dotmark'></span></label>"));
html_TD();
addHtml(F("<label "));
addHtmlAttribute(F("for"), F("other_ssid"));
addHtml('>');
addHtml(F("<input "));
addHtmlAttribute(F("class"), F("wide"));
addHtmlAttribute(F("type"), F("text"));
addHtmlAttribute(F("name"), F("other"));
addHtmlAttribute(F("value"), other);
addHtml('>');
addHtml(F("</label>"));
html_TR();
html_BR();
html_BR();
addFormSeparator(2);
html_BR();
addFormPasswordBox(F("Password"), F("pass"), password, 63);
addFormCheckBox(F("Allow Empty Password"), F("emptypass"), false);
/*
if (SecuritySettings.hasWiFiCredentials(SecurityStruct::WiFiCredentialsSlot::first)) {
addFormCheckBox(F("Clear Stored SSID1"), F("clearssid1"), false);
addFormNote(String(F("Current: ")) + getValue(LabelType::WIFI_STORED_SSID1));
}
if (SecuritySettings.hasWiFiCredentials(SecurityStruct::WiFiCredentialsSlot::second)) {
addFormCheckBox(F("Clear Stored SSID2"), F("clearssid2"), false);
addFormNote(String(F("Current: ")) + getValue(LabelType::WIFI_STORED_SSID2));
}
*/
html_TR_TD();
html_TD();
html_BR();
addSubmitButton(F("Connect"), EMPTY_STRING);
html_end_table();
}
static bool handle_setup_connectingStage(uint8_t refreshCount) {
if (refreshCount > 0)
{
// safe_strncpy(SecuritySettings.WifiSSID, "ssid", sizeof(SecuritySettings.WifiSSID));
// SecuritySettings.WifiKey[0] = 0;
addButton(F("/setup"), F("Back to Setup"));
html_TR_TD();
html_BR();
// WiFiEventData.wifiSetupConnect = false;
return false;
}
int wait = WIFI_RECONNECT_WAIT / 1000;
if (refreshCount != 0) {
wait = 3;
}
addHtml(F("Please wait for <h1 id='countdown'>20..</h1>"
"<script>"
"function timedRefresh(tp) {"
"var t=setInterval(function(){"
"if(tp>0){"
"tp-=1;"
"document.getElementById('countdown').innerHTML=tp+'..'+'<br/>';"
"}else{"
"clearInterval(t);"
"window.location.href=window.location.href;"
"};"
"},1000);"
"};"
"timedRefresh("));
addHtmlInt(wait);
addHtml(')', ';');
html_add_script_end();
addHtml(F("seconds while trying to connect"));
return true;
}
// ********************************************************************************
// Web Interface Setup Wizard
// ********************************************************************************
@@ -271,185 +455,4 @@ void handle_setup() {
}
}
void handle_setup_scan_and_show(const String& ssid, const String& other, const String& password) {
int8_t scanCompleteStatus = ESPEasy::net::wifi::WiFi_AP_Candidates.scanComplete();
const bool needsRescan =
(scanCompleteStatus == 0 || // No AP found
scanCompleteStatus == -2) // Scan not triggered
&& ESPEasy::net::wifi::WiFiScanAllowed();
if (needsRescan) {
WiFiMode_t cur_wifimode = WiFi.getMode();
ESPEasy::net::wifi::WifiScan(false);
scanCompleteStatus = ESPEasy::net::wifi::WiFi_AP_Candidates.scanComplete();
ESPEasy::net::wifi::setWifiMode(cur_wifimode);
}
if (scanCompleteStatus <= 0) {
addHtml(F("No Access Points found"));
}
else
{
html_table_class_multirow();
html_TR();
html_table_header(F("Pick"), 50);
html_table_header(F("Network info"));
html_table_header(F("RSSI"), 50);
for (auto it = ESPEasy::net::wifi::WiFi_AP_Candidates.scanned_begin(); it != ESPEasy::net::wifi::WiFi_AP_Candidates.scanned_end(); ++it)
{
html_TR_TD();
const String id = it->toString("");
addHtml(F("<label "));
addHtmlAttribute(F("class"), F("container2"));
addHtmlAttribute(F("for"), id);
addHtml('>');
addHtml(F("<input type='radio' name='ssid' value='"));
if (it->bits.isHidden) {
addHtml(F("#Hidden#' disabled"));
} else {
String escapeBuffer = it->ssid;
htmlStrongEscape(escapeBuffer);
addHtml(escapeBuffer);
addHtml('\'');
}
addHtmlAttribute(F("id"), id);
{
if (it->bssid_match(RTC.lastBSSID)) {
if (!ESPEasy::net::wifi::WiFi_AP_Candidates.SettingsIndexMatchCustomCredentials(RTC.lastWiFiSettingsIndex)) {
addHtml(F(" checked "));
}
}
}
addHtml(F("><span class='dotmark'></span>"));
addHtml(F("</label>"));
html_TD();
addHtml(F("<label "));
addHtmlAttribute(F("for"), id);
addHtml('>');
addHtml(it->toString(F("<BR>")));
addHtml(F("</label>"));
html_TD();
addHtml(F("<label "));
addHtmlAttribute(F("for"), id);
addHtml('>');
getWiFi_RSSI_icon(it->rssi, 45);
addHtml(F("</label>"));
}
html_end_table();
}
html_BR();
addSubmitButton(F("Rescan"), F("performrescan"));
html_BR();
html_table_class_normal();
html_TR_TD();
addHtml(F("<label "));
addHtmlAttribute(F("class"), F("container2"));
addHtml('>');
addHtml(F("other SSID:"));
addHtml(F("<input "));
addHtmlAttribute(F("type"), F("radio"));
addHtmlAttribute(F("name"), F("ssid"));
addHtmlAttribute(F("id"), F("other_ssid"));
addHtmlAttribute(F("value"), F("other"));
addHtml('>');
addHtml(F("<span class='dotmark'></span></label>"));
html_TD();
addHtml(F("<label "));
addHtmlAttribute(F("for"), F("other_ssid"));
addHtml('>');
addHtml(F("<input "));
addHtmlAttribute(F("class"), F("wide"));
addHtmlAttribute(F("type"), F("text"));
addHtmlAttribute(F("name"), F("other"));
addHtmlAttribute(F("value"), other);
addHtml('>');
addHtml(F("</label>"));
html_TR();
html_BR();
html_BR();
addFormSeparator(2);
html_BR();
addFormPasswordBox(F("Password"), F("pass"), password, 63);
addFormCheckBox(F("Allow Empty Password"), F("emptypass"), false);
/*
if (SecuritySettings.hasWiFiCredentials(SecurityStruct::WiFiCredentialsSlot::first)) {
addFormCheckBox(F("Clear Stored SSID1"), F("clearssid1"), false);
addFormNote(String(F("Current: ")) + getValue(LabelType::WIFI_STORED_SSID1));
}
if (SecuritySettings.hasWiFiCredentials(SecurityStruct::WiFiCredentialsSlot::second)) {
addFormCheckBox(F("Clear Stored SSID2"), F("clearssid2"), false);
addFormNote(String(F("Current: ")) + getValue(LabelType::WIFI_STORED_SSID2));
}
*/
html_TR_TD();
html_TD();
html_BR();
addSubmitButton(F("Connect"), EMPTY_STRING);
html_end_table();
}
bool handle_setup_connectingStage(uint8_t refreshCount) {
if (refreshCount > 0)
{
// safe_strncpy(SecuritySettings.WifiSSID, "ssid", sizeof(SecuritySettings.WifiSSID));
// SecuritySettings.WifiKey[0] = 0;
addButton(F("/setup"), F("Back to Setup"));
html_TR_TD();
html_BR();
// WiFiEventData.wifiSetupConnect = false;
return false;
}
int wait = WIFI_RECONNECT_WAIT / 1000;
if (refreshCount != 0) {
wait = 3;
}
addHtml(F("Please wait for <h1 id='countdown'>20..</h1>"
"<script>"
"function timedRefresh(tp) {"
"var t=setInterval(function(){"
"if(tp>0){"
"tp-=1;"
"document.getElementById('countdown').innerHTML=tp+'..'+'<br/>';"
"}else{"
"clearInterval(t);"
"window.location.href=window.location.href;"
"};"
"},1000);"
"};"
"timedRefresh("));
addHtmlInt(wait);
addHtml(')', ';');
html_add_script_end();
addHtml(F("seconds while trying to connect"));
return true;
}
#endif // ifdef WEBSERVER_SETUP
+2 -13
View File
@@ -1,5 +1,4 @@
#ifndef WEBSERVER_WEBSERVER_SETUPPAGE_H
#define WEBSERVER_WEBSERVER_SETUPPAGE_H
#pragma once
#include "../WebServer/common.h"
@@ -12,14 +11,4 @@
void handle_setup();
void handle_setup_scan_and_show(const String& ssid, const String& other, const String& password);
bool handle_setup_connectingStage(uint8_t refreshCount);
#endif // ifdef WEBSERVER_SETUP
#endif
#endif // ifdef WEBSERVER_SETUP
+456 -454
View File
@@ -41,9 +41,9 @@
# include "../Helpers/Hardware_temperature_sensor.h"
# endif
#if FEATURE_EEPROM_EXTERNAL
#include "../../ESPEasy/eeprom/Helpers/EEPROMExternal.h"
#endif // if FEATURE_EEPROM_EXTERNAL
# if FEATURE_EEPROM_EXTERNAL
# include "../../ESPEasy/eeprom/Helpers/EEPROMExternal.h"
# endif // if FEATURE_EEPROM_EXTERNAL
# ifdef ESP32
# include <esp_partition.h>
@@ -233,15 +233,466 @@ void handle_sysinfo_json() {
# ifdef WEBSERVER_SYSINFO
static void handle_sysinfo_basicInfo() {
static const LabelType::Enum labels[] PROGMEM =
{
# if FEATURE_MDNS
LabelType::M_DNS,
# endif
LabelType::UNIT_NR,
LabelType::LOCAL_TIME,
# if FEATURE_EXT_RTC
LabelType::EXT_RTC_UTC_TIME,
# endif // if FEATURE_EXT_RTC
LabelType::TIME_SOURCE,
LabelType::TIME_WANDER,
LabelType::UPTIME,
LabelType::LOAD_PCT,
# if FEATURE_INTERNAL_TEMPERATURE
LabelType::INTERNAL_TEMPERATURE,
# endif
LabelType::CPU_ECO_MODE,
LabelType::RESET_REASON,
LabelType::LAST_TASK_BEFORE_REBOOT,
LabelType::SW_WD_COUNT,
LabelType::BOOT_TYPE,
LabelType::MAX_LABEL
};
addRowLabelValues(labels);
}
# ifndef WEBSERVER_SYSINFO_MINIMAL
static void handle_sysinfo_memory() {
addTableSeparator(F("Memory"), 2, 3);
static const LabelType::Enum labels[] PROGMEM =
{
# ifdef ESP32
LabelType::HEAP_SIZE,
LabelType::HEAP_MIN_FREE,
# endif // ifdef ESP32
LabelType::FREE_MEM,
# if defined(CORE_POST_2_5_0) || defined(ESP32)
# ifndef LIMIT_BUILD_SIZE
LabelType::HEAP_MAX_FREE_BLOCK,
# endif // ifndef LIMIT_BUILD_SIZE
# endif // if defined(CORE_POST_2_5_0) || defined(ESP32)
# if defined(CORE_POST_2_5_0)
# ifndef LIMIT_BUILD_SIZE
LabelType::HEAP_FRAGMENTATION,
# endif // ifndef LIMIT_BUILD_SIZE
# ifdef USE_SECOND_HEAP
LabelType::FREE_HEAP_IRAM,
# endif
# endif // if defined(CORE_POST_2_5_0)
LabelType::FREE_STACK,
# if defined(ESP32) && defined(BOARD_HAS_PSRAM)
LabelType::PSRAM_SIZE,
LabelType::PSRAM_FREE,
LabelType::PSRAM_MIN_FREE,
LabelType::PSRAM_MAX_FREE_BLOCK,
# endif // if defined(ESP32) && defined(BOARD_HAS_PSRAM)
LabelType::MAX_LABEL
};
addRowLabelValues(labels);
}
# endif // ifndef WEBSERVER_SYSINFO_MINIMAL
void handle_sysinfo_Network() {
addTableSeparator(F("Network"), 2, 3);
{
static const LabelType::Enum labels[] PROGMEM =
{
# if FEATURE_ETHERNET || defined(USES_ESPEASY_NOW)
LabelType::ETH_WIFI_MODE,
# endif
LabelType::IP_CONFIG,
LabelType::IP_ADDRESS_SUBNET,
# if FEATURE_USE_IPV6
LabelType::IP6_LOCAL,
LabelType::IP6_GLOBAL,
// LabelType::IP6_ALL_ADDRESSES,
# endif // if FEATURE_USE_IPV6
LabelType::GATEWAY,
LabelType::CLIENT_IP,
LabelType::DNS,
LabelType::ALLOWED_IP_RANGE,
LabelType::CONNECTED,
LabelType::NUMBER_RECONNECTS,
LabelType::MAX_LABEL
};
addRowLabelValues(labels);
}
}
static void handle_sysinfo_NetworkAdapters() {
# ifndef LIMIT_BUILD_SIZE
for (ESPEasy::net::networkIndex_t x = 0; x < NETWORK_MAX; ++x)
{
if (Settings.getNetworkEnabled(x)) {
auto pluginID = Settings.getNWPluginID_for_network(x);
if (pluginID != ESPEasy::net::INVALID_NW_PLUGIN_ID) {
KeyValueWriter_WebForm writer(
strformat(F("%s (%d)"),
getNWPluginNameFromNWPluginID(pluginID).c_str(),
x + 1));
# ifdef WEBSERVER_NETWORK
# ifdef ESP32
ESPEasy::net::write_NetworkAdapterFlags(x, &writer);
ESPEasy::net::write_IP_config(x, &writer);
# endif // ifdef ESP32
# endif // ifdef WEBSERVER_NETWORK
ESPEasy::net::write_NetworkConnectionInfo(x, &writer);
}
}
}
# endif // ifndef LIMIT_BUILD_SIZE
html_TR();
}
# ifndef WEBSERVER_SYSINFO_MINIMAL
static void handle_sysinfo_WiFiSettings() {
if (!ESPEasy::net::wifi::WiFiConnected()) { return; }
addTableSeparator(F("WiFi Settings"), 2, 3);
static const LabelType::Enum labels[] PROGMEM =
{
LabelType::FORCE_WIFI_BG,
LabelType::RESTART_WIFI_LOST_CONN,
LabelType::FORCE_WIFI_NOSLEEP,
# ifdef SUPPORT_ARP
LabelType::PERIODICAL_GRAT_ARP,
# endif // ifdef SUPPORT_ARP
LabelType::CONNECTION_FAIL_THRESH,
# if FEATURE_SET_WIFI_TX_PWR
LabelType::WIFI_TX_MAX_PWR,
LabelType::WIFI_CUR_TX_PWR,
LabelType::WIFI_SENS_MARGIN,
LabelType::WIFI_SEND_AT_MAX_TX_PWR,
# endif // if FEATURE_SET_WIFI_TX_PWR
LabelType::WIFI_NR_RECONNECT_ATTEMPTS,
LabelType::WIFI_MAX_UPTIME_AUTO_START_AP,
LabelType::WIFI_AP_MINIMAL_ON_TIME,
# ifdef USES_ESPEASY_NOW
LabelType::USE_ESPEASY_NOW,
LabelType::FORCE_ESPEASY_NOW_CHANNEL,
# endif // ifdef USES_ESPEASY_NOW
LabelType::WIFI_USE_LAST_CONN_FROM_RTC,
# ifndef ESP32
LabelType::WAIT_WIFI_CONNECT,
# endif
# ifdef ESP32
LabelType::WIFI_PASSIVE_SCAN,
# endif
LabelType::HIDDEN_SSID_SLOW_CONNECT,
LabelType::CONNECT_HIDDEN_SSID,
LabelType::SDK_WIFI_AUTORECONNECT,
# if FEATURE_USE_IPV6
LabelType::ENABLE_IPV6,
# endif
LabelType::MAX_LABEL
};
addRowLabelValues(labels);
}
# endif // ifndef WEBSERVER_SYSINFO_MINIMAL
static void handle_sysinfo_Firmware() {
addTableSeparator(F("Firmware"), 2, 3);
static const LabelType::Enum labels[] PROGMEM =
{
LabelType::BUILD_DESC,
LabelType::SYSTEM_LIBRARIES,
# ifdef ESP32
LabelType::ESP_IDF_SDK_VERSION,
# endif
LabelType::GIT_BUILD,
LabelType::PLUGIN_COUNT,
LabelType::PLUGIN_DESCRIPTION,
LabelType::BUILD_ORIGIN,
LabelType::BUILD_TIME,
LabelType::BINARY_FILENAME,
LabelType::BUILD_PLATFORM,
LabelType::GIT_HEAD,
# ifdef CONFIGURATION_CODE
LabelType::CONFIGURATION_CODE_LBL,
# endif // ifdef CONFIGURATION_CODE
LabelType::MAX_LABEL
};
addRowLabelValues(labels);
}
# ifndef WEBSERVER_SYSINFO_MINIMAL
static void handle_sysinfo_SystemStatus() {
addTableSeparator(F("System Status"), 2, 3);
static const LabelType::Enum labels[] PROGMEM =
{
// Actual Loglevel
# if FEATURE_SYSLOG
LabelType::SYSLOG_LOG_LEVEL,
# endif
LabelType::SERIAL_LOG_LEVEL,
# ifdef WEBSERVER_LOG
LabelType::WEB_LOG_LEVEL,
# endif
# if FEATURE_SD
LabelType::SD_LOG_LEVEL,
# endif // if FEATURE_SD
LabelType::ENABLE_SERIAL_PORT_CONSOLE,
LabelType::CONSOLE_SERIAL_PORT,
# if USES_ESPEASY_CONSOLE_FALLBACK_PORT
LabelType::CONSOLE_FALLBACK_TO_SERIAL0,
LabelType::CONSOLE_FALLBACK_PORT,
# endif // if USES_ESPEASY_CONSOLE_FALLBACK_PORT
# if FEATURE_CLEAR_I2C_STUCK
LabelType::I2C_BUS_STATE,
LabelType::I2C_BUS_CLEARED_COUNT,
# endif // if FEATURE_CLEAR_I2C_STUCK
LabelType::MAX_LABEL
};
addRowLabelValues(labels);
}
# endif // ifndef WEBSERVER_SYSINFO_MINIMAL
# ifndef WEBSERVER_SYSINFO_MINIMAL
void handle_sysinfo_NetworkServices() {
addTableSeparator(F("Network Services"), 2, 3);
addRowLabel(F("Network Connected"));
addEnabled(ESPEasy::net::NetworkConnected());
addRowLabel(F("NTP Initialized"));
addEnabled(statusNTPInitialized);
# if FEATURE_MQTT
if (validControllerIndex(firstEnabledMQTT_ControllerIndex())) {
addRowLabel(F("MQTT Client Connected"));
addEnabled(MQTTclient_connected);
}
# endif // if FEATURE_MQTT
}
# endif // ifndef WEBSERVER_SYSINFO_MINIMAL
# ifndef WEBSERVER_SYSINFO_MINIMAL
static void handle_sysinfo_ESP_Board() {
addTableSeparator(F("ESP Board"), 2, 3);
static const LabelType::Enum labels[] PROGMEM =
{
LabelType::ESP_CHIP_ID,
LabelType::ESP_CHIP_FREQ,
# ifdef ESP32
LabelType::ESP_CHIP_XTAL_FREQ,
LabelType::ESP_CHIP_APB_FREQ,
# endif // ifdef ESP32
LabelType::ESP_CHIP_MODEL,
# if defined(ESP32)
LabelType::ESP_CHIP_REVISION,
# endif // if defined(ESP32)
LabelType::ESP_CHIP_CORES,
LabelType::BOARD_NAME,
LabelType::MAX_LABEL
};
addRowLabelValues(labels);
# if defined(ESP32)
addRowLabel(F("ESP Chip Features"));
addHtml(getChipFeaturesString());
# endif // if defined(ESP32)
}
# endif // ifndef WEBSERVER_SYSINFO_MINIMAL
# ifndef WEBSERVER_SYSINFO_MINIMAL
static void handle_sysinfo_Storage() {
addTableSeparator(F("Storage"), 2, 3);
static const LabelType::Enum labels[] PROGMEM =
{
LabelType::FLASH_CHIP_ID,
LabelType::FLASH_CHIP_VENDOR,
LabelType::FLASH_CHIP_MODEL,
LabelType::FLASH_CHIP_REAL_SIZE,
LabelType::FLASH_IDE_SIZE,
LabelType::FLASH_CHIP_SPEED,
LabelType::FLASH_IDE_SPEED,
LabelType::FLASH_IDE_MODE,
LabelType::FLASH_WRITE_COUNT,
LabelType::SKETCH_SIZE,
LabelType::MAX_OTA_SKETCH_SIZE,
# ifdef ESP8266
LabelType::OTA_POSSIBLE,
LabelType::OTA_2STEP,
# endif // ifdef ESP8266
LabelType::FS_SIZE,
LabelType::FS_FREE,
LabelType::MAX_LABEL
};
addRowLabelValues(labels);
# ifndef LIMIT_BUILD_SIZE
addRowLabel(F("Page size"));
addHtmlInt(SpiffsPagesize());
# if FEATURE_TASKVALUE_UNIT_OF_MEASURE
addUnit(getFormUnit(LabelType::FREE_MEM)); // FIXME TD-er: Add labeltype
# endif
addRowLabel(F("Block size"));
addHtmlInt(SpiffsBlocksize());
# if FEATURE_TASKVALUE_UNIT_OF_MEASURE
addUnit(getFormUnit(LabelType::FREE_MEM)); // FIXME TD-er: Add labeltype
# endif
addRowLabel(F("Number of blocks"));
addHtmlInt(SpiffsTotalBytes() / SpiffsBlocksize());
{
# if defined(ESP8266)
fs::FSInfo fs_info;
ESPEASY_FS.info(fs_info);
addRowLabel(F("Maximum open files"));
addHtmlInt(fs_info.maxOpenFiles);
addRowLabel(F("Maximum path length"));
addHtmlInt(fs_info.maxPathLength);
# endif // if defined(ESP8266)
}
# endif // ifndef LIMIT_BUILD_SIZE
# if FEATURE_CHART_STORAGE_LAYOUT && !defined(BUILD_NO_DEBUG)
if (showSettingsFileLayout) {
addTableSeparator(F("Settings Files"), 2, 3);
html_TR_TD();
addHtml(F("Layout Settings File"));
html_TD();
getConfig_dat_file_layout();
html_TR_TD();
html_TD();
addHtml(F("(offset / size per item / index)"));
for (int st = 0; st < static_cast<int>(SettingsType::Enum::SettingsType_MAX); ++st) {
const SettingsType::Enum settingsType = static_cast<SettingsType::Enum>(st);
# if !FEATURE_NOTIFIER
if (settingsType == SettingsType::Enum::NotificationSettings_Type) {
continue;
}
# endif // if !FEATURE_NOTIFIER
html_TR_TD();
addHtml(SettingsType::getSettingsTypeString(settingsType));
html_BR();
addHtml(SettingsType::getSettingsFileName(settingsType));
html_TD();
getStorageTableSVG(settingsType);
delay(1);
}
}
# ifdef ESP32
addTableSeparator(F("Partitions"), 2, 3,
F("https://docs.espressif.com/projects/esp-idf/en/stable/esp32/api-guides/partition-tables.html"));
addRowLabel(F("Data Partition Table"));
// TXBuffer += getPartitionTableHeader(F(" - "), F("<BR>"));
// TXBuffer += getPartitionTable(ESP_PARTITION_TYPE_DATA, F(" - "), F("<BR>"));
getPartitionTableSVG(ESP_PARTITION_TYPE_DATA, 0x5856e6);
addRowLabel(F("App Partition Table"));
// TXBuffer += getPartitionTableHeader(F(" - "), F("<BR>"));
// TXBuffer += getPartitionTable(ESP_PARTITION_TYPE_APP , F(" - "), F("<BR>"));
getPartitionTableSVG(ESP_PARTITION_TYPE_APP, 0xab56e6);
# endif // ifdef ESP32
# ifdef ESP8266
addTableSeparator(F("Partitions"), 2, 3);
addRowLabel(F("Partition Table"));
getPartitionTableSVG();
# endif // ifdef ESP8266
# endif // if FEATURE_CHART_STORAGE_LAYOUT
# ifndef LIMIT_BUILD_SIZE
# if FEATURE_EEPROM_EXTERNAL
{
const bool eepromChecked = ESPEasy::eeprom::checkEEPROMEnabled() > 0;
if (eepromChecked) {
addFormSubHeader(F("External I2C EEPROM"));
addRowLabel(F("EEPROM Model/size"));
addHtml(getEEPROMName(static_cast<ESPEasy::eeprom::EEPROMExternal_Type_e>(Settings.EEPROMExternalType())));
addRowLabel(F("EEPROM Enabled"));
addEnabled(eepromChecked);
if (ESPEasy::eeprom::isEEPROMExternalWriteProtected()) {
addHtml(F(" Write-protected!"));
}
addRowLabel(F("'WriteEE' slots available"));
addHtmlInt(ESPEasy::eeprom::getEEPROMMaxSlots());
}
}
# endif // if FEATURE_EEPROM_EXTERNAL
# endif // ifndef LIMIT_BUILD_SIZE
}
# endif // ifndef WEBSERVER_SYSINFO_MINIMAL
void handle_sysinfo() {
# ifndef BUILD_NO_RAM_TRACKER
checkRAM(F("handle_sysinfo"));
# endif // ifndef BUILD_NO_RAM_TRACKER
if (!startStream_send_stdTemplate(MENU_INDEX_TOOLS)) { return; }
#ifdef WEBSERVER_GITHUB_COPY
# ifdef WEBSERVER_GITHUB_COPY
html_reset_copyTextCounter();
#endif
# endif
addHtml(printWebString);
addHtml(F("<form>"));
@@ -298,455 +749,6 @@ void handle_sysinfo() {
sendTail_stdtemplate();
}
void handle_sysinfo_basicInfo() {
static const LabelType::Enum labels[] PROGMEM =
{
#if FEATURE_MDNS
LabelType::M_DNS,
#endif
LabelType::UNIT_NR,
LabelType::LOCAL_TIME,
# if FEATURE_EXT_RTC
LabelType::EXT_RTC_UTC_TIME,
# endif // if FEATURE_EXT_RTC
LabelType::TIME_SOURCE,
LabelType::TIME_WANDER,
LabelType::UPTIME,
LabelType::LOAD_PCT,
# if FEATURE_INTERNAL_TEMPERATURE
LabelType::INTERNAL_TEMPERATURE,
# endif
LabelType::CPU_ECO_MODE,
LabelType::RESET_REASON,
LabelType::LAST_TASK_BEFORE_REBOOT,
LabelType::SW_WD_COUNT,
LabelType::BOOT_TYPE,
LabelType::MAX_LABEL
};
addRowLabelValues(labels);
}
# ifndef WEBSERVER_SYSINFO_MINIMAL
void handle_sysinfo_memory() {
addTableSeparator(F("Memory"), 2, 3);
static const LabelType::Enum labels[] PROGMEM =
{
# ifdef ESP32
LabelType::HEAP_SIZE,
LabelType::HEAP_MIN_FREE,
# endif // ifdef ESP32
LabelType::FREE_MEM,
# if defined(CORE_POST_2_5_0) || defined(ESP32)
# ifndef LIMIT_BUILD_SIZE
LabelType::HEAP_MAX_FREE_BLOCK,
# endif // ifndef LIMIT_BUILD_SIZE
# endif // if defined(CORE_POST_2_5_0) || defined(ESP32)
# if defined(CORE_POST_2_5_0)
# ifndef LIMIT_BUILD_SIZE
LabelType::HEAP_FRAGMENTATION,
# endif // ifndef LIMIT_BUILD_SIZE
# ifdef USE_SECOND_HEAP
LabelType::FREE_HEAP_IRAM,
# endif
# endif // if defined(CORE_POST_2_5_0)
LabelType::FREE_STACK,
# if defined(ESP32) && defined(BOARD_HAS_PSRAM)
LabelType::PSRAM_SIZE,
LabelType::PSRAM_FREE,
LabelType::PSRAM_MIN_FREE,
LabelType::PSRAM_MAX_FREE_BLOCK,
# endif // if defined(ESP32) && defined(BOARD_HAS_PSRAM)
LabelType::MAX_LABEL
};
addRowLabelValues(labels);
}
# endif // ifndef WEBSERVER_SYSINFO_MINIMAL
void handle_sysinfo_Network() {
addTableSeparator(F("Network"), 2, 3);
{
static const LabelType::Enum labels[] PROGMEM =
{
# if FEATURE_ETHERNET || defined(USES_ESPEASY_NOW)
LabelType::ETH_WIFI_MODE,
# endif
LabelType::IP_CONFIG,
LabelType::IP_ADDRESS_SUBNET,
# if FEATURE_USE_IPV6
LabelType::IP6_LOCAL,
LabelType::IP6_GLOBAL,
// LabelType::IP6_ALL_ADDRESSES,
# endif // if FEATURE_USE_IPV6
LabelType::GATEWAY,
LabelType::CLIENT_IP,
LabelType::DNS,
LabelType::ALLOWED_IP_RANGE,
LabelType::CONNECTED,
LabelType::NUMBER_RECONNECTS,
LabelType::MAX_LABEL
};
addRowLabelValues(labels);
}
}
void handle_sysinfo_NetworkAdapters() {
#ifndef LIMIT_BUILD_SIZE
for (ESPEasy::net::networkIndex_t x = 0; x < NETWORK_MAX; ++x)
{
if (Settings.getNetworkEnabled(x)) {
auto pluginID = Settings.getNWPluginID_for_network(x);
if (pluginID != ESPEasy::net::INVALID_NW_PLUGIN_ID) {
KeyValueWriter_WebForm writer(
strformat(F("%s (%d)"),
getNWPluginNameFromNWPluginID(pluginID).c_str(),
x + 1));
# ifdef WEBSERVER_NETWORK
# ifdef ESP32
ESPEasy::net::write_NetworkAdapterFlags(x, &writer);
ESPEasy::net::write_IP_config(x, &writer);
# endif // ifdef ESP32
# endif // ifdef WEBSERVER_NETWORK
ESPEasy::net::write_NetworkConnectionInfo(x, &writer);
}
}
}
#endif
html_TR();
}
# ifndef WEBSERVER_SYSINFO_MINIMAL
void handle_sysinfo_WiFiSettings() {
if (!ESPEasy::net::wifi::WiFiConnected()) return;
addTableSeparator(F("WiFi Settings"), 2, 3);
static const LabelType::Enum labels[] PROGMEM =
{
LabelType::FORCE_WIFI_BG,
LabelType::RESTART_WIFI_LOST_CONN,
LabelType::FORCE_WIFI_NOSLEEP,
# ifdef SUPPORT_ARP
LabelType::PERIODICAL_GRAT_ARP,
# endif // ifdef SUPPORT_ARP
LabelType::CONNECTION_FAIL_THRESH,
# if FEATURE_SET_WIFI_TX_PWR
LabelType::WIFI_TX_MAX_PWR,
LabelType::WIFI_CUR_TX_PWR,
LabelType::WIFI_SENS_MARGIN,
LabelType::WIFI_SEND_AT_MAX_TX_PWR,
# endif // if FEATURE_SET_WIFI_TX_PWR
LabelType::WIFI_NR_RECONNECT_ATTEMPTS,
LabelType::WIFI_MAX_UPTIME_AUTO_START_AP,
LabelType::WIFI_AP_MINIMAL_ON_TIME,
# ifdef USES_ESPEASY_NOW
LabelType::USE_ESPEASY_NOW,
LabelType::FORCE_ESPEASY_NOW_CHANNEL,
# endif // ifdef USES_ESPEASY_NOW
LabelType::WIFI_USE_LAST_CONN_FROM_RTC,
# ifndef ESP32
LabelType::WAIT_WIFI_CONNECT,
# endif
# ifdef ESP32
LabelType::WIFI_PASSIVE_SCAN,
# endif
LabelType::HIDDEN_SSID_SLOW_CONNECT,
LabelType::CONNECT_HIDDEN_SSID,
LabelType::SDK_WIFI_AUTORECONNECT,
# if FEATURE_USE_IPV6
LabelType::ENABLE_IPV6,
# endif
LabelType::MAX_LABEL
};
addRowLabelValues(labels);
}
# endif // ifndef WEBSERVER_SYSINFO_MINIMAL
void handle_sysinfo_Firmware() {
addTableSeparator(F("Firmware"), 2, 3);
static const LabelType::Enum labels[] PROGMEM =
{
LabelType::BUILD_DESC,
LabelType::SYSTEM_LIBRARIES,
# ifdef ESP32
LabelType::ESP_IDF_SDK_VERSION,
# endif
LabelType::GIT_BUILD,
LabelType::PLUGIN_COUNT,
LabelType::PLUGIN_DESCRIPTION,
LabelType::BUILD_ORIGIN,
LabelType::BUILD_TIME,
LabelType::BINARY_FILENAME,
LabelType::BUILD_PLATFORM,
LabelType::GIT_HEAD,
# ifdef CONFIGURATION_CODE
LabelType::CONFIGURATION_CODE_LBL,
# endif // ifdef CONFIGURATION_CODE
LabelType::MAX_LABEL
};
addRowLabelValues(labels);
}
# ifndef WEBSERVER_SYSINFO_MINIMAL
void handle_sysinfo_SystemStatus() {
addTableSeparator(F("System Status"), 2, 3);
static const LabelType::Enum labels[] PROGMEM =
{
// Actual Loglevel
#if FEATURE_SYSLOG
LabelType::SYSLOG_LOG_LEVEL,
#endif
LabelType::SERIAL_LOG_LEVEL,
# ifdef WEBSERVER_LOG
LabelType::WEB_LOG_LEVEL,
#endif
# if FEATURE_SD
LabelType::SD_LOG_LEVEL,
# endif // if FEATURE_SD
LabelType::ENABLE_SERIAL_PORT_CONSOLE,
LabelType::CONSOLE_SERIAL_PORT,
# if USES_ESPEASY_CONSOLE_FALLBACK_PORT
LabelType::CONSOLE_FALLBACK_TO_SERIAL0,
LabelType::CONSOLE_FALLBACK_PORT,
# endif // if USES_ESPEASY_CONSOLE_FALLBACK_PORT
# if FEATURE_CLEAR_I2C_STUCK
LabelType::I2C_BUS_STATE,
LabelType::I2C_BUS_CLEARED_COUNT,
# endif // if FEATURE_CLEAR_I2C_STUCK
LabelType::MAX_LABEL
};
addRowLabelValues(labels);
}
# endif // ifndef WEBSERVER_SYSINFO_MINIMAL
# ifndef WEBSERVER_SYSINFO_MINIMAL
void handle_sysinfo_NetworkServices() {
addTableSeparator(F("Network Services"), 2, 3);
addRowLabel(F("Network Connected"));
addEnabled(ESPEasy::net::NetworkConnected());
addRowLabel(F("NTP Initialized"));
addEnabled(statusNTPInitialized);
# if FEATURE_MQTT
if (validControllerIndex(firstEnabledMQTT_ControllerIndex())) {
addRowLabel(F("MQTT Client Connected"));
addEnabled(MQTTclient_connected);
}
# endif // if FEATURE_MQTT
}
# endif // ifndef WEBSERVER_SYSINFO_MINIMAL
# ifndef WEBSERVER_SYSINFO_MINIMAL
void handle_sysinfo_ESP_Board() {
addTableSeparator(F("ESP Board"), 2, 3);
static const LabelType::Enum labels[] PROGMEM =
{
LabelType::ESP_CHIP_ID,
LabelType::ESP_CHIP_FREQ,
# ifdef ESP32
LabelType::ESP_CHIP_XTAL_FREQ,
LabelType::ESP_CHIP_APB_FREQ,
# endif // ifdef ESP32
LabelType::ESP_CHIP_MODEL,
# if defined(ESP32)
LabelType::ESP_CHIP_REVISION,
# endif // if defined(ESP32)
LabelType::ESP_CHIP_CORES,
LabelType::BOARD_NAME,
LabelType::MAX_LABEL
};
addRowLabelValues(labels);
# if defined(ESP32)
addRowLabel(F("ESP Chip Features"));
addHtml(getChipFeaturesString());
# endif // if defined(ESP32)
}
# endif // ifndef WEBSERVER_SYSINFO_MINIMAL
# ifndef WEBSERVER_SYSINFO_MINIMAL
void handle_sysinfo_Storage() {
addTableSeparator(F("Storage"), 2, 3);
static const LabelType::Enum labels[] PROGMEM =
{
LabelType::FLASH_CHIP_ID,
LabelType::FLASH_CHIP_VENDOR,
LabelType::FLASH_CHIP_MODEL,
LabelType::FLASH_CHIP_REAL_SIZE,
LabelType::FLASH_IDE_SIZE,
LabelType::FLASH_CHIP_SPEED,
LabelType::FLASH_IDE_SPEED,
LabelType::FLASH_IDE_MODE,
LabelType::FLASH_WRITE_COUNT,
LabelType::SKETCH_SIZE,
LabelType::MAX_OTA_SKETCH_SIZE,
# ifdef ESP8266
LabelType::OTA_POSSIBLE,
LabelType::OTA_2STEP,
# endif // ifdef ESP8266
LabelType::FS_SIZE,
LabelType::FS_FREE,
LabelType::MAX_LABEL
};
addRowLabelValues(labels);
# ifndef LIMIT_BUILD_SIZE
addRowLabel(F("Page size"));
addHtmlInt(SpiffsPagesize());
#if FEATURE_TASKVALUE_UNIT_OF_MEASURE
addUnit(getFormUnit(LabelType::FREE_MEM)); // FIXME TD-er: Add labeltype
#endif
addRowLabel(F("Block size"));
addHtmlInt(SpiffsBlocksize());
#if FEATURE_TASKVALUE_UNIT_OF_MEASURE
addUnit(getFormUnit(LabelType::FREE_MEM)); // FIXME TD-er: Add labeltype
#endif
addRowLabel(F("Number of blocks"));
addHtmlInt(SpiffsTotalBytes() / SpiffsBlocksize());
{
# if defined(ESP8266)
fs::FSInfo fs_info;
ESPEASY_FS.info(fs_info);
addRowLabel(F("Maximum open files"));
addHtmlInt(fs_info.maxOpenFiles);
addRowLabel(F("Maximum path length"));
addHtmlInt(fs_info.maxPathLength);
# endif // if defined(ESP8266)
}
# endif // ifndef LIMIT_BUILD_SIZE
#if FEATURE_CHART_STORAGE_LAYOUT && !defined(BUILD_NO_DEBUG)
if (showSettingsFileLayout) {
addTableSeparator(F("Settings Files"), 2, 3);
html_TR_TD();
addHtml(F("Layout Settings File"));
html_TD();
getConfig_dat_file_layout();
html_TR_TD();
html_TD();
addHtml(F("(offset / size per item / index)"));
for (int st = 0; st < static_cast<int>(SettingsType::Enum::SettingsType_MAX); ++st) {
const SettingsType::Enum settingsType = static_cast<SettingsType::Enum>(st);
# if !FEATURE_NOTIFIER
if (settingsType == SettingsType::Enum::NotificationSettings_Type) {
continue;
}
# endif // if !FEATURE_NOTIFIER
html_TR_TD();
addHtml(SettingsType::getSettingsTypeString(settingsType));
html_BR();
addHtml(SettingsType::getSettingsFileName(settingsType));
html_TD();
getStorageTableSVG(settingsType);
delay(1);
}
}
# ifdef ESP32
addTableSeparator(F("Partitions"), 2, 3,
F("https://docs.espressif.com/projects/esp-idf/en/stable/esp32/api-guides/partition-tables.html"));
addRowLabel(F("Data Partition Table"));
// TXBuffer += getPartitionTableHeader(F(" - "), F("<BR>"));
// TXBuffer += getPartitionTable(ESP_PARTITION_TYPE_DATA, F(" - "), F("<BR>"));
getPartitionTableSVG(ESP_PARTITION_TYPE_DATA, 0x5856e6);
addRowLabel(F("App Partition Table"));
// TXBuffer += getPartitionTableHeader(F(" - "), F("<BR>"));
// TXBuffer += getPartitionTable(ESP_PARTITION_TYPE_APP , F(" - "), F("<BR>"));
getPartitionTableSVG(ESP_PARTITION_TYPE_APP, 0xab56e6);
# endif // ifdef ESP32
# ifdef ESP8266
addTableSeparator(F("Partitions"), 2, 3);
addRowLabel(F("Partition Table"));
getPartitionTableSVG();
# endif // ifdef ESP8266
# endif // if FEATURE_CHART_STORAGE_LAYOUT
#ifndef LIMIT_BUILD_SIZE
#if FEATURE_EEPROM_EXTERNAL
{
const bool eepromChecked = ESPEasy::eeprom::checkEEPROMEnabled() > 0;
if (eepromChecked) {
addFormSubHeader(F("External I2C EEPROM"));
addRowLabel(F("EEPROM Model/size"));
addHtml(getEEPROMName(static_cast<ESPEasy::eeprom::EEPROMExternal_Type_e>(Settings.EEPROMExternalType())));
addRowLabel(F("EEPROM Enabled"));
addEnabled(eepromChecked);
if (ESPEasy::eeprom::isEEPROMExternalWriteProtected()) {
addHtml(F(" Write-protected!"));
}
addRowLabel(F("'WriteEE' slots available"));
addHtmlInt(ESPEasy::eeprom::getEEPROMMaxSlots());
}
}
#endif // if FEATURE_EEPROM_EXTERNAL
#endif // ifndef LIMIT_BUILD_SIZE
}
# endif // ifndef WEBSERVER_SYSINFO_MINIMAL
# endif // ifdef WEBSERVER_SYSINFO
+4 -28
View File
@@ -1,5 +1,4 @@
#ifndef WEBSERVER_WEBSERVER_SYSINFOPAGE_H
#define WEBSERVER_WEBSERVER_SYSINFOPAGE_H
#pragma once
#include "../WebServer/common.h"
@@ -11,40 +10,17 @@
// ********************************************************************************
void handle_sysinfo_json();
#endif
#endif // if SHOW_SYSINFO_JSON
#ifdef WEBSERVER_SYSINFO
void handle_sysinfo();
void handle_sysinfo_basicInfo();
#ifndef WEBSERVER_SYSINFO_MINIMAL
void handle_sysinfo_memory();
#endif
void handle_sysinfo_Network();
void handle_sysinfo_NetworkAdapters();
#ifndef WEBSERVER_SYSINFO_MINIMAL
void handle_sysinfo_WiFiSettings();
#endif
void handle_sysinfo_Firmware();
#ifndef WEBSERVER_SYSINFO_MINIMAL
void handle_sysinfo_SystemStatus();
# ifndef WEBSERVER_SYSINFO_MINIMAL
void handle_sysinfo_NetworkServices();
void handle_sysinfo_ESP_Board();
void handle_sysinfo_Storage();
#endif
# endif
#endif // ifdef WEBSERVER_SYSINFO
#endif
+49 -47
View File
@@ -26,11 +26,58 @@
// ********************************************************************************
// Web Interface sysvars showing all system vars and their value.
// ********************************************************************************
void addSysVar_enum_html(SystemVariables::Enum enumval) {
static void addSysVar_html(String input, bool isSpecialChar) {
// Make deepcopy for replacement, so parameter is a copy, not a const reference
html_TR_TD();
addHtml_pre(input);
if (isSpecialChar) {
parseSpecialCharacters(input, false);
html_TD();
addHtml(input);
html_TD();
addHtml(URLEncode(input));
} else {
const String orig_input(input);
for (int i = 0; i < 2; ++i) {
const bool URLencoded = i == 1;
if (URLencoded) {
input = orig_input;
}
parseSystemVariables(input, URLencoded);
parseStandardConversions(input, URLencoded);
# if FEATURE_STRING_VARIABLES
input = parseTemplate_padded(input, 0, URLencoded);
# endif // if FEATURE_STRING_VARIABLES
html_TD();
addHtml(input);
}
}
delay(0);
}
static void addSysVar_html(const __FlashStringHelper *input) {
addSysVar_html(String(input), false);
}
static void addSysVar_html_specialChar(const __FlashStringHelper *input) {
addSysVar_html(String(input), true);
}
static void addSysVar_html(const String& input) {
addSysVar_html(input, false);
}
static void addSysVar_enum_html(SystemVariables::Enum enumval) {
addSysVar_html(SystemVariables::toString(enumval), false);
}
void addSysVar_enum_html(const SystemVariables::Enum enumval[], size_t nrElements) {
static void addSysVar_enum_html(const SystemVariables::Enum enumval[], size_t nrElements) {
for (size_t i = 0; i < nrElements; ++i) {
addSysVar_enum_html(enumval[i]);
}
@@ -546,51 +593,6 @@ void handle_sysvars() {
sendTail_stdtemplate();
}
void addSysVar_html(const __FlashStringHelper *input) {
addSysVar_html(String(input), false);
}
void addSysVar_html_specialChar(const __FlashStringHelper *input) {
addSysVar_html(String(input), true);
}
void addSysVar_html(const String& input) {
addSysVar_html(input, false);
}
void addSysVar_html(String input, bool isSpecialChar) {
// Make deepcopy for replacement, so parameter is a copy, not a const reference
html_TR_TD();
addHtml_pre(input);
if (isSpecialChar) {
parseSpecialCharacters(input, false);
html_TD();
addHtml(input);
html_TD();
addHtml(URLEncode(input));
} else {
const String orig_input(input);
for (int i = 0; i < 2; ++i) {
const bool URLencoded = i == 1;
if (URLencoded) {
input = orig_input;
}
parseSystemVariables(input, URLencoded);
parseStandardConversions(input, URLencoded);
# if FEATURE_STRING_VARIABLES
input = parseTemplate_padded(input, 0, URLencoded);
# endif // if FEATURE_STRING_VARIABLES
html_TD();
addHtml(input);
}
}
delay(0);
}
#endif // WEBSERVER_SYSVARS
-5
View File
@@ -11,11 +11,6 @@
// ********************************************************************************
void handle_sysvars();
void addSysVar_html(const __FlashStringHelper * input);
void addSysVar_html_specialChar(const __FlashStringHelper * input);
void addSysVar_html(const String& input);
void addSysVar_html(String input, bool isSpecialChar);
#endif // WEBSERVER_SYSVARS
+48 -46
View File
@@ -13,55 +13,12 @@
#define TIMING_STATS_THRESHOLD 100000
void handle_timingstats() {
#ifndef BUILD_NO_RAM_TRACKER
checkRAM(F("handle_timingstats"));
#endif
startStream_send_stdTemplate_NoLoginCheck(MENU_INDEX_TOOLS);
html_table_class_multirow();
html_TR();
{
const __FlashStringHelper * headers[] = {
F("Description"),
F("Function"),
F("#calls"),
F("call/sec"),
F("duty (%)"),
F("min (ms)"),
F("Avg (ms)"),
F("max (ms)")};
for (unsigned int i = 0; i < NR_ELEMENTS(headers); ++i) {
html_table_header(headers[i]);
}
}
const int32_t timeSinceLastReset = stream_timing_statistics(true);
html_end_table();
html_table_class_normal();
const float timespan = timeSinceLastReset / 1000.0f;
addFormHeader(F("Statistics"));
addRowLabel(F("Start Period"));
struct tm startPeriod = node_time.addSeconds(node_time.local_tm, -1.0f * timespan, true, true);
addHtml(formatDateTimeString(startPeriod, '-', ':', ' ', false));
addRowLabelValue(LabelType::LOCAL_TIME, false);
addRowLabel(F("Time span"));
addHtmlFloat(timespan);
addHtml(F(" sec"));
addRowLabel(F("*"));
addHtml(F("Duty cycle based on average < 1 msec is highly unreliable"));
html_end_table();
sendTail_stdtemplate();
}
// ********************************************************************************
// HTML table formatted timing statistics
// ********************************************************************************
void format_using_threshhold(uint32_t value) {
static void format_using_threshhold(uint32_t value) {
float value_msec = value / 1000.0f;
if (value > TIMING_STATS_THRESHOLD) {
@@ -71,7 +28,7 @@ void format_using_threshhold(uint32_t value) {
}
}
void stream_html_timing_stats(const TimingStats& stats, int32_t timeSinceLastReset) {
static void stream_html_timing_stats(const TimingStats& stats, int32_t timeSinceLastReset) {
uint32_t minVal, maxVal;
const uint32_t c = stats.getMinMax(minVal, maxVal);
@@ -105,7 +62,7 @@ void stream_html_timing_stats(const TimingStats& stats, int32_t timeSinceLastRes
format_using_threshhold(maxVal);
}
int32_t stream_timing_statistics(bool clearStats) {
static int32_t stream_timing_statistics(bool clearStats) {
const int32_t timeSinceLastReset = timePassedSince(timingstats_last_reset);
for (auto& x: pluginStats) {
@@ -173,4 +130,49 @@ int32_t stream_timing_statistics(bool clearStats) {
return timeSinceLastReset;
}
void handle_timingstats() {
#ifndef BUILD_NO_RAM_TRACKER
checkRAM(F("handle_timingstats"));
#endif
startStream_send_stdTemplate_NoLoginCheck(MENU_INDEX_TOOLS);
html_table_class_multirow();
html_TR();
{
const __FlashStringHelper * headers[] = {
F("Description"),
F("Function"),
F("#calls"),
F("call/sec"),
F("duty (%)"),
F("min (ms)"),
F("Avg (ms)"),
F("max (ms)")};
for (unsigned int i = 0; i < NR_ELEMENTS(headers); ++i) {
html_table_header(headers[i]);
}
}
const int32_t timeSinceLastReset = stream_timing_statistics(true);
html_end_table();
html_table_class_normal();
const float timespan = timeSinceLastReset / 1000.0f;
addFormHeader(F("Statistics"));
addRowLabel(F("Start Period"));
struct tm startPeriod = node_time.addSeconds(node_time.local_tm, -1.0f * timespan, true, true);
addHtml(formatDateTimeString(startPeriod, '-', ':', ' ', false));
addRowLabelValue(LabelType::LOCAL_TIME, false);
addRowLabel(F("Time span"));
addHtmlFloat(timespan);
addHtml(F(" sec"));
addRowLabel(F("*"));
addHtml(F("Duty cycle based on average < 1 msec is highly unreliable"));
html_end_table();
sendTail_stdtemplate();
}
#endif // WEBSERVER_TIMINGSTATS
-9
View File
@@ -9,15 +9,6 @@
void handle_timingstats();
// ********************************************************************************
// HTML table formatted timing statistics
// ********************************************************************************
void format_using_threshhold(uint32_t value);
void stream_html_timing_stats(const TimingStats& stats, int32_t timeSinceLastReset);
int32_t stream_timing_statistics(bool clearStats);
#endif
+50 -47
View File
@@ -2,19 +2,39 @@
#ifdef WEBSERVER_TOOLS
#include "../WebServer/ESPEasy_WebServer.h"
#include "../WebServer/HTML_wrappers.h"
#include "../WebServer/Markup.h"
#include "../WebServer/Markup_Buttons.h"
#include "../WebServer/Markup_Forms.h"
# include "../WebServer/ESPEasy_WebServer.h"
# include "../WebServer/HTML_wrappers.h"
# include "../WebServer/Markup.h"
# include "../WebServer/Markup_Buttons.h"
# include "../WebServer/Markup_Forms.h"
#include "../Helpers/OTA.h"
#include "../Helpers/StringConverter.h"
# include "../Helpers/OTA.h"
# include "../Helpers/StringConverter.h"
#include "../../ESPEasy-Globals.h"
# include "../../ESPEasy-Globals.h"
# include "../Helpers/WebServer_commandHelper.h"
static void addWideButtonPlusDescription(const __FlashStringHelper *url,
const __FlashStringHelper *buttonText,
const __FlashStringHelper *description)
{
html_TR_TD_height(30);
addWideButton(url, buttonText);
html_TD();
addHtml(description);
}
/*
static void addWideButtonPlusDescription(const String& url, const String& buttonText, const String& description)
{
html_TR_TD_height(30);
addWideButton(url, buttonText);
html_TD();
addHtml(description);
}
*/
// ********************************************************************************
// Web Interface Tools page
// ********************************************************************************
@@ -44,6 +64,7 @@ void handle_tools() {
html_TR_TD();
addSubmitButton();
// addHelpButton(F("ESPEasy_Command_Reference")); // Old documentation is just that: Old and out-dated.
addRTDHelpButton(F("Reference/Command.html"));
html_TR_TD();
@@ -63,16 +84,16 @@ void handle_tools() {
# endif // ifdef WEBSERVER_SYSINFO
# ifdef WEBSERVER_ADVANCED
addWideButtonPlusDescription(F("advanced"), F("Advanced"), F("Open advanced settings"));
addWideButtonPlusDescription(F("advanced"), F("Advanced"), F("Open advanced settings"));
# endif // ifdef WEBSERVER_ADVANCED
# ifdef WEBSERVER_JSON
addWideButtonPlusDescription(F("json"), F("Show JSON"), F("Open JSON output"));
addWideButtonPlusDescription(F("json"), F("Show JSON"), F("Open JSON output"));
# endif
# ifdef WEBSERVER_METRICS
addWideButtonPlusDescription(F("metrics"), F("Show Metrics"), F("Open Prometheus Metrics"));
# endif //ifdef WEBSERVER_METRICS
addWideButtonPlusDescription(F("metrics"), F("Show Metrics"), F("Open Prometheus Metrics"));
# endif // ifdef WEBSERVER_METRICS
# ifdef WEBSERVER_TIMINGSTATS
addWideButtonPlusDescription(F("timingstats"), F("Timing stats"), F("Open timing statistics of system"));
@@ -86,13 +107,15 @@ void handle_tools() {
addWideButtonPlusDescription(F("sysvars"), F("System Variables"), F("Show all system variables and conversions"));
# endif // ifdef WEBSERVER_SYSVARS
#if FEATURE_EEPROM_EXTERNAL || FEATURE_RTC_SRAM_STORAGE
addWideButtonPlusDescription(F("eepromvars"), F("External EEPROM/RTC values"), F("Show all values stored in the external EEPROM or RTC SRAM"));
#endif // if FEATURE_EEPROM_EXTERNAL || FEATURE_RTC_SRAM_STORAGE
# if FEATURE_EEPROM_EXTERNAL || FEATURE_RTC_SRAM_STORAGE
addWideButtonPlusDescription(F("eepromvars"),
F("External EEPROM/RTC values"),
F("Show all values stored in the external EEPROM or RTC SRAM"));
# endif // if FEATURE_EEPROM_EXTERNAL || FEATURE_RTC_SRAM_STORAGE
#if FEATURE_PLUGIN_LIST
# if FEATURE_PLUGIN_LIST
addWideButtonPlusDescription(F("pluginlist"), F("Included Plugins"), F("Show all plugins that are included in this build"));
#endif // if FEATURE_PLUGIN_LIST
# endif // if FEATURE_PLUGIN_LIST
addFormSubHeader(F("Wifi"));
@@ -100,10 +123,10 @@ void handle_tools() {
addWideButtonPlusDescription(F("/?cmd=wifidisconnect"), F("Disconnect"), F("Disconnect from wifi network"));
# ifdef WEBSERVER_SETUP
addWideButtonPlusDescription(F("setup"), F("Setup WiFi"), F("WiFi setup page"));
#endif // ifdef WEBSERVER_SETUP
# endif // ifdef WEBSERVER_SETUP
# ifdef WEBSERVER_WIFI_SCANNER
addWideButtonPlusDescription(F("wifiscanner"), F("Scan"), F("Scan for wifi networks"));
addWideButtonPlusDescription(F("wifiscanner"), F("Scan"), F("Scan for wifi networks"));
# endif // ifdef WEBSERVER_WIFI_SCANNER
# ifdef WEBSERVER_I2C_SCANNER
@@ -116,9 +139,9 @@ void handle_tools() {
addWideButtonPlusDescription(F("upload"), F("Load"), F("Loads a settings file"));
addFormNote(F("(File MUST be renamed to \"config.dat\" before upload!"
#if FEATURE_TARSTREAM_SUPPORT
# if FEATURE_TARSTREAM_SUPPORT
" Or a .tar file containing \"config.dat\" and other files can be uploaded"
#endif // if FEATURE_TARSTREAM_SUPPORT
# endif // if FEATURE_TARSTREAM_SUPPORT
")"));
addWideButtonPlusDescription(F("download"), F("Save"),
# if FEATURE_TARSTREAM_SUPPORT
@@ -127,10 +150,11 @@ void handle_tools() {
F("Saves a settings file")
# endif // if FEATURE_TARSTREAM_SUPPORT
);
#if FEATURE_TARSTREAM_SUPPORT
addWideButtonPlusDescription(F("backup"), F("Backup files"), F("Save all files as a .tar archive"));
addWideButtonPlusDescription(F("backupnup"), F("Backup w/o credentials"), F("Save all files as a .tar archive but exclude usernames & passwords"));
#endif // if FEATURE_TARSTREAM_SUPPORT
# if FEATURE_TARSTREAM_SUPPORT
addWideButtonPlusDescription(F("backup"), F("Backup files"), F("Save all files as a .tar archive"));
addWideButtonPlusDescription(F("backupnup"), F("Backup w/o credentials"),
F("Save all files as a .tar archive but exclude usernames & passwords"));
# endif // if FEATURE_TARSTREAM_SUPPORT
# ifdef WEBSERVER_NEW_UI
# if defined(ESP8266)
@@ -201,28 +225,7 @@ void handle_tools() {
// FIXME TD-er: Is this still needed?
free_string(printWebString);
printToWeb = false;
}
// ********************************************************************************
// Web Interface debug page
// ********************************************************************************
void addWideButtonPlusDescription(const __FlashStringHelper * url,
const __FlashStringHelper * buttonText,
const __FlashStringHelper * description)
{
html_TR_TD_height(30);
addWideButton(url, buttonText);
html_TD();
addHtml(description);
}
void addWideButtonPlusDescription(const String& url, const String& buttonText, const String& description)
{
html_TR_TD_height(30);
addWideButton(url, buttonText);
html_TD();
addHtml(description);
printToWeb = false;
}
#endif // ifdef WEBSERVER_TOOLS
+1 -17
View File
@@ -1,28 +1,12 @@
#ifndef WEBSERVER_WEBSERVER_TOOLSPAGE_H
#define WEBSERVER_WEBSERVER_TOOLSPAGE_H
#pragma once
#include "../WebServer/common.h"
#ifdef WEBSERVER_TOOLS
// ********************************************************************************
// Web Interface Tools page
// ********************************************************************************
void handle_tools();
// ********************************************************************************
// Web Interface debug page
// ********************************************************************************
void addWideButtonPlusDescription(const __FlashStringHelper * url,
const __FlashStringHelper * buttonText,
const __FlashStringHelper * description);
void addWideButtonPlusDescription(const String& url,
const String& buttonText,
const String& description);
#endif // ifdef WEBSERVER_TOOLS
#endif // ifndef WEBSERVER_WEBSERVER_TOOLSPAGE_H
+20 -17
View File
@@ -107,24 +107,8 @@ fs::File uploadFile;
# if FEATURE_TARSTREAM_SUPPORT
TarStream *tarStream = nullptr;
# endif // if FEATURE_TARSTREAM_SUPPORT
void handleFileUpload() {
# ifndef BUILD_NO_RAM_TRACKER
checkRAM(F("handleFileUpload"));
# endif // ifndef BUILD_NO_RAM_TRACKER
handleFileUploadBase(false);
}
# if FEATURE_SD
void handleSDFileUpload() {
# ifndef BUILD_NO_RAM_TRACKER
checkRAM(F("handleSDFileUpload"));
# endif // ifndef BUILD_NO_RAM_TRACKER
handleFileUploadBase(true);
}
# endif // if FEATURE_SD
void handleFileUploadBase(bool toSDcard) {
static void handleFileUploadBase(bool toSDcard) {
if (!isLoggedIn()) { return; }
static boolean valid = false;
@@ -254,4 +238,23 @@ void handleFileUploadBase(bool toSDcard) {
}
}
void handleFileUpload() {
# ifndef BUILD_NO_RAM_TRACKER
checkRAM(F("handleFileUpload"));
# endif // ifndef BUILD_NO_RAM_TRACKER
handleFileUploadBase(false);
}
# if FEATURE_SD
void handleSDFileUpload() {
# ifndef BUILD_NO_RAM_TRACKER
checkRAM(F("handleSDFileUpload"));
# endif // ifndef BUILD_NO_RAM_TRACKER
handleFileUploadBase(true);
}
# endif // if FEATURE_SD
#endif // ifdef WEBSERVER_UPLOAD
+2 -6
View File
@@ -1,5 +1,4 @@
#ifndef WEBSERVER_WEBSERVER_UPLOADPAGE_H
#define WEBSERVER_WEBSERVER_UPLOADPAGE_H
#pragma once
#include "../WebServer/common.h"
@@ -40,7 +39,4 @@ void handleFileUpload();
# if FEATURE_SD
void handleSDFileUpload();
# endif // if FEATURE_SD
void handleFileUploadBase(bool toSDcard);
#endif // ifdef WEBSERVER_UPLOAD
#endif // ifndef WEBSERVER_WEBSERVER_UPLOADPAGE_H
#endif // ifdef WEBSERVER_UPLOAD
+3 -3
View File
@@ -140,7 +140,7 @@ const __FlashStringHelper* getGpMenuIcon(uint8_t index) {
return F("");
}
const __FlashStringHelper* getGpMenuLabel(uint8_t index) {
static const __FlashStringHelper* getGpMenuLabel(uint8_t index) {
switch (index) {
case MENU_INDEX_MAIN: return F("Main");
case MENU_INDEX_CONFIG: return F("Config");
@@ -177,7 +177,7 @@ const __FlashStringHelper* getGpMenuLabel(uint8_t index) {
return F("");
}
const __FlashStringHelper* getGpMenuURL(uint8_t index) {
static const __FlashStringHelper* getGpMenuURL(uint8_t index) {
switch (index) {
case MENU_INDEX_MAIN: return F("/");
case MENU_INDEX_CONFIG: return F("/config");
@@ -211,7 +211,7 @@ const __FlashStringHelper* getGpMenuURL(uint8_t index) {
return F("");
}
bool GpMenuVisible(uint8_t index) {
static bool GpMenuVisible(uint8_t index) {
switch (index) {
case MENU_INDEX_MAIN: return MENU_INDEX_MAIN_VISIBLE;
case MENU_INDEX_CONFIG: return MENU_INDEX_CONFIG_VISIBLE;
-1
View File
@@ -38,7 +38,6 @@ extern uint8_t navMenuIndex;
bool isGpMenuSecondLevel(uint8_t index);
const __FlashStringHelper* getGpMenuIcon(uint8_t index);
const __FlashStringHelper* getGpMenuLabel(uint8_t index);
class WebTemplateParser {
public: