8 Commits

12 changed files with 41 additions and 33 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -26,8 +26,8 @@
#define HOST_NAME "ChainLube_%06X" // Use printf-Formatting - Chip-ID (uin32_t) will be added #define HOST_NAME "ChainLube_%06X" // Use printf-Formatting - Chip-ID (uin32_t) will be added
#endif #endif
#define SW_VERSION 1.3 #define SW_VERSION 1.4
#define FLASH_FS_VERSION 1.3 #define FLASH_FS_VERSION 1.4
#ifndef OTA_DELAY #ifndef OTA_DELAY
#define OTA_DELAY 50 // ticks -> 10ms / tick #define OTA_DELAY 50 // ticks -> 10ms / tick

View File

@@ -243,7 +243,6 @@ boolean checkEEPROMavailable()
if (!ee.isConnected()) if (!ee.isConnected())
{ {
MaintainDTC(DTC_NO_EEPROM_FOUND, DTC_CRITICAL, true); MaintainDTC(DTC_NO_EEPROM_FOUND, DTC_CRITICAL, true);
globals.systemStatus = sysStat_Error;
return false; return false;
} }
MaintainDTC(DTC_NO_EEPROM_FOUND, DTC_CRITICAL, false); MaintainDTC(DTC_NO_EEPROM_FOUND, DTC_CRITICAL, false);

View File

@@ -8,7 +8,11 @@
#include "dtc.h" #include "dtc.h"
#include "common.h" #include "common.h"
#if PCB_REV == 1 || PCB_REV == 2 || PCB_REV == 3
#define EEPROM_SIZE_BYTES I2C_DEVICESIZE_24LC64
#elif PCB_REV == 4
#define EEPROM_SIZE_BYTES I2C_DEVICESIZE_24LC256 #define EEPROM_SIZE_BYTES I2C_DEVICESIZE_24LC256
#endif
typedef enum SpeedSource_e typedef enum SpeedSource_e
{ {

View File

@@ -247,7 +247,7 @@ void Debug_ShowDTCs()
else else
strcpy(buff_active, "none"); strcpy(buff_active, "none");
Debug_pushMessage("%s \t %6d \t %s", buff_timestamp, DTCStorage[i].Number, buff_active); Debug_pushMessage("%s \t %6d \t %s \t %d", buff_timestamp, DTCStorage[i].Number, buff_active, DTCStorage[i].severity);
} }
} }
} }

View File

@@ -39,6 +39,7 @@ void MaintainDTC(DTCNums_t DTC_no, DTCSeverity_t DTC_severity, boolean active, u
DTCStorage[i].timestamp = millis(); DTCStorage[i].timestamp = millis();
DTCStorage[i].active = DTC_ACTIVE; DTCStorage[i].active = DTC_ACTIVE;
DTCStorage[i].debugVal = DebugValue; DTCStorage[i].debugVal = DebugValue;
DTCStorage[i].severity = DTC_severity;
return; return;
} }
} }
@@ -107,3 +108,32 @@ DTCNums_t getlastDTC_Severity(boolean only_active, DTCSeverity_t severity)
return pointer >= 0 ? DTCStorage[pointer].Number : DTC_LAST_DTC; return pointer >= 0 ? DTCStorage[pointer].Number : DTC_LAST_DTC;
} }
void DTC_Process()
{
static tSystem_Status preserverSysStatusError;
if (getlastDTC(false) < DTC_LAST_DTC)
{
globals.hasDTC = true;
if (getlastDTC_Severity(true, DTC_CRITICAL) < DTC_LAST_DTC)
{
if (globals.systemStatus != sysStat_Error)
{
preserverSysStatusError = globals.systemStatus;
}
globals.systemStatus = sysStat_Error;
}
else
{
if (globals.systemStatus == sysStat_Error)
{
globals.systemStatus = preserverSysStatusError;
}
}
}
else
{
globals.hasDTC = false;
}
}

View File

@@ -55,6 +55,7 @@ void ClearDTC(DTCNums_t DTC_no);
void ClearAllDTC(); void ClearAllDTC();
DTCNums_t getlastDTC(boolean only_active); DTCNums_t getlastDTC(boolean only_active);
DTCNums_t getlastDTC_Severity(boolean only_active, DTCSeverity_t severity); DTCNums_t getlastDTC_Severity(boolean only_active, DTCSeverity_t severity);
void DTC_Process();
extern DTCEntry_s DTCStorage[MAX_DTC_STORAGE]; extern DTCEntry_s DTCStorage[MAX_DTC_STORAGE];
#endif #endif

View File

@@ -10,32 +10,6 @@ void RunLubeApp(uint32_t add_milimeters)
MaintainDTC(DTC_TANK_EMPTY, DTC_CRITICAL, (PersistenceData.tankRemain_microL < LubeConfig.amountPerDose_microL)); MaintainDTC(DTC_TANK_EMPTY, DTC_CRITICAL, (PersistenceData.tankRemain_microL < LubeConfig.amountPerDose_microL));
MaintainDTC(DTC_TANK_LOW, DTC_WARN, (globals.TankPercentage < LubeConfig.TankRemindAtPercentage)); MaintainDTC(DTC_TANK_LOW, DTC_WARN, (globals.TankPercentage < LubeConfig.TankRemindAtPercentage));
static tSystem_Status preserverSysStatusError;
if (getlastDTC(false) < DTC_LAST_DTC)
{
globals.hasDTC = true;
if (getlastDTC_Severity(true, DTC_CRITICAL) < DTC_LAST_DTC)
{
if (globals.systemStatus != sysStat_Error)
{
preserverSysStatusError = globals.systemStatus;
}
globals.systemStatus = sysStat_Error;
}
else
{
if (globals.systemStatus == sysStat_Error)
{
globals.systemStatus = preserverSysStatusError;
}
}
}
else
{
globals.hasDTC = false;
}
// Add traveled Distance in mm // Add traveled Distance in mm
PersistenceData.TravelDistance_highRes_mm += add_milimeters; PersistenceData.TravelDistance_highRes_mm += add_milimeters;
PersistenceData.odometer_mm += add_milimeters; PersistenceData.odometer_mm += add_milimeters;

View File

@@ -185,7 +185,6 @@ void loop()
} }
RunLubeApp(wheelDistance); RunLubeApp(wheelDistance);
EEPROMCyclicPDSTicker.update();
#ifdef FEATURE_ENABLE_OLED #ifdef FEATURE_ENABLE_OLED
Display_Process(); Display_Process();
#endif #endif
@@ -193,9 +192,10 @@ void loop()
LED_Process(); LED_Process();
EEPROM_Process(); EEPROM_Process();
Webserver_Process(); Webserver_Process();
DTC_Process();
ArduinoOTA.handle(); ArduinoOTA.handle();
EEPROMCyclicPDSTicker.update();
#ifdef FEATURE_ENABLE_WIFI_CLIENT #ifdef FEATURE_ENABLE_WIFI_CLIENT
WiFiMaintainConnectionTicker.update(); WiFiMaintainConnectionTicker.update();
#endif #endif

View File

@@ -256,7 +256,7 @@ void WebserverPOST_Callback(AsyncWebServerRequest *request)
{ {
request->send(LittleFS, "/post.htm", "text/html", false, processor); request->send(LittleFS, "/post.htm", "text/html", false, processor);
Serial.print("POST:\n"); Debug_pushMessage("POST:\n");
int paramsNr = request->params(); int paramsNr = request->params();
for (int i = 0; i < paramsNr; i++) for (int i = 0; i < paramsNr; i++)
{ {