implemented Wash-Mode
This commit is contained in:
parent
c7af5619eb
commit
b7ccffc157
@ -349,6 +349,33 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group row">
|
||||||
|
<label for="washdistance" class="control-label col-4">Waschmodus Distanz</label>
|
||||||
|
<div class="col-8">
|
||||||
|
<div class="input-group">
|
||||||
|
<input id="washdistance" type="text"
|
||||||
|
class="set-wsevent data-washdistance form-control" required="required">
|
||||||
|
<div class="input-group-append">
|
||||||
|
<span class="input-group-text">m</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group row">
|
||||||
|
<label for="washinterval" class="control-label col-4">Waschmodus Interval</label>
|
||||||
|
<div class="col-8">
|
||||||
|
<div class="input-group">
|
||||||
|
<input id="washinterval" type="text"
|
||||||
|
class="set-wsevent data-washinterval form-control" required="required">
|
||||||
|
<div class="input-group-append">
|
||||||
|
<span class="input-group-text">m</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
</p>
|
</p>
|
||||||
<!-- Div Group Lube Settings-->
|
<!-- Div Group Lube Settings-->
|
||||||
<!-- Div Group Oiltank Settings -->
|
<!-- Div Group Oiltank Settings -->
|
||||||
|
@ -73,6 +73,7 @@ typedef enum eSystem_Status
|
|||||||
sysStat_Startup,
|
sysStat_Startup,
|
||||||
sysStat_Normal,
|
sysStat_Normal,
|
||||||
sysStat_Rain,
|
sysStat_Rain,
|
||||||
|
sysStat_Wash,
|
||||||
sysStat_Purge,
|
sysStat_Purge,
|
||||||
sysStat_Error,
|
sysStat_Error,
|
||||||
sysStat_Shutdown
|
sysStat_Shutdown
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
#include "dtc.h"
|
#include "dtc.h"
|
||||||
#include "common.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
|
#if PCB_REV == 1 || PCB_REV == 2 || PCB_REV == 3
|
||||||
#define EEPROM_SIZE_BYTES I2C_DEVICESIZE_24LC64
|
#define EEPROM_SIZE_BYTES I2C_DEVICESIZE_24LC64
|
||||||
@ -69,6 +69,8 @@ typedef struct
|
|||||||
uint32_t RimDiameter_Inch;
|
uint32_t RimDiameter_Inch;
|
||||||
uint32_t DistancePerRevolution_mm;
|
uint32_t DistancePerRevolution_mm;
|
||||||
uint16_t BleedingPulses;
|
uint16_t BleedingPulses;
|
||||||
|
uint16_t WashMode_Distance;
|
||||||
|
uint16_t WashMode_Interval;
|
||||||
SpeedSource_t SpeedSource;
|
SpeedSource_t SpeedSource;
|
||||||
GPSBaudRate_t GPSBaudRate;
|
GPSBaudRate_t GPSBaudRate;
|
||||||
CANSource_t CANSource;
|
CANSource_t CANSource;
|
||||||
@ -85,7 +87,7 @@ typedef struct
|
|||||||
|
|
||||||
// Default configuration settings
|
// Default configuration settings
|
||||||
const LubeConfig_t LubeConfig_defaults = {
|
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,
|
BAUD_115200,
|
||||||
KTM_890_ADV_R_2021,
|
KTM_890_ADV_R_2021,
|
||||||
false,
|
false,
|
||||||
|
@ -3,10 +3,10 @@
|
|||||||
*
|
*
|
||||||
* @brief Header file for converting structs to JSON objects.
|
* @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
|
* @author Marcel Peterkau
|
||||||
* @date 30.01.2024
|
* @date 15.06.2025
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _STRUCT2JSON_H_
|
#ifndef _STRUCT2JSON_H_
|
||||||
@ -23,4 +23,4 @@ void generateJsonObject_PersistenceData(JsonObject data);
|
|||||||
|
|
||||||
#endif /* _STRUCT2JSON_H_ */
|
#endif /* _STRUCT2JSON_H_ */
|
||||||
|
|
||||||
// CODEGENERATOR_CHECKSUM: 59f35aadffd0bbef253210ea2fbaaf9a515553a2e3cc9bf4cfa2819b63c969ce
|
// CODEGENERATOR_CHECKSUM: 4702cb49ea55617cbb34715164810bb58d3c3f46fb1653b6f47bd4fd9cb0031e
|
@ -33,8 +33,8 @@ void ButtonAction_ToggleWiFi()
|
|||||||
|
|
||||||
void ButtonAction_WashMode()
|
void ButtonAction_WashMode()
|
||||||
{
|
{
|
||||||
Debug_pushMessage("Wash mode not yet implemented\n");
|
globals.systemStatus = sysStat_Wash;
|
||||||
// TODO: Implementieren, sobald Verhalten klar ist
|
Debug_pushMessage("Setting WashMode\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Liste der Aktionen, sortiert nach Mindest-Haltezeit (ms)
|
// Liste der Aktionen, sortiert nach Mindest-Haltezeit (ms)
|
||||||
|
@ -29,6 +29,7 @@ uint32_t lubePulseTimestamp = 0;
|
|||||||
void RunLubeApp(uint32_t add_milimeters)
|
void RunLubeApp(uint32_t add_milimeters)
|
||||||
{
|
{
|
||||||
static tSystem_Status lastSystemStatus = sysStat_Startup;
|
static tSystem_Status lastSystemStatus = sysStat_Startup;
|
||||||
|
static uint16_t washModeDistance = 0;
|
||||||
|
|
||||||
// Calculate and update tank percentage
|
// Calculate and update tank percentage
|
||||||
globals.TankPercentage = PersistenceData.tankRemain_microL / (LubeConfig.tankCapacity_ml * 10);
|
globals.TankPercentage = PersistenceData.tankRemain_microL / (LubeConfig.tankCapacity_ml * 10);
|
||||||
@ -102,6 +103,32 @@ void RunLubeApp(uint32_t add_milimeters)
|
|||||||
}
|
}
|
||||||
break;
|
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:
|
case sysStat_Purge:
|
||||||
if (lastSystemStatus != globals.systemStatus)
|
if (lastSystemStatus != globals.systemStatus)
|
||||||
{
|
{
|
||||||
|
@ -3,10 +3,10 @@
|
|||||||
*
|
*
|
||||||
* @brief Implementation file for converting structs to JSON objects.
|
* @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
|
* @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["RimDiameter_Inch"] = LubeConfig.RimDiameter_Inch;
|
||||||
data["DistancePerRevolution_mm"] = LubeConfig.DistancePerRevolution_mm;
|
data["DistancePerRevolution_mm"] = LubeConfig.DistancePerRevolution_mm;
|
||||||
data["BleedingPulses"] = LubeConfig.BleedingPulses;
|
data["BleedingPulses"] = LubeConfig.BleedingPulses;
|
||||||
|
data["WashMode_Distance"] = LubeConfig.WashMode_Distance;
|
||||||
|
data["WashMode_Interval"] = LubeConfig.WashMode_Interval;
|
||||||
data["SpeedSource"] = LubeConfig.SpeedSource;
|
data["SpeedSource"] = LubeConfig.SpeedSource;
|
||||||
data["GPSBaudRate"] = LubeConfig.GPSBaudRate;
|
data["GPSBaudRate"] = LubeConfig.GPSBaudRate;
|
||||||
data["CANSource"] = LubeConfig.CANSource;
|
data["CANSource"] = LubeConfig.CANSource;
|
||||||
@ -52,4 +54,4 @@ void generateJsonObject_PersistenceData(JsonObject data)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
// CODEGENERATOR_CHECKSUM: 59f35aadffd0bbef253210ea2fbaaf9a515553a2e3cc9bf4cfa2819b63c969ce
|
// CODEGENERATOR_CHECKSUM: 4702cb49ea55617cbb34715164810bb58d3c3f46fb1653b6f47bd4fd9cb0031e
|
@ -580,6 +580,14 @@ void Websocket_HandleSettings(uint8_t *data)
|
|||||||
{
|
{
|
||||||
strncpy(LubeConfig.wifi_client_password, value, sizeof(LubeConfig.wifi_client_password));
|
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
|
else
|
||||||
{
|
{
|
||||||
Debug_pushMessage("Got unknown Settings-id and value '%s' from ws-client\n", identifier);
|
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:"
|
const char mapping[] = "MAPPING_STATIC:"
|
||||||
"lubedistancenormal;"
|
"lubedistancenormal;"
|
||||||
"lubedistancerain;"
|
"lubedistancerain;"
|
||||||
|
"washdistance;"
|
||||||
|
"washinterval;"
|
||||||
"tankcap;"
|
"tankcap;"
|
||||||
"pumppulse;"
|
"pumppulse;"
|
||||||
"tankwarn;"
|
"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_Default) + ";");
|
||||||
temp.concat(String(LubeConfig.DistancePerLube_Rain) + ";");
|
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.tankCapacity_ml) + ";");
|
||||||
temp.concat(String(LubeConfig.amountPerDose_microL) + ";");
|
temp.concat(String(LubeConfig.amountPerDose_microL) + ";");
|
||||||
temp.concat(String(LubeConfig.TankRemindAtPercentage) + ";");
|
temp.concat(String(LubeConfig.TankRemindAtPercentage) + ";");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user