diff --git a/Software/data_src/index.htm b/Software/data_src/index.htm
index 57f43b9..8f6e93f 100644
--- a/Software/data_src/index.htm
+++ b/Software/data_src/index.htm
@@ -349,6 +349,33 @@
+
+
+
+
+
diff --git a/Software/include/common.h b/Software/include/common.h
index 1c4771c..ea7860e 100644
--- a/Software/include/common.h
+++ b/Software/include/common.h
@@ -73,6 +73,7 @@ typedef enum eSystem_Status
sysStat_Startup,
sysStat_Normal,
sysStat_Rain,
+ sysStat_Wash,
sysStat_Purge,
sysStat_Error,
sysStat_Shutdown
diff --git a/Software/include/config.h b/Software/include/config.h
index 75a2d2c..d0b3321 100644
--- a/Software/include/config.h
+++ b/Software/include/config.h
@@ -21,7 +21,7 @@
#include "dtc.h"
#include "common.h"
-#define EEPROM_STRUCTURE_REVISION 3 // Increment this version when changing EEPROM structures
+#define EEPROM_STRUCTURE_REVISION 4 // Increment this version when changing EEPROM structures
#if PCB_REV == 1 || PCB_REV == 2 || PCB_REV == 3
#define EEPROM_SIZE_BYTES I2C_DEVICESIZE_24LC64
@@ -69,6 +69,8 @@ typedef struct
uint32_t RimDiameter_Inch;
uint32_t DistancePerRevolution_mm;
uint16_t BleedingPulses;
+ uint16_t WashMode_Distance;
+ uint16_t WashMode_Interval;
SpeedSource_t SpeedSource;
GPSBaudRate_t GPSBaudRate;
CANSource_t CANSource;
@@ -85,7 +87,7 @@ typedef struct
// Default configuration settings
const LubeConfig_t LubeConfig_defaults = {
- 0, 8000, 4000, 320, DEFAULT_PUMP_DOSE, 30, 1, 150, 70, 18, 2000, 25, SOURCE_IMPULSE,
+ 0, 8000, 4000, 320, DEFAULT_PUMP_DOSE, 30, 1, 150, 70, 18, 2000, 25, 500, 10, SOURCE_IMPULSE,
BAUD_115200,
KTM_890_ADV_R_2021,
false,
diff --git a/Software/include/struct2json.h b/Software/include/struct2json.h
index 83c5a03..1ef499f 100644
--- a/Software/include/struct2json.h
+++ b/Software/include/struct2json.h
@@ -3,10 +3,10 @@
*
* @brief Header file for converting structs to JSON objects.
*
- * @note This file is auto-generated by a script on 2024-01-30 20:29:34.
+ * @note This file is auto-generated by a script on 2025-06-15 11:37:51.
*
* @author Marcel Peterkau
- * @date 30.01.2024
+ * @date 15.06.2025
*/
#ifndef _STRUCT2JSON_H_
@@ -23,4 +23,4 @@ void generateJsonObject_PersistenceData(JsonObject data);
#endif /* _STRUCT2JSON_H_ */
-// CODEGENERATOR_CHECKSUM: 59f35aadffd0bbef253210ea2fbaaf9a515553a2e3cc9bf4cfa2819b63c969ce
\ No newline at end of file
+// CODEGENERATOR_CHECKSUM: 4702cb49ea55617cbb34715164810bb58d3c3f46fb1653b6f47bd4fd9cb0031e
\ No newline at end of file
diff --git a/Software/src/button_actions.cpp b/Software/src/button_actions.cpp
index 051a7cc..f6792c9 100644
--- a/Software/src/button_actions.cpp
+++ b/Software/src/button_actions.cpp
@@ -33,8 +33,8 @@ void ButtonAction_ToggleWiFi()
void ButtonAction_WashMode()
{
- Debug_pushMessage("Wash mode not yet implemented\n");
- // TODO: Implementieren, sobald Verhalten klar ist
+ globals.systemStatus = sysStat_Wash;
+ Debug_pushMessage("Setting WashMode\n");
}
// Liste der Aktionen, sortiert nach Mindest-Haltezeit (ms)
diff --git a/Software/src/lubeapp.cpp b/Software/src/lubeapp.cpp
index d64d31a..17d1132 100644
--- a/Software/src/lubeapp.cpp
+++ b/Software/src/lubeapp.cpp
@@ -29,6 +29,7 @@ uint32_t lubePulseTimestamp = 0;
void RunLubeApp(uint32_t add_milimeters)
{
static tSystem_Status lastSystemStatus = sysStat_Startup;
+ static uint16_t washModeDistance = 0;
// Calculate and update tank percentage
globals.TankPercentage = PersistenceData.tankRemain_microL / (LubeConfig.tankCapacity_ml * 10);
@@ -102,6 +103,32 @@ void RunLubeApp(uint32_t add_milimeters)
}
break;
+ case sysStat_Wash:
+ if (lastSystemStatus != globals.systemStatus)
+ {
+ washModeDistance = LubeConfig.WashMode_Distance;
+ strcpy_P(globals.systemStatustxt, PSTR("Wash"));
+ LEDControl_SetBasic(LED_WASH_COLOR, LED_PATTERN_BREATH);
+ lastSystemStatus = globals.systemStatus;
+ }
+
+ // Trigger lube pulse if traveled distance exceeds the configured Interval in Wash mode
+ if (PersistenceData.TravelDistance_highRes_mm / 1000 > LubeConfig.WashMode_Interval)
+ {
+ LubePulse();
+ PersistenceData.TravelDistance_highRes_mm = 0;
+
+ if (washModeDistance >= LubeConfig.WashMode_Distance)
+ {
+ washModeDistance = washModeDistance - LubeConfig.WashMode_Interval;
+ }
+ else
+ {
+ globals.systemStatus = globals.resumeStatus;
+ }
+ }
+ break;
+
case sysStat_Purge:
if (lastSystemStatus != globals.systemStatus)
{
diff --git a/Software/src/struct2json.cpp b/Software/src/struct2json.cpp
index 1fc6e15..f0fe9f8 100644
--- a/Software/src/struct2json.cpp
+++ b/Software/src/struct2json.cpp
@@ -3,10 +3,10 @@
*
* @brief Implementation file for converting structs to JSON objects.
*
- * @note This file is auto-generated by a script on 2024-01-30 20:29:34.
+ * @note This file is auto-generated by a script on 2025-06-15 11:37:51.
*
* @author Marcel Peterkau
- * @date 30.01.2024
+ * @date 15.06.2025
*/
@@ -26,6 +26,8 @@ void generateJsonObject_LubeConfig(JsonObject data)
data["RimDiameter_Inch"] = LubeConfig.RimDiameter_Inch;
data["DistancePerRevolution_mm"] = LubeConfig.DistancePerRevolution_mm;
data["BleedingPulses"] = LubeConfig.BleedingPulses;
+ data["WashMode_Distance"] = LubeConfig.WashMode_Distance;
+ data["WashMode_Interval"] = LubeConfig.WashMode_Interval;
data["SpeedSource"] = LubeConfig.SpeedSource;
data["GPSBaudRate"] = LubeConfig.GPSBaudRate;
data["CANSource"] = LubeConfig.CANSource;
@@ -52,4 +54,4 @@ void generateJsonObject_PersistenceData(JsonObject data)
-// CODEGENERATOR_CHECKSUM: 59f35aadffd0bbef253210ea2fbaaf9a515553a2e3cc9bf4cfa2819b63c969ce
\ No newline at end of file
+// CODEGENERATOR_CHECKSUM: 4702cb49ea55617cbb34715164810bb58d3c3f46fb1653b6f47bd4fd9cb0031e
\ No newline at end of file
diff --git a/Software/src/webui.cpp b/Software/src/webui.cpp
index c678432..f1f4b59 100644
--- a/Software/src/webui.cpp
+++ b/Software/src/webui.cpp
@@ -580,6 +580,14 @@ void Websocket_HandleSettings(uint8_t *data)
{
strncpy(LubeConfig.wifi_client_password, value, sizeof(LubeConfig.wifi_client_password));
}
+ else if (strcmp(identifier, "washinterval") == 0)
+ {
+ LubeConfig.WashMode_Interval = atoi(value);
+ }
+ else if (strcmp(identifier, "washdistance") == 0)
+ {
+ LubeConfig.WashMode_Distance = atoi(value);
+ }
else
{
Debug_pushMessage("Got unknown Settings-id and value '%s' from ws-client\n", identifier);
@@ -700,6 +708,8 @@ void Websocket_RefreshClientData_Static(uint32_t client_id, bool send_mapping)
const char mapping[] = "MAPPING_STATIC:"
"lubedistancenormal;"
"lubedistancerain;"
+ "washdistance;"
+ "washinterval;"
"tankcap;"
"pumppulse;"
"tankwarn;"
@@ -730,6 +740,8 @@ void Websocket_RefreshClientData_Static(uint32_t client_id, bool send_mapping)
temp.concat(String(LubeConfig.DistancePerLube_Default) + ";");
temp.concat(String(LubeConfig.DistancePerLube_Rain) + ";");
+ temp.concat(String(LubeConfig.WashMode_Distance) + ";");
+ temp.concat(String(LubeConfig.WashMode_Interval) + ";");
temp.concat(String(LubeConfig.tankCapacity_ml) + ";");
temp.concat(String(LubeConfig.amountPerDose_microL) + ";");
temp.concat(String(LubeConfig.TankRemindAtPercentage) + ";");