Speeduino
Loading...
Searching...
No Matches
errors.h
Go to the documentation of this file.
1#ifndef ERRORS_H
2#define ERRORS_H
3
4/*
5 * Up to 64 different error codes may be defined (6 bits)
6 */
7#define ERR_NONE 0 //No error
8#define ERR_UNKNOWN 1 //Unknown error
9#define ERR_IAT_SHORT 2 //Inlet sensor shorted
10#define ERR_IAT_GND 3 //Inlet sensor grounded
11#define ERR_CLT_SHORT 4 //Coolant sensor shorted
12#define ERR_CLT_GND 5 //Coolant Sensor grounded
13#define ERR_O2_SHORT 6 //O2 sensor shorted
14#define ERR_O2_GND 7 //O2 sensor grounded
15#define ERR_TPS_SHORT 8 //TPS shorted (Is potentially valid)
16#define ERR_TPS_GND 9 //TPS grounded (Is potentially valid)
17#define ERR_BAT_HIGH 10 //Battery voltage is too high
18#define ERR_BAT_LOW 11 //Battery voltage is too low
19#define ERR_MAP_HIGH 12 //MAP output is too high
20#define ERR_MAP_LOW 13 //MAP output is too low
21
22#define ERR_DEFAULT_IAT_SHORT 80 //Note that the default is 40C. 80 is used due to the -40 offset
23#define ERR_DEFAULT_IAT_GND 80 //Note that the default is 40C. 80 is used due to the -40 offset
24#define ERR_DEFAULT_CKT_SHORT 80 //Note that the default is 40C. 80 is used due to the -40 offset
25#define ERR_DEFAULT_CLT_GND 80 //Note that the default is 40C. 80 is used due to the -40 offset
26#define ERR_DEFAULT_O2_SHORT 147 //14.7
27#define ERR_DEFAULT_O2_GND 147 //14.7
28#define ERR_DEFAULT_TPS_SHORT 50 //50%
29#define ERR_DEFAULT_TPS_GND 50 //50%
30#define ERR_DEFAULT_BAT_HIGH 130 //13v
31#define ERR_DEFAULT_BAT_LOW 130 //13v
32#define ERR_DEFAULT_MAP_HIGH 240
33#define ERR_DEFAULT_MAP_LOW 80
34
35
36#define MAX_ERRORS 4 //The number of errors the system can hold simultaneously. Should be a power of 2
37
38/*
39 * This struct is a single byte in length and is sent to TS
40 * The first 2 bits are used to define the current error (0-3)
41 * The remaining 6 bits are used to give the error number
42 */
44{
45 byte errorNum : 2;
46 byte errorID : 6;
47};
48
49byte getNextError(void);
50byte setError(byte errorID);
51void clearError(byte errorID);
52
53extern byte errorCount;
54
55#endif
void clearError(byte errorID)
Definition errors.cpp:28
byte getNextError(void)
Definition errors.cpp:52
byte setError(byte errorID)
Definition errors.cpp:17
byte errorCount
Definition errors.cpp:14
Definition errors.h:44
byte errorID
Definition errors.h:46
byte errorNum
Definition errors.h:45