From 49b35982753b66d7accc9d4b398303594ba51af7 Mon Sep 17 00:00:00 2001 From: Marcel Peterkau Date: Fri, 3 Mar 2023 10:51:16 +0100 Subject: [PATCH] added Function to WebUI to measure Pulses --- Software/data_src/index.htm | 36 +++++++++++++++++++++++++++++++----- Software/src/globals.cpp | 2 ++ Software/src/globals.h | 2 ++ Software/src/main.cpp | 4 ++++ Software/src/webui.cpp | 12 ++++++++++++ 5 files changed, 51 insertions(+), 5 deletions(-) diff --git a/Software/data_src/index.htm b/Software/data_src/index.htm index 43db8d8..ce116ec 100644 --- a/Software/data_src/index.htm +++ b/Software/data_src/index.htm @@ -148,6 +148,32 @@

+ +
+

+

Einmessen

+
+
+ +
+
+ +
+ Pulse +
+
+
+
+
+
+ + +
+
+
+

+

@@ -451,8 +477,8 @@

- +
@@ -460,8 +486,8 @@
- +
@@ -648,7 +674,7 @@ Git Revision %GIT_REV% - +

diff --git a/Software/src/globals.cpp b/Software/src/globals.cpp index 8886874..c202307 100644 --- a/Software/src/globals.cpp +++ b/Software/src/globals.cpp @@ -8,4 +8,6 @@ void initGlobals() globals.requestEEAction = EE_IDLE; globals.resumeStatus = sysStat_Normal; globals.systemStatus = sysStat_Startup; + globals.measurementActive = false; + globals.measuredPulses = 0; } diff --git a/Software/src/globals.h b/Software/src/globals.h index 6161a6e..69b29fe 100644 --- a/Software/src/globals.h +++ b/Software/src/globals.h @@ -39,6 +39,8 @@ typedef struct Globals_s uint16_t eePersistanceAdress; uint8_t TankPercentage; bool hasDTC; + bool measurementActive; + uint32_t measuredPulses; } Globals_t; extern Globals_t globals; diff --git a/Software/src/main.cpp b/Software/src/main.cpp index 522b87f..1a00f29 100644 --- a/Software/src/main.cpp +++ b/Software/src/main.cpp @@ -594,6 +594,10 @@ uint32_t Process_Impulse_WheelSpeed() uint32_t add_milimeters; // Calculate traveled Distance in mm add_milimeters = (wheel_pulse * (LubeConfig.DistancePerRevolution_mm / LubeConfig.PulsePerRevolution)); + + if (globals.measurementActive == true) + globals.measuredPulses = globals.measuredPulses + wheel_pulse; + wheel_pulse = 0; return add_milimeters; diff --git a/Software/src/webui.cpp b/Software/src/webui.cpp index 9e08d37..bd1da76 100644 --- a/Software/src/webui.cpp +++ b/Software/src/webui.cpp @@ -260,6 +260,12 @@ String processor(const String &var) if (var == "GIT_REV") return String(constants.GitHash); + if (var == "MEASURED_PULSES") + return String(globals.measuredPulses); + + if (var == "MEASURE_BTN") + return String(globals.measurementActive == true ? "Stop" : "Start"); + if (var == "PLACEHOLDER") return "placeholder"; @@ -396,6 +402,12 @@ void WebserverPOST_Callback(AsyncWebServerRequest *request) globals.requestEEAction = EE_CFG_SAVE; } // end: POST Form LED SEttings + // begin: POST Form Measure Pulses + if (p->name() == "measurereset") + globals.measuredPulses = 0; + if (p->name() == "measurestartstop") + globals.measurementActive = !globals.measurementActive; + // end: POST Form Measure Pulses } }