diff --git a/Arduino/CanGrow/include/CanGrow.h b/Arduino/CanGrow/include/CanGrow.h
index 05f67b3..edff429 100644
--- a/Arduino/CanGrow/include/CanGrow.h
+++ b/Arduino/CanGrow/include/CanGrow.h
@@ -71,7 +71,7 @@ Config_System configSystem;
struct Config_Grow {
- char growName[64];
+ char growName[64] = "CanGrow";
unsigned short dayOfGrow;
byte daysSeed;
byte daysVeg;
diff --git a/Arduino/CanGrow/include/CanGrow_Webserver.h b/Arduino/CanGrow/include/CanGrow_Webserver.h
index ad5125b..19f7a47 100644
--- a/Arduino/CanGrow/include/CanGrow_Webserver.h
+++ b/Arduino/CanGrow/include/CanGrow_Webserver.h
@@ -27,7 +27,10 @@
*
*/
-
+/*
+ * include static files files
+ */
+#include "Webserver/File_cangrow_CSS.h"
/*
* include webpages header files
@@ -40,10 +43,7 @@
#include "Webserver/Page_wifi.h"
-/*
- * include static files files
- */
-#include "Webserver/File_cangrow_CSS.h"
+
AsyncWebServer webserver(80);
@@ -51,9 +51,19 @@ AsyncWebServer webserver(80);
LoggingMiddleware requestLogger;
+/* 404 error site - this is also a good example for a simple WebPage */
+const char* Page_404_HTML PROGMEM = R"(%HEADER%
+
❗ ️ 404 - not found
+%FOOTER%)";
+
+/* processor */
+String Proc_WebPage_404(const String& var) {
+ return AddHeaderFooter(var);
+}
+
// https://github.com/mathieucarbou/ESPAsyncWebServer/blob/main/examples/SimpleServer/SimpleServer.ino
void WebserverNotFound(AsyncWebServerRequest* request) {
- request->send(404, "text/plain", "Not found");
+ request->send(404, "text/html", Page_404_HTML, Proc_WebPage_404);
}
/*
diff --git a/Arduino/CanGrow/include/Webserver/AddHeaderFooter.h b/Arduino/CanGrow/include/Webserver/AddHeaderFooter.h
index ac41610..4ab116a 100644
--- a/Arduino/CanGrow/include/Webserver/AddHeaderFooter.h
+++ b/Arduino/CanGrow/include/Webserver/AddHeaderFooter.h
@@ -28,19 +28,21 @@
*
*/
+
bool TestHeaderFooter(const String& var) {
#ifdef DEBUG
Serial.print(":: [Webserver:Page:root:proc:hf] var: ");
Serial.println(var);
#endif
- if(var == "HEADER") {
- return true;
- } else if(var == "FOOTER") {
- return true;
- } else if(var == "CGVER") {
- return true;
- } else if(var == "CGBUILD") {
+ if(
+ (var == "HEADER") ||
+ (var == "FOOTER") ||
+ (var == "CGVER") ||
+ (var == "CGBUILD") ||
+ (var == "GROWNAME") ||
+ (var == "CANGROW_CSS")
+ ) {
return true;
} else {
return false;
@@ -56,6 +58,10 @@ String AddHeaderFooter(const String& var) {
return String(CANGROW_VER);
} else if(var == "CGBUILD") {
return String(CANGROW_BUILD);
+ } else if(var == "GROWNAME") {
+ return String(configGrow.growName);
+ } else if(var == "CANGROW_CSS") {
+ return String(File_cangrow_CSS);
} else {
return String();
}
diff --git a/Arduino/CanGrow/include/Webserver/File_cangrow_CSS.h b/Arduino/CanGrow/include/Webserver/File_cangrow_CSS.h
index 667fe08..c09d745 100644
--- a/Arduino/CanGrow/include/Webserver/File_cangrow_CSS.h
+++ b/Arduino/CanGrow/include/Webserver/File_cangrow_CSS.h
@@ -35,7 +35,7 @@ const char* File_cangrow_CSS PROGMEM = R"(body {
}
.center {
- width: 100%;
+ width: 100%%;
margin: auto;
}
@@ -84,7 +84,7 @@ a:active {
}
.nav {
background: #333;
- width: 100%;
+ width: 100%%;
margin: auto;
margin-bottom: 10px;
padding: 0;
@@ -174,7 +174,7 @@ input[type=text], input[type=date], input[type=number], input[type=password], se
@media only screen and (min-width: 1820px) {
.center, .nav {
- width: 60%; min-width: 420px;
+ width: 60%%; min-width: 420px;
}
.subnav li {
display: '';
@@ -187,9 +187,8 @@ input[type=text], input[type=date], input[type=number], input[type=password], se
display: inline-block;
margin-bottom: 3px;
}
-}
-)";
+})";
void WebFile_cangrow_CSS(AsyncWebServerRequest *request) {
- request->send_P(200, "text/stylesheet", File_cangrow_CSS);
+ request->send_P(200, "text/css", File_cangrow_CSS);
}
diff --git a/Arduino/CanGrow/include/Webserver/header.h b/Arduino/CanGrow/include/Webserver/header.h
index c595223..fd46b6f 100644
--- a/Arduino/CanGrow/include/Webserver/header.h
+++ b/Arduino/CanGrow/include/Webserver/header.h
@@ -34,9 +34,13 @@ const char* Header_HTML PROGMEM = R"(
CanGrow %CGVER% - %CGBUILD%
+
+
-