From c217d4e3c136a4fdfeefe0fd7ff5ac25b96e0806 Mon Sep 17 00:00:00 2001
From: Sebastian Pape <sebastian.pape@rwth-aachen.de>
Date: Tue, 11 Feb 2025 01:02:33 +0100
Subject: [PATCH] Adapting to new Library versions of the Arduino ESP32
 environment

---
 MotionToPhotonMeter.ino  | 10 +++++++---
 MotionToPhotonServer.cpp |  4 ++--
 MotionToPhotonServer.h   |  4 +++-
 data/index.html          |  2 +-
 4 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/MotionToPhotonMeter.ino b/MotionToPhotonMeter.ino
index bf53842..9073bbf 100644
--- a/MotionToPhotonMeter.ino
+++ b/MotionToPhotonMeter.ino
@@ -41,6 +41,11 @@ MotionToPhotonServer server(result_buffer, result_buffer_length, getPhotoDiodeRe
 /* Multicore */
 TaskHandle_t TaskCore0;
 TaskHandle_t TaskCore1;
+const esp_task_wdt_config_t twdt_config = {
+	.timeout_ms = 6000,
+	.idle_core_mask = 0b00000011, // Disable on all cores
+	.trigger_panic = false,
+};
 
 void core1( void * pvParameters ){
 	while(true){	
@@ -104,7 +109,7 @@ void setup() {
 	
 	server.setup();
 
-	esp_task_wdt_init(6000,false);
+	esp_task_wdt_init(&twdt_config);
 	xTaskCreatePinnedToCore(
                     core0,       // Task function.
                     "Server",    // name of task.
@@ -123,8 +128,7 @@ void setup() {
                     &TaskCore1,  // Task handle to keep track of created task
                     1);          // pin task to core 1             
 	delay(500);
-	disableCore0WDT();
-	disableCore1WDT();
+	esp_task_wdt_deinit();
 }
 
 void loop(){} //Still needed for arduino core to work
diff --git a/MotionToPhotonServer.cpp b/MotionToPhotonServer.cpp
index 10d44d2..a8b7cd1 100644
--- a/MotionToPhotonServer.cpp
+++ b/MotionToPhotonServer.cpp
@@ -109,14 +109,14 @@
 	}
 
 	void MotionToPhotonServer::pageResults(){
-		Serial.println("Client wants index page.");
+		Serial.println("Client wants results page.");
 		server.setContentLength(CONTENT_LENGTH_UNKNOWN);
 		server.send(200, "text/plain", "");
 		unsigned int currentNumberOfResults = getCurrentNumberOfResults();
 		for(unsigned int i = 0; i < currentNumberOfResults; i++){
 			server.sendContent(String(result_buffer[i]) + ((i != currentNumberOfResults-1) ? ",\n":""));
 		}
-		server.client().stop();
+		server.sendContent("");
 	}
 
 	void MotionToPhotonServer::pageIndex(){
diff --git a/MotionToPhotonServer.h b/MotionToPhotonServer.h
index 630a56c..2e418a1 100644
--- a/MotionToPhotonServer.h
+++ b/MotionToPhotonServer.h
@@ -2,8 +2,10 @@
 #define MotionToPhotonServer_h
 
 #include "Arduino.h"
+#include <WiFi.h>
 #include <WebServer.h>
 #include "SPIFFS.h"
+#include "FS.h"
 
 class MotionToPhotonServer
 {
@@ -18,7 +20,7 @@ class MotionToPhotonServer
 		void (* abortMeasurement)();
 	
 		/* Put your SSID & Password */
-		const char* ssid = "Calibratio";  // Enter SSID here
+		const char* ssid = "Calibratio2";  // Enter SSID here
 		const char* password = "";  //Enter Password here
 
 		/* Put IP Address details */
diff --git a/data/index.html b/data/index.html
index 5c7c52e..d14a468 100644
--- a/data/index.html
+++ b/data/index.html
@@ -2,7 +2,7 @@
 <html>
 	<head>
 		<meta charset="ISO-8859-1">
-		<title>Calibratio V1.1</title>
+		<title>Calibratio V2</title>
 		<!-- Hello you there, reading the code! This was coded by Sebastian Pape aka PapeCoding.de -->
 		<style>
 			* {
-- 
GitLab