11#include <SimplyAtomic.h>
17#define BIT_ENGINE_RUN 0
18#define BIT_ENGINE_CRANK 1
19#define BIT_ENGINE_ASE 2
20#define BIT_ENGINE_WARMUP 3
21#define BIT_ENGINE_ACC 4
22#define BIT_ENGINE_DCC 5
23#define BIT_ENGINE_MAPACC 6
24#define BIT_ENGINE_MAPDCC 7
27#define BIT_STATUS1_INJ1 0
28#define BIT_STATUS1_INJ2 1
29#define BIT_STATUS1_INJ3 2
30#define BIT_STATUS1_INJ4 3
31#define BIT_STATUS1_DFCO 4
32#define BIT_STATUS1_BOOSTCUT 5
33#define BIT_STATUS1_TOOTHLOG1READY 6
34#define BIT_STATUS1_TOOTHLOG2READY 7
37#define BIT_STATUS2_HLAUNCH 0
38#define BIT_STATUS2_SLAUNCH 1
39#define BIT_STATUS2_HRDLIM 2
40#define BIT_STATUS2_SFTLIM 3
41#define BIT_STATUS2_BOOSTCUT 4
42#define BIT_STATUS2_ERROR 5
43#define BIT_STATUS2_IDLE 6
44#define BIT_STATUS2_SYNC 7
47#define BIT_STATUS3_RESET_PREVENT 0
48#define BIT_STATUS3_NITROUS 1
49#define BIT_STATUS3_FUEL2_ACTIVE 2
50#define BIT_STATUS3_VSS_REFRESH 3
51#define BIT_STATUS3_HALFSYNC 4
52#define BIT_STATUS3_NSQUIRTS1 5
53#define BIT_STATUS3_UNUSED1 6
54#define BIT_STATUS3_UNUSED2 7
57#define BIT_STATUS4_WMI_EMPTY 0
58#define BIT_STATUS4_VVT1_ERROR 1
59#define BIT_STATUS4_VVT2_ERROR 2
60#define BIT_STATUS4_FAN 3
61#define BIT_STATUS4_BURNPENDING 4
62#define BIT_STATUS4_STAGING_ACTIVE 5
63#define BIT_STATUS4_COMMS_COMPAT 6
64#define BIT_STATUS4_ALLOW_LEGACY_COMMS 7
67#define BIT_STATUS5_FLATSH 0
68#define BIT_STATUS5_FLATSS 1
69#define BIT_STATUS5_SPARK2_ACTIVE 2
70#define BIT_STATUS5_KNOCK_ACTIVE 3
71#define BIT_STATUS5_KNOCK_PULSE 4
72#define BIT_STATUS5_UNUSED6 5
73#define BIT_STATUS5_UNUSED7 6
74#define BIT_STATUS5_UNUSED8 7
76#define BIT_AIRCON_REQUEST 0
77#define BIT_AIRCON_COMPRESSOR 1
78#define BIT_AIRCON_RPM_LOCKOUT 2
79#define BIT_AIRCON_TPS_LOCKOUT 3
80#define BIT_AIRCON_TURNING_ON 4
81#define BIT_AIRCON_CLT_LOCKOUT 5
82#define BIT_AIRCON_FAN 6
83#define BIT_AIRCON_UNUSED8 7
85#define ENGINE_PROTECT_BIT_RPM 0
86#define ENGINE_PROTECT_BIT_MAP 1
87#define ENGINE_PROTECT_BIT_OIL 2
88#define ENGINE_PROTECT_BIT_AFR 3
89#define ENGINE_PROTECT_BIT_COOLANT 4
#define BIT_CHECK(var, pos)
Is bit pos (0-7) in byte var set?
Definition bit_manip.h:15
uint8_t byte
Definition config_pages.h:15
static uint32_t rshift(uint32_t a)
Bitwise right shift - generic, unoptimized, case.
Definition bit_shifts.h:349
static bool HasAnySync(const statuses &status)
Definition statuses.h:238
#define BIT_STATUS3_HALFSYNC
Definition statuses.h:51
static bool HasAnySyncUnsafe(const statuses &status)
Non-atomic version of HasAnySync. **Should only be called in an ATOMIC() block***.
Definition statuses.h:234
The status struct with current values for all 'live' variables.
Definition statuses.h:98
byte dwellCorrection
Definition statuses.h:143
uint16_t baroADC
Definition statuses.h:120
volatile byte syncLossCounter
Definition statuses.h:204
byte ASEValue
Definition statuses.h:213
int16_t vvt2Angle
Definition statuses.h:222
byte testOutputs
Test Output bits (only first bit used/tested ?)
Definition statuses.h:190
volatile bool hasSync
Definition statuses.h:100
uint16_t canin[16]
16bit raw value of selected canin data for channels 0-15
Definition statuses.h:194
byte oilPressure
Definition statuses.h:218
uint8_t current_caninchannel
Definition statuses.h:195
bool launchingSoft
Definition statuses.h:183
int16_t EMAP
EMAP ... (See config6::useEMAP for EMAP enablement)
Definition statuses.h:122
unsigned int PW3
In uS.
Definition statuses.h:174
byte launchCorrection
Definition statuses.h:155
unsigned int PW6
In uS.
Definition statuses.h:177
bool idleUpActive
Definition statuses.h:161
long vvt1Duty
Definition statuses.h:211
bool CTPSActive
Definition statuses.h:162
unsigned int PW8
In uS.
Definition statuses.h:179
byte CLIdleTarget
Definition statuses.h:160
byte vvt2TargetAngle
Definition statuses.h:223
volatile byte status5
Status 5 ... (See also config10 Status 5* members and BIT_STATU5_* defines)
Definition statuses.h:170
byte TPSlast
Definition statuses.h:127
bool clutchTrigger
Definition statuses.h:105
bool testActive
Definition statuses.h:191
bool idleUpOutputActive
Definition statuses.h:215
unsigned long AEEndTime
Definition statuses.h:165
byte baroCorrection
Definition statuses.h:154
bool flatShiftingHard
Definition statuses.h:187
int16_t vvt1Angle
Definition statuses.h:209
unsigned int PW4
In uS.
Definition statuses.h:175
byte VE2
Definition statuses.h:132
byte flexCorrection
Definition statuses.h:156
volatile uint16_t loopsPerSecond
Definition statuses.h:182
bool toothLogEnabled
Definition statuses.h:207
byte VE1
Definition statuses.h:131
int IAT
Definition statuses.h:137
int16_t mapDOT
Definition statuses.h:128
byte wueCorrection
Definition statuses.h:151
byte batCorrection
Definition statuses.h:152
int8_t advance
Definition statuses.h:145
unsigned int PW1
In uS.
Definition statuses.h:172
uint16_t dwell
dwell (coil primary winding/circuit on) time (in ms * 10 ? See correctionsDwell)
Definition statuses.h:141
uint8_t tpsADC
Definition statuses.h:125
uint8_t engine
Engine status bits (See BIT_ENGINE_* defines on top of this file)
Definition statuses.h:171
volatile byte knockCount
Definition statuses.h:206
byte nSquirts
Number of injector squirts per cycle (per injector)
Definition statuses.h:199
int8_t advance2
Definition statuses.h:147
volatile byte status4
Status bits (See BIT_STATUS4_* defines on top of this file)
Definition statuses.h:169
uint16_t vss
Definition statuses.h:214
byte knockRetard
Definition statuses.h:205
byte TS_SD_Status
Definition statuses.h:226
uint16_t boostTarget
Definition statuses.h:189
bool fuelPumpOn
Definition statuses.h:203
byte gear
Definition statuses.h:216
volatile bool injPrimed
Tracks whether or not the injector priming has been completed yet.
Definition statuses.h:111
volatile byte secl
Definition statuses.h:181
byte airConStatus
Definition statuses.h:227
int coolant
Definition statuses.h:135
byte VE
Definition statuses.h:130
volatile uint16_t actualDwell
actual dwell time if new ignition mode is used (in uS)
Definition statuses.h:142
byte fuelPressure
Definition statuses.h:217
unsigned int clutchEngagedRPM
Definition statuses.h:186
volatile uint32_t startRevolutions
Definition statuses.h:188
unsigned int PW5
In uS.
Definition statuses.h:176
volatile bool tachoAlt
Definition statuses.h:115
uint16_t boostDuty
Boost Duty percentage value * 100 to give 2 points of precision.
Definition statuses.h:192
bool previousClutchTrigger
Definition statuses.h:107
byte battery10
Definition statuses.h:144
volatile byte runSecs
Definition statuses.h:180
uint16_t iatADC
Definition statuses.h:138
int8_t advance1
Definition statuses.h:146
uint16_t RPM
RPM - Current Revs per minute.
Definition statuses.h:117
long longRPM
RPM as long int (gets assigned to / maintained in statuses.RPM as well)
Definition statuses.h:119
byte wmiPW
Definition statuses.h:221
volatile int8_t fuelTemp
Definition statuses.h:164
byte vvt1TargetAngle
Definition statuses.h:210
byte RPMdiv100
RPM value scaled (divided by 100) to fit a byte (0-255, e.g. 12000 => 120)
Definition statuses.h:118
uint16_t corrections
Definition statuses.h:148
long vvt2Duty
Definition statuses.h:224
byte fanDuty
Definition statuses.h:220
uint8_t TPS
Definition statuses.h:124
byte outputsStatus
Definition statuses.h:225
byte afrTarget
Definition statuses.h:159
volatile byte status3
Status bits (See BIT_STATUS3_* defines on top of this file)
Definition statuses.h:168
bool launchingHard
Definition statuses.h:184
volatile int rpmDOT
Definition statuses.h:129
byte fuelTempCorrection
Definition statuses.h:157
int16_t fuelLoad
Definition statuses.h:201
byte nChannels
Definition statuses.h:200
byte nitrous_status
Definition statuses.h:198
unsigned int PW2
In uS.
Definition statuses.h:173
volatile bool fpPrimed
Tracks whether or not the fuel pump priming has been completed yet.
Definition statuses.h:109
int16_t tpsDOT
Definition statuses.h:126
uint8_t O2_2
Definition statuses.h:134
uint16_t freeRAM
Definition statuses.h:185
int16_t ignLoad
Definition statuses.h:202
byte compositeTriggerUsed
Definition statuses.h:208
byte egoCorrection
Definition statuses.h:150
int16_t flexBoostCorrection
Definition statuses.h:197
bool initialisationComplete
Tracks whether the setup() function has run completely.
Definition statuses.h:103
int8_t flexIgnCorrection
Definition statuses.h:158
byte idleLoad
Either the current steps or current duty cycle for the idle control.
Definition statuses.h:193
uint16_t O2_2ADC
Definition statuses.h:140
byte iatCorrection
Definition statuses.h:153
uint8_t O2
Definition statuses.h:133
uint16_t injAngle
Definition statuses.h:212
long MAP
Manifold absolute pressure. Has to be a long for PID calcs (Boost control)
Definition statuses.h:121
volatile bool tachoSweepEnabled
Definition statuses.h:113
uint16_t crankRPM
Definition statuses.h:196
uint8_t baro
Barometric pressure is simply the initial MAP reading, taken before the engine is running....
Definition statuses.h:123
volatile byte ethanolPct
Definition statuses.h:163
unsigned int PW7
In uS.
Definition statuses.h:178
uint16_t AEamount
Definition statuses.h:149
byte engineProtectStatus
Definition statuses.h:219
volatile byte status2
status 2/control indicator bits (launch control, boost cut, spark errors, See BIT_STATUS2_* defines)
Definition statuses.h:167
uint16_t cltADC
Definition statuses.h:136
uint16_t O2ADC
Definition statuses.h:139
volatile byte status1
Status bits (See BIT_STATUS1_* defines on top of this file)
Definition statuses.h:166