and elements introduced. Since this section will be added at the end of the body,
* it is also possible to override the style of the elements already present:
-* for example the background color of body will be ovverrided with a different color
+* for example the background color of body will be overridden with a different color
*/
static const char custom_css[] PROGMEM = R"EOF(
pre{
diff --git a/examples/customHTML/customHTML.ino b/examples/customHTML/customHTML.ino
index 46076502..fb73cf58 100644
--- a/examples/customHTML/customHTML.ino
+++ b/examples/customHTML/customHTML.ino
@@ -22,7 +22,7 @@ uint32_t longVar = 1234567890;
float floatVar = 15.5F;
String stringVar = "Test option String";
-// ThingsBoard varaibles
+// ThingsBoard variables
String tb_deviceName = "ESP Sensor";
double tb_deviceLatitude = 41.88505;
double tb_deviceLongitude = 12.50050;
@@ -49,8 +49,8 @@ uint16_t tb_port = 80;
#define TB_SECRET_KEY "Provisioning secret key"
// Timezone definition to get properly time from NTP server
-#define MYTZ "CET-1CEST,M3.5.0,M10.5.0/3"
-struct tm Time;
+//n.u. #define MYTZ "CET-1CEST,M3.5.0,M10.5.0/3"
+//n.u. struct tm Time;
/*
@@ -58,7 +58,7 @@ struct tm Time;
* HTML code will be injected according to the order of options declaration.
* CSS and JavaScript will be appended to the end of body in order to work properly.
* In this manner, is also possible override the default element styles
-* like for example background color, margins, paddings etc etc
+* like for example background color, margins, padding etc etc
*/
#include "customElements.h"
#include "thingsboard.h"
@@ -70,7 +70,7 @@ bool startFilesystem() {
return true;
}
else {
- Serial.println("ERROR on mounting filesystem. It will be formmatted!");
+ Serial.println("ERROR on mounting filesystem. It will be reformatted!");
FILESYSTEM.format();
ESP.restart();
}
@@ -145,6 +145,9 @@ void handleLoadOptions(AsyncWebServerRequest *request) {
}
void setup() {
+#ifdef LED_BUILTIN
+ pinMode(LED_BUILTIN, OUTPUT);
+#endif
Serial.begin(115200);
// Load configuration (if not present, default will be created when webserver will start)
@@ -189,7 +192,7 @@ void setup() {
// Add a new options box with custom code injected
server.addOptionBox("Custom HTML");
// How many times you need (for example one in different option box)
- server.addHTML(custom_html, "fetch-test", /*overwite*/ false);
+ server.addHTML(custom_html, "fetch-test", /*overwrite*/ false);
// Add a new options box
server.addOptionBox("ThingsBoard");
@@ -201,20 +204,20 @@ void setup() {
server.addOption(TB_DEVICE_KEY, tb_device_key);
server.addOption(TB_SECRET_KEY, tb_secret_key);
server.addOption(TB_DEVICE_TOKEN, tb_deviceToken);
- server.addHTML(thingsboard_htm, "ts", /*overwite file*/ false);
+ server.addHTML(thingsboard_htm, "ts", /*overwrite file*/ false);
// CSS will be appended to HTML head
- server.addCSS(custom_css, "fetch", /*overwite file*/ false);
+ server.addCSS(custom_css, "fetch", /*overwrite file*/ false);
// Javascript will be appended to HTML body
- server.addJavascript(custom_script, "fetch", /*overwite file*/ false);
- server.addJavascript(thingsboard_script, "ts", /*overwite file*/ false);
+ server.addJavascript(custom_script, "fetch", /*overwrite file*/ false);
+ server.addJavascript(thingsboard_script, "ts", /*overwrite file*/ false);
// Add custom page title to /setup
- server.setSetupPageTitle("Test setup page");
+ server.setSetupPageTitle("Custom HTML Web Server");
// Add custom logo to /setup page with custom size
- server.setLogoBase64(base64_logo, "128", "128", /*overwite file*/ false);
+ server.setLogoBase64(base64_logo, "128", "128", /*overwrite file*/ false);
- // Enable ACE FS file web editor and add FS info callback fucntion
+ // Enable ACE FS file web editor and add FS info callback function
server.enableFsCodeEditor();
#ifdef ESP32
server.setFsInfoCallback(getFsInfo);
diff --git a/examples/customHTML/thingsboard.h b/examples/customHTML/thingsboard.h
index 63217224..58939eed 100644
--- a/examples/customHTML/thingsboard.h
+++ b/examples/customHTML/thingsboard.h
@@ -87,7 +87,7 @@ function createNewDevice() {
var token = $(TB_DEVICE_TOKEN);
token.focus();
token.value = obj.credentialsValue;
- openModalMessage('Write device attributes', 'Device provisioned correctly. Do you want set client attirbutes on ThingsBoard server?', setDeviceClientAttribute);
+ openModalMessage('Write device attributes', 'Device provisioned correctly. Do you want to set client attributes on ThingsBoard server?', setDeviceClientAttribute);
});
}
diff --git a/examples/customOptions/customOptions.ino b/examples/customOptions/customOptions.ino
index a7b05311..d802a11c 100644
--- a/examples/customOptions/customOptions.ino
+++ b/examples/customOptions/customOptions.ino
@@ -26,7 +26,7 @@ String stringVar = "Test option String";
// In order to show a dropdown list box in /setup page
// we need a list of values and a variable to store the selected option
#define LIST_SIZE 7
-const char* dropdownList[LIST_SIZE] =
+const char* dropdownList[LIST_SIZE] =
{"Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"};
String dropdownSelected;
@@ -75,7 +75,7 @@ bool startFilesystem() {
return true;
}
else {
- Serial.println("ERROR on mounting filesystem. It will be formmatted!");
+ Serial.println("ERROR on mounting filesystem. It will be reformatted!");
FILESYSTEM.format();
ESP.restart();
}
@@ -172,10 +172,10 @@ void setup() {
server.addOption(STRING_LABEL, stringVar);
server.addDropdownList(DROPDOWN_LABEL, dropdownList, LIST_SIZE);
- server.addHTML(save_btn_htm, "buttons", /*overwite*/ false);
- server.addJavascript(button_script, "js", /*overwite*/ false);
+ server.addHTML(save_btn_htm, "buttons", /*overwrite*/ false);
+ server.addJavascript(button_script, "js", /*overwrite*/ false);
- // Enable ACE FS file web editor and add FS info callback fucntion
+ // Enable ACE FS file web editor and add FS info callback function
server.enableFsCodeEditor();
#ifdef ESP32
server.setFsInfoCallback(getFsInfo);
diff --git a/examples/esp32-cam/esp32-cam.ino b/examples/esp32-cam/esp32-cam.ino
index 5d2c63a0..7faefe17 100644
--- a/examples/esp32-cam/esp32-cam.ino
+++ b/examples/esp32-cam/esp32-cam.ino
@@ -50,7 +50,7 @@ void setup() {
/*
Init onboard SD filesystem (format if necessary)
SD_MMC.begin(const char * mountpoint, bool mode1bit, bool format_if_mount_failed, int sdmmc_frequency, uint8_t maxOpenFiles)
- To avoid led glowindg, set mode1bit = true (SD HS_DATA1 is tied to GPIO4, the same of on-board flash led)
+ To avoid led glowing, set mode1bit = true (SD HS_DATA1 is tied to GPIO4, the same of on-board flash led)
*/
if (!SD_MMC.begin("/sdcard", true, true, SDMMC_FREQ_HIGHSPEED, 5)) {
Serial.println("\nSD Mount Failed.\n");
@@ -64,7 +64,7 @@ void setup() {
}
listDir(getFolder, 1);
- // Enable ACE FS file web editor and add FS info callback fucntion
+ // Enable ACE FS file web editor and add FS info callback function
server.enableFsCodeEditor();
server.setFsInfoCallback([](fsInfo_t* fsInfo) {
fsInfo->totalBytes = SD_MMC.totalBytes();
@@ -85,7 +85,7 @@ void setup() {
"Open /edit page to view, edit or upload example or your custom webserver source files."
));
- // Init the camera module (accordind the camera_config_t defined)
+ // Init the camera module (according the camera_config_t defined)
init_camera();
}
diff --git a/examples/gpio_list/gpio_list.ino b/examples/gpio_list/gpio_list.ino
index bf495605..d476f7a9 100644
--- a/examples/gpio_list/gpio_list.ino
+++ b/examples/gpio_list/gpio_list.ino
@@ -156,9 +156,9 @@ void setup() {
}
// Try to connect to flash stored SSID, start AP if fails after timeout
- IPAddress myIP = server.startWiFi(15000, "ESP8266_AP", "123456789" );
+ IPAddress myIP = server.startWiFi(15000, "ESP_AP", "123456789" );
- // Enable ACE FS file web editor and add FS info callback fucntion
+ // Enable ACE FS file web editor and add FS info callback function
server.enableFsCodeEditor();
/*
diff --git a/examples/handleFormData/handleFormData.ino b/examples/handleFormData/handleFormData.ino
index 76e78f45..30b2344f 100644
--- a/examples/handleFormData/handleFormData.ino
+++ b/examples/handleFormData/handleFormData.ino
@@ -75,7 +75,7 @@ bool startFilesystem() {
return true;
}
else {
- Serial.println("ERROR on mounting filesystem. It will be formmatted!");
+ Serial.println("ERROR on mounting filesystem. It will be reformatted!");
FILESYSTEM.format();
ESP.restart();
}
@@ -87,7 +87,7 @@ void setup(){
Serial.begin(115200);
// Try to connect to stored SSID, start AP if fails after timeout
- IPAddress myIP = server.startWiFi(15000, "ESP8266_AP", "123456789" );
+ IPAddress myIP = server.startWiFi(15000, "ESP_AP", "123456789" );
// FILESYSTEM INIT
startFilesystem();
@@ -97,7 +97,7 @@ void setup(){
server.on("/setForm1", HTTP_POST, handleForm1);
server.on("/setForm2", HTTP_POST, handleForm2);
- // Enable ACE FS file web editor and add FS info callback fucntion
+ // Enable ACE FS file web editor and add FS info callback function
server.enableFsCodeEditor();
/*
* Getting FS info (total and free bytes) is strictly related to
diff --git a/examples/highcharts/highcharts.ino b/examples/highcharts/highcharts.ino
index 117cc75b..3cd4a659 100644
--- a/examples/highcharts/highcharts.ino
+++ b/examples/highcharts/highcharts.ino
@@ -90,7 +90,7 @@ bool startFilesystem() {
return true;
}
else {
- Serial.println("ERROR on mounting filesystem. It will be formmatted!");
+ Serial.println("ERROR on mounting filesystem. It will be reformatted!");
FILESYSTEM.format();
ESP.restart();
}
@@ -107,9 +107,9 @@ void setup() {
startFilesystem();
// Try to connect to flash stored SSID, start AP if fails after timeout
- IPAddress myIP = server.startWiFi(15000, "ESP8266_AP", "123456789" );
+ IPAddress myIP = server.startWiFi(15000, "ESP_AP", "123456789" );
- // Enable ACE FS file web editor and add FS info callback fucntion
+ // Enable ACE FS file web editor and add FS info callback function
server.enableFsCodeEditor();
/*
diff --git a/examples/highcharts/readme.md b/examples/highcharts/readme.md
index ea3dde5e..f96bd235 100644
--- a/examples/highcharts/readme.md
+++ b/examples/highcharts/readme.md
@@ -3,15 +3,15 @@ This example is the most advanced since now.
With the help of WebSocket technology, we can send message from server-to-clients or from client-to-server in a **full-duplex communication channels over a single TCP connection.**
-We use the **WebSocket client** to populate asynchronously an _"area chart"_ with real time datas from ESP regarding the **total size of heap memory** and size of **max contiguos block of memory**.
+We use the **WebSocket client** to populate asynchronously an _"area chart"_ with real time datas from ESP regarding the **total size of heap memory** and size of **max contiguous block of memory**.
-Off course, on the ESP MCU we will run also a WebSocket server togheter to the web server.
-I've used this library [arduinoWebSockets](https://github.com/Links2004/arduinoWebSockets), so it is needed to compile, but you can choice wich you prefer.
+Off course, on the ESP MCU we will run also a WebSocket server together to the web server.
+I've used this library [arduinoWebSockets](https://github.com/Links2004/arduinoWebSockets), so it is needed to compile, but you can choose which you prefer.
>N.B.
-This example will run only if an internet connection is avalaible because [Highcharts](https://www.highcharts.com/) Javascript resources is necessary
+This example will run only if an internet connection is available because [Highcharts](https://www.highcharts.com/) Javascript resources is necessary
(to run offline in AP mode, you can download all the used js files, put it in the flash memory (better if gzipped to speed-up page loading) and edit the [index.htm](https://github.com/cotestatnt/esp-fs-webserver/blob/main/examples/highcharts/data/index.htm))
-In this example, web page CSS and JavaScript source file is stored in a separeted file inside the folder **/app**
+In this example, web page CSS and JavaScript source file is stored in a separated file inside the folder **/app**
![image](https://user-images.githubusercontent.com/27758688/123048782-135e4b00-d3ff-11eb-84d5-45e2f164e0f7.png)
diff --git a/examples/remoteOTA/remoteOTA.ino b/examples/remoteOTA/remoteOTA.ino
index f37c3894..94e63af3 100644
--- a/examples/remoteOTA/remoteOTA.ino
+++ b/examples/remoteOTA/remoteOTA.ino
@@ -122,7 +122,7 @@ bool startFilesystem() {
return true;
}
else {
- Serial.println("ERROR on mounting filesystem. It will be formmatted!");
+ Serial.println("ERROR on mounting filesystem. It will be reformatted!");
FILESYSTEM.format();
ESP.restart();
}
@@ -187,7 +187,7 @@ void setup(){
// FILESYSTEM INIT
startFilesystem();
- // Enable ACE FS file web editor and add FS info callback fucntion
+ // Enable ACE FS file web editor and add FS info callback function
server.enableFsCodeEditor();
/*
diff --git a/examples/simpleServer/simpleServer.ino b/examples/simpleServer/simpleServer.ino
index ce3c6be4..8055bc23 100644
--- a/examples/simpleServer/simpleServer.ino
+++ b/examples/simpleServer/simpleServer.ino
@@ -9,7 +9,7 @@ float testFloat = 123.456;
#ifndef LED_BUILTIN
#define LED_BUILTIN 2
#endif
-uint8_t ledPin = LED_BUILTIN;
+const uint8_t ledPin = LED_BUILTIN;
// FILESYSTEM INIT
@@ -24,7 +24,7 @@ bool startFilesystem(){
return true;
}
else {
- Serial.println("ERROR on mounting filesystem. It will be formmatted!");
+ Serial.println("ERROR on mounting filesystem. It will be reformatted!");
LittleFS.format();
ESP.restart();
}
@@ -85,7 +85,7 @@ void setup() {
server.addOption("Test float variable", testFloat);
server.setSetupPageTitle("Simple Async ESP FS WebServer");
- // Enable ACE FS file web editor and add FS info callback fucntion
+ // Enable ACE FS file web editor and add FS info callback function
server.enableFsCodeEditor();
#ifdef ESP32
server.setFsInfoCallback(getFsInfo);
diff --git a/examples/simpleServerCaptive/simpleServerCaptive.ino b/examples/simpleServerCaptive/simpleServerCaptive.ino
index 687903f8..878b176c 100644
--- a/examples/simpleServerCaptive/simpleServerCaptive.ino
+++ b/examples/simpleServerCaptive/simpleServerCaptive.ino
@@ -8,7 +8,7 @@ bool captiveRun = false;
#ifndef LED_BUILTIN
#define LED_BUILTIN 2
#endif
-uint8_t ledPin = LED_BUILTIN;
+const int ledPin = LED_BUILTIN;
//////////////////////////////// Filesystem /////////////////////////////////////////
bool startFilesystem() {
@@ -17,7 +17,7 @@ bool startFilesystem() {
return true;
}
else {
- Serial.println("ERROR on mounting filesystem. It will be formmatted!");
+ Serial.println("ERROR on mounting filesystem. It will be formatted!");
LittleFS.format();
ESP.restart();
}
@@ -49,6 +49,8 @@ void handleLed(AsyncWebServerRequest *request) {
String reply = "LED is now ";
reply += value ? "ON" : "OFF";
request->send(200, "text/plain", reply);
+ Serial.print("handleLed:");
+ Serial.println(reply);
}
@@ -77,7 +79,7 @@ void setup() {
// Set a custom /setup page title
server.setSetupPageTitle("Simple Async FS Captive Web Server");
- // Enable ACE FS file web editor and add FS info callback fucntion
+ // Enable ACE FS file web editor and add FS info callback function
server.enableFsCodeEditor();
#ifdef ESP32
server.setFsInfoCallback(getFsInfo);
diff --git a/examples/withWebSocket/readme.md b/examples/withWebSocket/readme.md
index c4697a17..38fd87fa 100644
--- a/examples/withWebSocket/readme.md
+++ b/examples/withWebSocket/readme.md
@@ -1,10 +1,10 @@
## esp-fs-webserver
This example is a little bit more advanced respect to the [simpleServer](https://github.com/cotestatnt/esp-fs-webserver/tree/main/examples/simpleServer) example.
-Basically is the same HTML code like simpleServer, but with the adddition of a **WebSocket client** inside the webpage.
+Basically is the same HTML code like simpleServer, but with the addition of a **WebSocket client** inside the webpage.
-Off course, on the ESP MCU we will run also a **WebSocket server** togheter to the web server.
-I've used the library [arduinoWebSockets](https://github.com/Links2004/arduinoWebSockets), so it is needed to compile, but you can choice wich you prefer.
+Off course, on the ESP MCU we will run also a **WebSocket server** together to the web server.
+I've used the library [arduinoWebSockets](https://github.com/Links2004/arduinoWebSockets), so it is needed to compile, but you can choose which you prefer.
With the help of WebSocket technology, we can send message from server-to-clients or from client-to-server in a **full-duplex communication channels over a single TCP connection.**
diff --git a/examples/withWebSocket/withWebSocket.ino b/examples/withWebSocket/withWebSocket.ino
index 1940a922..8df531be 100644
--- a/examples/withWebSocket/withWebSocket.ino
+++ b/examples/withWebSocket/withWebSocket.ino
@@ -117,7 +117,7 @@ bool startFilesystem() {
listDir(LittleFS, "/", 1);
return true;
} else {
- Serial.println("ERROR on mounting filesystem. It will be formmatted!");
+ Serial.println("ERROR on mounting filesystem. It will be reformatted!");
FILESYSTEM.format();
ESP.restart();
}
@@ -161,7 +161,7 @@ bool loadApplicationConfig() {
void setup() {
pinMode(LED_BUILTIN, OUTPUT);
pinMode(BOOT_BUTTON, INPUT_PULLUP);
-
+
Serial.begin(115200);
delay(1000);
@@ -201,7 +201,7 @@ void setup() {
request->send(200, "text/html", homepage);
});
- // Enable ACE FS file web editor and add FS info callback fucntion
+ // Enable ACE FS file web editor and add FS info callback function
server.enableFsCodeEditor();
/*
* Getting FS info (total and free bytes) is strictly related to
diff --git a/src/AsyncFsWebServer.cpp b/src/AsyncFsWebServer.cpp
index f6e7791e..a823892f 100644
--- a/src/AsyncFsWebServer.cpp
+++ b/src/AsyncFsWebServer.cpp
@@ -396,13 +396,13 @@ void AsyncFsWebServer::doWifiConnection(AsyncWebServerRequest *request) {
#if defined(ESP8266)
struct station_config stationConf;
wifi_station_get_config_default(&stationConf);
- // Clear previuos configuration
+ // Clear previous configuration
memset(&stationConf, 0, sizeof(stationConf));
wifi_station_set_config(&stationConf);
#elif defined(ESP32)
wifi_config_t stationConf;
esp_wifi_get_config(WIFI_IF_STA, &stationConf);
- // Clear previuos configuration
+ // Clear previous configuration
memset(&stationConf, 0, sizeof(stationConf));
esp_wifi_set_config(WIFI_IF_STA, &stationConf);
#endif
@@ -413,7 +413,7 @@ void AsyncFsWebServer::doWifiConnection(AsyncWebServerRequest *request) {
#if defined(ESP8266)
struct station_config stationConf;
wifi_station_get_config_default(&stationConf);
- // Clear previuos configuration
+ // Clear previous configuration
memset(&stationConf, 0, sizeof(stationConf));
os_memcpy(&stationConf.ssid, ssid.c_str(), ssid.length());
os_memcpy(&stationConf.password, pass.c_str(), pass.length());
@@ -422,7 +422,7 @@ void AsyncFsWebServer::doWifiConnection(AsyncWebServerRequest *request) {
#elif defined(ESP32)
wifi_config_t stationConf;
esp_wifi_get_config(WIFI_IF_STA, &stationConf);
- // Clear previuos configuration
+ // Clear previous configuration
memset(&stationConf, 0, sizeof(stationConf));
memcpy(&stationConf.sta.ssid, ssid.c_str(), ssid.length());
memcpy(&stationConf.sta.password, pass.c_str(), pass.length());
@@ -673,7 +673,7 @@ void AsyncFsWebServer::handleFileEdit(AsyncWebServerRequest *request) {
/*
Return the list of files in the directory specified by the "dir" query string parameter.
- Also demonstrates the use of chuncked responses.
+ Also demonstrates the use of chunked responses.
*/
void AsyncFsWebServer::handleFileList(AsyncWebServerRequest *request)
{
diff --git a/src/AsyncFsWebServer.h b/src/AsyncFsWebServer.h
index 8f7ccc70..6d1c3c61 100644
--- a/src/AsyncFsWebServer.h
+++ b/src/AsyncFsWebServer.h
@@ -70,7 +70,7 @@ class AsyncFsWebServer : public AsyncWebServer
void update_first(AsyncWebServerRequest *request, String filename, size_t index, uint8_t *data, size_t len, bool final);
void update_second(AsyncWebServerRequest *request);
- // edit page, in usefull in some situation, but if you need to provide only a web interface, you can disable
+ // edit page, in useful in some situation, but if you need to provide only a web interface, you can disable
#ifdef INCLUDE_EDIT_HTM
void deleteContent(String& path) ;
void handleFileDelete(AsyncWebServerRequest *request);
@@ -135,7 +135,7 @@ class AsyncFsWebServer : public AsyncWebServer
#endif
/*
- Start webserver aand bind a websocket event handler (optional)
+ Start webserver and bind a websocket event handler (optional)
*/
bool init(AwsEventHandler wsHandle = nullptr);