-
Notifications
You must be signed in to change notification settings - Fork 1
/
ECM.h
72 lines (64 loc) · 1.47 KB
/
ECM.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#ifndef ECM_h
#define ECM_h
#include <arduino.h>
#include "enums.h"
#include <EEPROM.h>
#define MEM_LOCATION_CHECKBYTE 0
#define MEM_LOCATION_BOOST 1
#define MEM_LOCATION_SPARK_MAP 2
class ECM
{
private:
byte checkbyte = 0x03; //Increment this to rewrite new EEPROM values from code
int32_t _rpm = 0;
byte _map = 100;
byte _baro = 100;
int8_t _clt = 21;
int8_t _ait = 21;
byte _oilp = 0;
float _afr = 22.0f;
float _lambda = 1.0f;
byte _boostpercent = 0;
bool _sparkmap = false;
float _fuelusage = 0; //@@TODO make screen for this and implement mpg etc
int32_t _speed = 0;
bool _mutex = false;
public:
ECM();
//Getters
int32_t RPM();
byte MAP();
byte BARO();
int8_t CLT();
int8_t AIT();
byte OIL_PRESSURE();
float AFR();
float LAMBDA();
byte BOOST_PERCENT();
bool SPARK_MAP();
float FUEL_USAGE();
int32_t SPEED();
bool LOCKED();
byte IGNITION_SWITCH_CAN_OUT();
byte BOOST_PRESSURE_CAN_OUT();
//Setter Functions
void SET_BOOST_PERCENTAGE(byte);
void SET_BOOST_PRESSURE(DIRECTION);
void SET_SPARK_MAP();
void LOAD_SPARK_MAP(bool);
void LOCK();
void UNLOCK();
void RPM(byte, byte);
void MAP(byte);
void BARO(byte);
void CLT(byte);
void AIT(byte);
void OIL_PRESSURE(byte);
void AFR(byte);
void LAMBDA(byte);
void SPEED(byte, byte);
void SetupEEPROM();
void ReadEEPROM();
void WriteEEPROM();
};
#endif