diff --git a/data/index.html b/data/index.html
new file mode 100644
index 0000000..502557f
--- /dev/null
+++ b/data/index.html
@@ -0,0 +1,41 @@
+
SPIFF!abb
+
+;
+
\ No newline at end of file
diff --git a/data/update.html b/data/update.html
new file mode 100644
index 0000000..e69de29
diff --git a/src/main.cpp b/src/main.cpp
index 1fcaf29..845fef0 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -5,6 +5,7 @@
#include
#include
#include
+#include
const char* host = "esp32gragedoor";
const char* ssid = "JoNelsDarlings";
@@ -163,19 +164,40 @@ void setup(void) {
/*use mdns for host name resolution*/
if (!MDNS.begin(host)) { //http://esp32garagedoor.local
- Serial.println("Error setting up MDNS responder!");
while (1) {
+ Serial.println("Error setting up MDNS responder!");
delay(1000);
}
}
Serial.println("mDNS responder started");
+ if(!SPIFFS.begin(true)){
+ while (1) {
+ Serial.println("An Error has occurred while mounting SPIFFS");
+ delay(1000);
+ }
+ }
+
send_notification("garagedoor.rebooted.livorno.address");
/*return index page which is stored in serverIndex */
server.on("/", HTTP_GET, []() {
server.sendHeader("Connection", "close");
- server.send(200, "text/html", loginIndex);
+ File file = SPIFFS.open("/index.html");
+
+ String thePage = "";
+
+ if (!file) {
+ Serial.println("There was a problem opening the file for reading.");
+ thePage += "There was a problem opening the file for reading.";
+ }
+
+ while (file.available()) {
+ thePage+=String((char)file.read());
+ }
+
+ file.close();
+ server.send(200, "text/html", thePage);
});
server.on("/serverIndex", HTTP_GET, []() {
server.sendHeader("Connection", "close");