DTCs now hav severity and improved DTCMaintenance
This commit is contained in:
parent
808709f5c2
commit
bd4c1d9d53
@ -75,13 +75,25 @@
|
|||||||
<table class="table">
|
<table class="table">
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<th class="col-md-4" scope="col">Timestamp</th>
|
<th class="col-md-3" scope="col">Zeitstempel</th>
|
||||||
<th class="col-md-4" scope="col">DTC</th>
|
<th class="col-md-3" scope="col">Fehlercode</th>
|
||||||
<th class="col-md-4" scope="col">active</th>
|
<th class="col-md-3" scope="col">Schwere</th>
|
||||||
|
<th class="col-md-3" scope="col">Aktiv</th>
|
||||||
</tr>
|
</tr>
|
||||||
%DTC_TABLE%
|
%DTC_TABLE%
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
<p>
|
||||||
|
<button class="btn btn-primary" type="button" data-toggle="collapse" data-target="#collapseDTCDescription"
|
||||||
|
aria-expanded="false" aria-controls="collapseDTCDescription">
|
||||||
|
DTC Beschreibung
|
||||||
|
</button>
|
||||||
|
</p>
|
||||||
|
<div class="collapse" id="collapseDTCDescription">
|
||||||
|
<div class="card card-body">
|
||||||
|
<embed type="text/html" src="static/dtc.txt" width="100%">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
12
Software/data/static/dtc.txt
Normal file
12
Software/data/static/dtc.txt
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
1 - TANK_EMPTY
|
||||||
|
2 - DTC_TANK_LOW
|
||||||
|
3 - DTC_NO_EEPROM_FOUND
|
||||||
|
4 - DTC_EEPROM_CFG_BAD
|
||||||
|
5 - DTC_EEPROM_PDS_BAD
|
||||||
|
6 - DTC_EEPROM_PDSADRESS_BAD
|
||||||
|
7 - DTC_EEPROM_VERSION_BAD
|
||||||
|
8 - DTC_FLASHFS_ERROR
|
||||||
|
9 - DTC_FLASHFS_VERSION_ERROR
|
||||||
|
10 - DTC_NO_GPS_SERIAL
|
||||||
|
11 - DTC_CAN_TRANSCEIVER_FAILED
|
||||||
|
12 - DTC_NO_CAN_SIGNAL
|
BIN
Software/data/static/img/critical.png
Normal file
BIN
Software/data/static/img/critical.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 7.9 KiB |
BIN
Software/data/static/img/info.png
Normal file
BIN
Software/data/static/img/info.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 9.6 KiB |
BIN
Software/data/static/img/warn.png
Normal file
BIN
Software/data/static/img/warn.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 9.4 KiB |
@ -7,7 +7,7 @@ void Init_CAN()
|
|||||||
{
|
{
|
||||||
|
|
||||||
if (CAN0.begin(MCP_STDEXT, CAN_500KBPS, MCP_16MHZ) != CAN_OK)
|
if (CAN0.begin(MCP_STDEXT, CAN_500KBPS, MCP_16MHZ) != CAN_OK)
|
||||||
MaintainDTC(DTC_CAN_TRANSCEIVER_FAILED, true);
|
MaintainDTC(DTC_CAN_TRANSCEIVER_FAILED, DTC_CRITICAL, true);
|
||||||
|
|
||||||
CAN0.init_Mask(0, 0, 0x07FF0000); // Init first mask...
|
CAN0.init_Mask(0, 0, 0x07FF0000); // Init first mask...
|
||||||
CAN0.init_Mask(1, 0, 0x07FF0000); // Init second mask...
|
CAN0.init_Mask(1, 0, 0x07FF0000); // Init second mask...
|
||||||
@ -39,7 +39,7 @@ uint32_t Process_CAN_WheelSpeed()
|
|||||||
return milimeters_to_add;
|
return milimeters_to_add;
|
||||||
}
|
}
|
||||||
|
|
||||||
MaintainDTC(DTC_NO_CAN_SIGNAL, (millis() > lastRecTimestamp + 10000 ? true : false));
|
MaintainDTC(DTC_NO_CAN_SIGNAL, DTC_CRITICAL, (millis() > lastRecTimestamp + 10000 ? true : false));
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -84,8 +84,7 @@ void GetConfig_EEPROM()
|
|||||||
|
|
||||||
if (Checksum_EEPROM((uint8_t *)&LubeConfig, sizeof(LubeConfig)) != checksum)
|
if (Checksum_EEPROM((uint8_t *)&LubeConfig, sizeof(LubeConfig)) != checksum)
|
||||||
{
|
{
|
||||||
MaintainDTC(DTC_EEPROM_CFG_BAD, true);
|
MaintainDTC(DTC_EEPROM_CFG_BAD, DTC_CRITICAL, true);
|
||||||
FormatConfig_EEPROM();
|
|
||||||
}
|
}
|
||||||
LubeConfig.checksum = checksum;
|
LubeConfig.checksum = checksum;
|
||||||
}
|
}
|
||||||
@ -118,7 +117,7 @@ void GetPersistence_EEPROM()
|
|||||||
{
|
{
|
||||||
MovePersistencePage_EEPROM(true);
|
MovePersistencePage_EEPROM(true);
|
||||||
FormatPersistence_EEPROM();
|
FormatPersistence_EEPROM();
|
||||||
MaintainDTC(DTC_EEPROM_PDSADRESS_BAD, true);
|
MaintainDTC(DTC_EEPROM_PDSADRESS_BAD, DTC_CRITICAL, true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -129,7 +128,7 @@ void GetPersistence_EEPROM()
|
|||||||
|
|
||||||
if (Checksum_EEPROM((uint8_t *)&PersistenceData, sizeof(PersistenceData)) != checksum)
|
if (Checksum_EEPROM((uint8_t *)&PersistenceData, sizeof(PersistenceData)) != checksum)
|
||||||
{
|
{
|
||||||
MaintainDTC(DTC_EEPROM_PDS_BAD, true);
|
MaintainDTC(DTC_EEPROM_PDS_BAD, DTC_CRITICAL, true);
|
||||||
}
|
}
|
||||||
PersistenceData.checksum = checksum;
|
PersistenceData.checksum = checksum;
|
||||||
}
|
}
|
||||||
@ -224,10 +223,10 @@ boolean checkEEPROMavailable()
|
|||||||
{
|
{
|
||||||
if (!ee.isConnected())
|
if (!ee.isConnected())
|
||||||
{
|
{
|
||||||
MaintainDTC(DTC_NO_EEPROM_FOUND, true);
|
MaintainDTC(DTC_NO_EEPROM_FOUND, DTC_CRITICAL, true);
|
||||||
globals.systemStatus = sysStat_Error;
|
globals.systemStatus = sysStat_Error;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
MaintainDTC(DTC_NO_EEPROM_FOUND, false);
|
MaintainDTC(DTC_NO_EEPROM_FOUND, DTC_CRITICAL, false);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
DTCEntry_s DTCStorage[MAX_DTC_STORAGE];
|
DTCEntry_s DTCStorage[MAX_DTC_STORAGE];
|
||||||
|
|
||||||
void MaintainDTC(DTCNums_t DTC_no, boolean active)
|
void MaintainDTC(DTCNums_t DTC_no, DTCSeverity_t DTC_severity, boolean active)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < MAX_DTC_STORAGE; i++)
|
for (int i = 0; i < MAX_DTC_STORAGE; i++)
|
||||||
{
|
{
|
||||||
@ -13,6 +13,7 @@ void MaintainDTC(DTCNums_t DTC_no, boolean active)
|
|||||||
Serial.printf("DTC gone active: %d\n", DTC_no);
|
Serial.printf("DTC gone active: %d\n", DTC_no);
|
||||||
DTCStorage[i].timestamp = millis();
|
DTCStorage[i].timestamp = millis();
|
||||||
DTCStorage[i].active = DTC_ACTIVE;
|
DTCStorage[i].active = DTC_ACTIVE;
|
||||||
|
DTCStorage[i].severity = DTC_severity;
|
||||||
}
|
}
|
||||||
if (!active && DTCStorage[i].active == DTC_ACTIVE)
|
if (!active && DTCStorage[i].active == DTC_ACTIVE)
|
||||||
{
|
{
|
||||||
@ -81,5 +82,25 @@ DTCNums_t getlastDTC(boolean only_active)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return pointer >= 0 ? DTCStorage[pointer].Number : DTC_LAST_DTC;
|
||||||
|
}
|
||||||
|
|
||||||
|
DTCNums_t getlastDTC_Severity(boolean only_active, DTCSeverity_t severity)
|
||||||
|
{
|
||||||
|
int8_t pointer = -1;
|
||||||
|
uint32_t lasttimestamp = 0;
|
||||||
|
|
||||||
|
for (int i = 0; i < MAX_DTC_STORAGE; i++)
|
||||||
|
{
|
||||||
|
if (DTCStorage[i].Number > 0 && DTCStorage[i].timestamp > lasttimestamp)
|
||||||
|
{
|
||||||
|
if ((only_active == false || DTCStorage[i].active == DTC_ACTIVE) && DTCStorage[i].severity == severity)
|
||||||
|
{
|
||||||
|
pointer = i;
|
||||||
|
lasttimestamp = DTCStorage[i].timestamp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return pointer >= 0 ? DTCStorage[pointer].Number : DTC_LAST_DTC;
|
return pointer >= 0 ? DTCStorage[pointer].Number : DTC_LAST_DTC;
|
||||||
}
|
}
|
@ -8,6 +8,7 @@
|
|||||||
typedef enum DTCNums_e
|
typedef enum DTCNums_e
|
||||||
{
|
{
|
||||||
DTC_TANK_EMPTY = 1,
|
DTC_TANK_EMPTY = 1,
|
||||||
|
DTC_TANK_LOW,
|
||||||
DTC_NO_EEPROM_FOUND,
|
DTC_NO_EEPROM_FOUND,
|
||||||
DTC_EEPROM_CFG_BAD,
|
DTC_EEPROM_CFG_BAD,
|
||||||
DTC_EEPROM_PDS_BAD,
|
DTC_EEPROM_PDS_BAD,
|
||||||
@ -31,17 +32,26 @@ typedef enum DTCActive_e
|
|||||||
DTC_PREVIOUS
|
DTC_PREVIOUS
|
||||||
} DTCActive_t;
|
} DTCActive_t;
|
||||||
|
|
||||||
|
typedef enum DTCSeverity_e
|
||||||
|
{
|
||||||
|
DTC_INFO,
|
||||||
|
DTC_WARN,
|
||||||
|
DTC_CRITICAL
|
||||||
|
} DTCSeverity_t;
|
||||||
|
|
||||||
typedef struct DTCEntry_s
|
typedef struct DTCEntry_s
|
||||||
{
|
{
|
||||||
DTCNums_t Number;
|
DTCNums_t Number;
|
||||||
uint32_t timestamp;
|
uint32_t timestamp;
|
||||||
DTCActive_t active;
|
DTCActive_t active;
|
||||||
|
DTCSeverity_t severity;
|
||||||
} DTCEntry_t;
|
} DTCEntry_t;
|
||||||
|
|
||||||
void MaintainDTC(DTCNums_t DTC_no, boolean active);
|
void MaintainDTC(DTCNums_t DTC_no, DTCSeverity_t DTC_severity, boolean active);
|
||||||
void ClearDTC(DTCNums_t DTC_no);
|
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);
|
||||||
|
|
||||||
extern DTCEntry_s DTCStorage[MAX_DTC_STORAGE];
|
extern DTCEntry_s DTCStorage[MAX_DTC_STORAGE];
|
||||||
#endif
|
#endif
|
@ -33,6 +33,8 @@ typedef struct Globals_s
|
|||||||
char DeviceName[33];
|
char DeviceName[33];
|
||||||
uint32_t FlashVersion;
|
uint32_t FlashVersion;
|
||||||
uint16_t eePersistanceAdress;
|
uint16_t eePersistanceAdress;
|
||||||
|
uint8_t TankPercentage;
|
||||||
|
bool hasDTC;
|
||||||
} Globals_t;
|
} Globals_t;
|
||||||
|
|
||||||
extern Globals_t globals;
|
extern Globals_t globals;
|
||||||
|
@ -51,7 +51,7 @@ uint32_t Process_GPS_WheelSpeed()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MaintainDTC(DTC_NO_GPS_SERIAL, (millis() > lastRecTimestamp + 10000));
|
MaintainDTC(DTC_NO_GPS_SERIAL,DTC_CRITICAL, (millis() > lastRecTimestamp + 10000));
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -5,23 +5,35 @@ uint32_t lubePulseTimestamp = 0;
|
|||||||
void RunLubeApp(uint32_t add_milimeters)
|
void RunLubeApp(uint32_t add_milimeters)
|
||||||
{
|
{
|
||||||
|
|
||||||
MaintainDTC(DTC_TANK_EMPTY, (PersistenceData.tankRemain_µl < LubeConfig.amountPerDose_µl));
|
globals.TankPercentage = PersistenceData.tankRemain_µl / (LubeConfig.tankCapacity_ml * 1000);
|
||||||
|
|
||||||
|
MaintainDTC(DTC_TANK_EMPTY, DTC_CRITICAL, (PersistenceData.tankRemain_µl < LubeConfig.amountPerDose_µl));
|
||||||
|
MaintainDTC(DTC_TANK_LOW, DTC_WARN, (globals.TankPercentage < LubeConfig.TankRemindAtPercentage));
|
||||||
|
|
||||||
static tSystem_Status preserverSysStatusError;
|
static tSystem_Status preserverSysStatusError;
|
||||||
|
|
||||||
if (globals.systemStatus != sysStat_Error)
|
if (getlastDTC(false) < DTC_LAST_DTC)
|
||||||
preserverSysStatusError = globals.systemStatus;
|
|
||||||
|
|
||||||
if (getlastDTC(true) < DTC_LAST_DTC)
|
|
||||||
{
|
{
|
||||||
globals.systemStatus = sysStat_Error;
|
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
|
else
|
||||||
{
|
{
|
||||||
if (globals.systemStatus == sysStat_Error)
|
globals.hasDTC = false;
|
||||||
{
|
|
||||||
globals.systemStatus = preserverSysStatusError;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add traveled Distance in mm
|
// Add traveled Distance in mm
|
||||||
|
@ -506,14 +506,12 @@ void LED_Process(uint8_t override, CRGB SetColor)
|
|||||||
oldSysStatus = globals.systemStatus;
|
oldSysStatus = globals.systemStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t percentage = PersistenceData.tankRemain_µl / (LubeConfig.tankCapacity_ml * 1000);
|
|
||||||
|
|
||||||
switch (LED_Status)
|
switch (LED_Status)
|
||||||
{
|
{
|
||||||
case LED_Startup:
|
case LED_Startup:
|
||||||
FastLED.setBrightness(255);
|
FastLED.setBrightness(255);
|
||||||
|
|
||||||
if (percentage < LubeConfig.TankRemindAtPercentage)
|
if (globals.TankPercentage < LubeConfig.TankRemindAtPercentage)
|
||||||
leds[0] = CRGB::OrangeRed;
|
leds[0] = CRGB::OrangeRed;
|
||||||
else
|
else
|
||||||
leds[0] = CRGB::White;
|
leds[0] = CRGB::White;
|
||||||
|
@ -16,7 +16,7 @@ void initWebUI()
|
|||||||
if (!LittleFS.begin())
|
if (!LittleFS.begin())
|
||||||
{
|
{
|
||||||
Serial.println("An Error has occurred while mounting LittleFS");
|
Serial.println("An Error has occurred while mounting LittleFS");
|
||||||
MaintainDTC(DTC_FLASHFS_ERROR, true);
|
MaintainDTC(DTC_FLASHFS_ERROR, DTC_CRITICAL, true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -117,7 +117,7 @@ String processor(const String &var)
|
|||||||
return "hidden";
|
return "hidden";
|
||||||
#endif
|
#endif
|
||||||
if (var == "SHOW_DTC_TABLE")
|
if (var == "SHOW_DTC_TABLE")
|
||||||
return globals.systemStatus == sysStat_Error ? "" : "hidden";
|
return globals.hasDTC ? "" : "hidden";
|
||||||
|
|
||||||
if (var == "DTC_TABLE")
|
if (var == "DTC_TABLE")
|
||||||
{
|
{
|
||||||
@ -137,6 +137,20 @@ String processor(const String &var)
|
|||||||
|
|
||||||
temp = temp + "<tr><td>" + String(buff_timestamp);
|
temp = temp + "<tr><td>" + String(buff_timestamp);
|
||||||
temp = temp + "</td><td>" + String(DTCStorage[i].Number) + "</td><td>";
|
temp = temp + "</td><td>" + String(DTCStorage[i].Number) + "</td><td>";
|
||||||
|
temp = temp + "<img src=static/img/";
|
||||||
|
switch (DTCStorage[i].severity)
|
||||||
|
{
|
||||||
|
case DTC_CRITICAL:
|
||||||
|
temp = temp + "critical";
|
||||||
|
break;
|
||||||
|
case DTC_WARN:
|
||||||
|
temp = temp + "warn";
|
||||||
|
break;
|
||||||
|
case DTC_INFO:
|
||||||
|
temp = temp + "info";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
temp = temp + "_black.png></td><td>";
|
||||||
|
|
||||||
if (DTCStorage[i].active == DTC_ACTIVE)
|
if (DTCStorage[i].active == DTC_ACTIVE)
|
||||||
temp = temp + "active";
|
temp = temp + "active";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user