added dtcs for Signal-Timeout and empty tank
This commit is contained in:
parent
0bc6d01a5f
commit
7a84b80126
@ -39,5 +39,19 @@ uint32_t Process_CAN_WheelSpeed()
|
|||||||
|
|
||||||
return milimeters_to_add;
|
return milimeters_to_add;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (millis() > lastRecTimestamp + 10000)
|
||||||
|
{
|
||||||
|
if (globals.systemStatus != sysStat_Shutdown)
|
||||||
|
globals.systemStatus = sysStat_Error;
|
||||||
|
MaintainDTC(DTC_NO_CAN_SIGNAL, true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (globals.systemStatus != sysStat_Shutdown)
|
||||||
|
globals.systemStatus = globals.resumeStatus;
|
||||||
|
MaintainDTC(DTC_NO_CAN_SIGNAL, false);
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,8 @@
|
|||||||
#include <mcp_can.h>
|
#include <mcp_can.h>
|
||||||
#include <SPI.h>
|
#include <SPI.h>
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
#include "globals.h"
|
||||||
|
#include "dtc.h"
|
||||||
|
|
||||||
struct can_frame
|
struct can_frame
|
||||||
{
|
{
|
||||||
|
@ -6,6 +6,8 @@
|
|||||||
#define MAX_DTC_STORAGE 16
|
#define MAX_DTC_STORAGE 16
|
||||||
|
|
||||||
#define DTC_NO_GPS_SERIAL 100
|
#define DTC_NO_GPS_SERIAL 100
|
||||||
|
#define DTC_NO_CAN_SIGNAL 101
|
||||||
|
#define DTC_TANK_EMPTY 102
|
||||||
|
|
||||||
typedef enum DTCActive_e
|
typedef enum DTCActive_e
|
||||||
{
|
{
|
||||||
|
@ -52,9 +52,16 @@ uint32_t Process_GPS_WheelSpeed()
|
|||||||
|
|
||||||
if (millis() > lastRecTimestamp + 10000)
|
if (millis() > lastRecTimestamp + 10000)
|
||||||
{
|
{
|
||||||
globals.systemStatus = sysStat_Error;
|
if (globals.systemStatus != sysStat_Shutdown)
|
||||||
|
globals.systemStatus = sysStat_Error;
|
||||||
MaintainDTC(DTC_NO_GPS_SERIAL, true);
|
MaintainDTC(DTC_NO_GPS_SERIAL, true);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (globals.systemStatus != sysStat_Shutdown)
|
||||||
|
globals.systemStatus = globals.resumeStatus;
|
||||||
|
MaintainDTC(DTC_NO_GPS_SERIAL, false);
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,17 @@ uint32_t lubePulseTimestamp = 0;
|
|||||||
|
|
||||||
void RunLubeApp(uint32_t add_milimeters)
|
void RunLubeApp(uint32_t add_milimeters)
|
||||||
{
|
{
|
||||||
|
if (PersistenceData.tankRemain_µl < LubeConfig.amountPerDose_µl)
|
||||||
|
{
|
||||||
|
MaintainDTC(DTC_TANK_EMPTY, true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (globals.systemStatus != sysStat_Shutdown)
|
||||||
|
globals.systemStatus = globals.resumeStatus;
|
||||||
|
MaintainDTC(DTC_TANK_EMPTY, false);
|
||||||
|
}
|
||||||
|
|
||||||
// Add traveled Distance in mm
|
// Add traveled Distance in mm
|
||||||
PersistenceData.TravelDistance_highRes += add_milimeters;
|
PersistenceData.TravelDistance_highRes += add_milimeters;
|
||||||
|
|
||||||
@ -47,6 +58,7 @@ void RunLubeApp(uint32_t add_milimeters)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case sysStat_Error:
|
case sysStat_Error:
|
||||||
|
case sysStat_Shutdown:
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "globals.h"
|
#include "globals.h"
|
||||||
|
#include "dtc.h"
|
||||||
|
|
||||||
#define LUBE_PULSE_LENGHT_MS 160
|
#define LUBE_PULSE_LENGHT_MS 160
|
||||||
#define LUBE_PULSE_PAUSE_MS 100
|
#define LUBE_PULSE_PAUSE_MS 100
|
||||||
|
Loading…
x
Reference in New Issue
Block a user