From af9847ceb7c51035faf71e7088b165e025558579 Mon Sep 17 00:00:00 2001
From: Marcus
Date: Wed, 17 Apr 2024 01:44:41 +0200
Subject: [PATCH] html stuff
---
Arduino/CanGrow/CanGrow.ino | 42 ++++++++++++++++++++++++++++---------
1 file changed, 32 insertions(+), 10 deletions(-)
diff --git a/Arduino/CanGrow/CanGrow.ino b/Arduino/CanGrow/CanGrow.ino
index ba80e87..4d8212b 100644
--- a/Arduino/CanGrow/CanGrow.ino
+++ b/Arduino/CanGrow/CanGrow.ino
@@ -34,7 +34,8 @@ float valTemperature;
// valTemperature - contains the value of getHumidity()
float valHumidity;
// valWaterlevel - contains the value of getWaterlevel()
-
+// do we need a restart? (e.g. after wifi settings change)
+bool NeedRestart;
@@ -212,19 +213,27 @@ a:active {
color: #04AA6D;
}
-.infomsg {
- background: #04AA6D;
+.infomsg , .warnmsg {
color: #fff;
border-radius: 3px;
padding: 4px;
width: fit-content; min-width: 200px; max-width: 420px;
margin: auto;
+ margin-bottom: 5px;
font-weight: bold;
text-align: center;
text-decoration: none;
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.5);
}
+.infomsg {
+ background: #04AA6D;
+}
+
+.warnmsg {
+ background: #aa4204;
+}
+
/* from https://gist.github.com/iamhelenliu/5755179 - thank you! */
.nav {
background: #333;
@@ -268,6 +277,14 @@ a:active {
+)EOF";
+
+const char HTMLsuccess[] PROGMEM = R"EOF(
+Successfully saved!
+)EOF";
+
+const char HTMLneedRestart[] PROGMEM = R"EOF(
+Restart is required to apply new WiFi settings!
)EOF";
const char HTMLhelp[] PROGMEM = R"EOF(
@@ -1109,8 +1126,11 @@ void WEBwifiSettings() {
body += "
";
}
body += "WiFi config
\n";
+ if(NeedRestart == true) {
+ body += FPSTR(HTMLneedRestart);
+ }
if(webserver.hasArg("success")) {
- body += "Successfully saved!
Please restart the device.
";
+ body += FPSTR(HTMLsuccess);
}
body += "Select your wifi network from the SSID list.
To use DHCP leave IP, Subnet, Gateway and DNS fields blank!
";
body += "