Speeduino
Loading...
Searching...
No Matches
globals.h
Go to the documentation of this file.
1
25#ifndef GLOBALS_H
26#define GLOBALS_H
27#include <Arduino.h>
28#include <SimplyAtomic.h>
29#include "table2d.h"
30#include "table3d.h"
31#include "src/FastCRC/FastCRC.h"
32
33#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) || defined(__AVR_ATmega2561__)
34 #define BOARD_MAX_DIGITAL_PINS 54 //digital pins +1
35 #define BOARD_MAX_IO_PINS 70 //digital pins + analog channels + 1
36 #define BOARD_MAX_ADC_PINS 15 //Number of analog pins
37 #ifndef LED_BUILTIN
38 #define LED_BUILTIN 13
39 #endif
40 #define CORE_AVR
41 #define BOARD_H "board_avr2560.h"
42 #ifndef INJ_CHANNELS
43 #define INJ_CHANNELS 4
44 #endif
45 #ifndef IGN_CHANNELS
46 #define IGN_CHANNELS 5
47 #endif
48
49 #if defined(__AVR_ATmega2561__)
50 //This is a workaround to avoid having to change all the references to higher ADC channels. We simply define the channels (Which don't exist on the 2561) as being the same as A0-A7
51 //These Analog inputs should never be used on any 2561 board definition (Because they don't exist on the MCU), so it will not cause any issues
52 #define A8 A0
53 #define A9 A1
54 #define A10 A2
55 #define A11 A3
56 #define A12 A4
57 #define A13 A5
58 #define A14 A6
59 #define A15 A7
60 #endif
61
62 //#define TIMER5_MICROS
63
64#elif defined(CORE_TEENSY)
65 #if defined(__MK64FX512__) || defined(__MK66FX1M0__)
66 #define CORE_TEENSY35
67 #define BOARD_H "board_teensy35.h"
68 #elif defined(__IMXRT1062__)
69 #define CORE_TEENSY41
70 #define BOARD_H "board_teensy41.h"
71 #endif
72 #define INJ_CHANNELS 8
73 #define IGN_CHANNELS 8
74
75#elif defined(STM32_MCU_SERIES) || defined(ARDUINO_ARCH_STM32) || defined(STM32)
76 #define BOARD_H "board_stm32_official.h"
77 #define CORE_STM32
78
79 #define BOARD_MAX_ADC_PINS NUM_ANALOG_INPUTS-1 //Number of analog pins from core.
80 #if defined(STM32F407xx) //F407 can do 8x8 STM32F401/STM32F411 don't
81 #define INJ_CHANNELS 8
82 #define IGN_CHANNELS 8
83 #else
84 #define INJ_CHANNELS 4
85 #define IGN_CHANNELS 5
86 #endif
87#elif defined(__SAMD21G18A__)
88 #define BOARD_H "board_samd21.h"
89 #define CORE_SAMD21
90 #define CORE_SAM
91 #define INJ_CHANNELS 4
92 #define IGN_CHANNELS 4
93#elif defined(__SAMC21J18A__)
94 #define BOARD_H "board_samc21.h"
95 #define CORE_SAMC21
96 #define CORE_SAM
97#elif defined(__SAME51J19A__)
98 #define BOARD_H "board_same51.h"
99 #define CORE_SAME51
100 #define CORE_SAM
101 #define INJ_CHANNELS 8
102 #define IGN_CHANNELS 8
103#else
104 #error Incorrect board selected. Please select the correct board (Usually Mega 2560) and upload again
105#endif
106
107//This can only be included after the above section
108#include BOARD_H //Note that this is not a real file, it is defined in globals.h.
109
110//Handy bitsetting macros
111#define BIT_SET(a,b) ((a) |= (1U<<(b)))
112#define BIT_CLEAR(a,b) ((a) &= ~(1U<<(b)))
113#define BIT_CHECK(var,pos) !!((var) & (1U<<(pos)))
114#define BIT_TOGGLE(var,pos) ((var)^= 1UL << (pos))
115#define BIT_WRITE(var, pos, bitvalue) ((bitvalue) ? BIT_SET((var), (pos)) : bitClear((var), (pos)))
116
117#define CRANK_ANGLE_MAX (max(CRANK_ANGLE_MAX_IGN, CRANK_ANGLE_MAX_INJ))
118
119#define interruptSafe(c) (noInterrupts(); {c} interrupts();) //Wraps any code between nointerrupt and interrupt calls
120
121#define MICROS_PER_SEC INT32_C(1000000)
122#define MICROS_PER_MIN INT32_C(MICROS_PER_SEC*60U)
123#define MICROS_PER_HOUR INT32_C(MICROS_PER_MIN*60U)
124
125#define SERIAL_PORT_PRIMARY 0
126#define SERIAL_PORT_SECONDARY 3
127
128//Define the load algorithm
129#define LOAD_SOURCE_MAP 0
130#define LOAD_SOURCE_TPS 1
131#define LOAD_SOURCE_IMAPEMAP 2
132
133//Define bit positions within engine variable
134#define BIT_ENGINE_RUN 0 // Engine running
135#define BIT_ENGINE_CRANK 1 // Engine cranking
136#define BIT_ENGINE_ASE 2 // after start enrichment (ASE)
137#define BIT_ENGINE_WARMUP 3 // Engine in warmup
138#define BIT_ENGINE_ACC 4 // in acceleration mode (TPS accel)
139#define BIT_ENGINE_DCC 5 // in deceleration mode
140#define BIT_ENGINE_MAPACC 6 // MAP acceleration mode
141#define BIT_ENGINE_MAPDCC 7 // MAP deceleration mode
142
143//Define masks for Status1
144#define BIT_STATUS1_INJ1 0 //inj1
145#define BIT_STATUS1_INJ2 1 //inj2
146#define BIT_STATUS1_INJ3 2 //inj3
147#define BIT_STATUS1_INJ4 3 //inj4
148#define BIT_STATUS1_DFCO 4 //Deceleration fuel cutoff
149#define BIT_STATUS1_BOOSTCUT 5 //Fuel component of MAP based boost cut out
150#define BIT_STATUS1_TOOTHLOG1READY 6 //Used to flag if tooth log 1 is ready
151#define BIT_STATUS1_TOOTHLOG2READY 7 //Used to flag if tooth log 2 is ready (Log is not currently used)
152
153//Define masks for spark variable
154#define BIT_STATUS2_HLAUNCH 0 //Hard Launch indicator
155#define BIT_STATUS2_SLAUNCH 1 //Soft Launch indicator
156#define BIT_STATUS2_HRDLIM 2 //Hard limiter indicator
157#define BIT_STATUS2_SFTLIM 3 //Soft limiter indicator
158#define BIT_STATUS2_BOOSTCUT 4 //Spark component of MAP based boost cut out
159#define BIT_STATUS2_ERROR 5 // Error is detected
160#define BIT_STATUS2_IDLE 6 // idle on
161#define BIT_STATUS2_SYNC 7 // Whether engine has sync or not
162
163#define BIT_STATUS5_FLATSH 0 //Flat shift hard cut
164#define BIT_STATUS5_FLATSS 1 //Flat shift soft cut
165#define BIT_STATUS5_SPARK2_ACTIVE 2
166#define BIT_STATUS5_KNOCK_ACTIVE 3
167#define BIT_STATUS5_KNOCK_PULSE 4
168#define BIT_STATUS5_UNUSED6 5
169#define BIT_STATUS5_UNUSED7 6
170#define BIT_STATUS5_UNUSED8 7
171
172#define BIT_TIMER_1HZ 0
173#define BIT_TIMER_4HZ 1
174#define BIT_TIMER_10HZ 2
175#define BIT_TIMER_15HZ 3
176#define BIT_TIMER_30HZ 4
177#define BIT_TIMER_50HZ 5
178#define BIT_TIMER_200HZ 6
179#define BIT_TIMER_1KHZ 7
180
181#define BIT_STATUS3_RESET_PREVENT 0 //Indicates whether reset prevention is enabled
182#define BIT_STATUS3_NITROUS 1
183#define BIT_STATUS3_FUEL2_ACTIVE 2
184#define BIT_STATUS3_VSS_REFRESH 3
185#define BIT_STATUS3_HALFSYNC 4 //shows if there is only sync from primary trigger, but not from secondary.
186#define BIT_STATUS3_NSQUIRTS1 5
187#define BIT_STATUS3_NSQUIRTS2 6
188#define BIT_STATUS3_NSQUIRTS3 7
189
190#define BIT_STATUS4_WMI_EMPTY 0 //Indicates whether the WMI tank is empty
191#define BIT_STATUS4_VVT1_ERROR 1 //VVT1 cam angle within limits or not
192#define BIT_STATUS4_VVT2_ERROR 2 //VVT2 cam angle within limits or not
193#define BIT_STATUS4_FAN 3 //Fan Status
194#define BIT_STATUS4_BURNPENDING 4
195#define BIT_STATUS4_STAGING_ACTIVE 5
196#define BIT_STATUS4_COMMS_COMPAT 6
197#define BIT_STATUS4_ALLOW_LEGACY_COMMS 7
198
199#define BIT_AIRCON_REQUEST 0 //Indicates whether the A/C button is pressed
200#define BIT_AIRCON_COMPRESSOR 1 //Indicates whether the A/C compressor is running
201#define BIT_AIRCON_RPM_LOCKOUT 2 //Indicates the A/C is locked out due to the RPM being too high/low, or the post-high/post-low-RPM "stand-down" lockout period
202#define BIT_AIRCON_TPS_LOCKOUT 3 //Indicates the A/C is locked out due to high TPS, or the post-high-TPS "stand-down" lockout period
203#define BIT_AIRCON_TURNING_ON 4 //Indicates the A/C request is on (i.e. A/C button pressed), the lockouts are off, however the start delay has not yet elapsed. This gives the idle up time to kick in before the compressor.
204#define BIT_AIRCON_CLT_LOCKOUT 5 //Indicates the A/C is locked out either due to high coolant temp.
205#define BIT_AIRCON_FAN 6 //Indicates whether the A/C fan is running
206#define BIT_AIRCON_UNUSED8 7
207
208#ifndef UNIT_TEST
209#define TOOTH_LOG_SIZE 127U
210#else
211#define TOOTH_LOG_SIZE 1U
212#endif
213// Some code relies on TOOTH_LOG_SIZE being uint8_t.
214static_assert(TOOTH_LOG_SIZE<UINT8_MAX, "Check all uses of TOOTH_LOG_SIZE");
215
216#define O2_CALIBRATION_PAGE 2U
217#define IAT_CALIBRATION_PAGE 1U
218#define CLT_CALIBRATION_PAGE 0U
219
220// note the sequence of these defines which reference the bits used in a byte has moved when the third trigger & engine cycle was incorporated
221#define COMPOSITE_LOG_PRI 0
222#define COMPOSITE_LOG_SEC 1
223#define COMPOSITE_LOG_THIRD 2
224#define COMPOSITE_LOG_TRIG 3
225#define COMPOSITE_LOG_SYNC 4
226#define COMPOSITE_ENGINE_CYCLE 5
227
228#define EGO_TYPE_OFF 0
229#define EGO_TYPE_NARROW 1
230#define EGO_TYPE_WIDE 2
231
232#define INJ_TYPE_PORT 0
233#define INJ_TYPE_TBODY 1
234
235#define INJ_PAIRED 0
236#define INJ_SEMISEQUENTIAL 1
237#define INJ_BANKED 2
238#define INJ_SEQUENTIAL 3
239
240#define INJ_PAIR_13_24 0
241#define INJ_PAIR_14_23 1
242
243#define OUTPUT_CONTROL_DIRECT 0
244#define OUTPUT_CONTROL_MC33810 10
245
246#define IGN_MODE_WASTED 0U
247#define IGN_MODE_SINGLE 1U
248#define IGN_MODE_WASTEDCOP 2U
249#define IGN_MODE_SEQUENTIAL 3U
250#define IGN_MODE_ROTARY 4U
251
252#define SEC_TRIGGER_SINGLE 0
253#define SEC_TRIGGER_4_1 1
254#define SEC_TRIGGER_POLL 2
255#define SEC_TRIGGER_5_3_2 3
256#define SEC_TRIGGER_TOYOTA_3 4
257
258#define ROTARY_IGN_FC 0
259#define ROTARY_IGN_FD 1
260#define ROTARY_IGN_RX8 2
261
262#define BOOST_MODE_SIMPLE 0
263#define BOOST_MODE_FULL 1
264
265#define EN_BOOST_CONTROL_BARO 0
266#define EN_BOOST_CONTROL_FIXED 1
267
268#define WMI_MODE_SIMPLE 0
269#define WMI_MODE_PROPORTIONAL 1
270#define WMI_MODE_OPENLOOP 2
271#define WMI_MODE_CLOSEDLOOP 3
272
273#define HARD_CUT_FULL 0
274#define HARD_CUT_ROLLING 1
275
276#define EVEN_FIRE 0
277#define ODD_FIRE 1
278
279#define EGO_ALGORITHM_SIMPLE 0U
280#define EGO_ALGORITHM_INVALID1 1U
281#define EGO_ALGORITHM_PID 2U
282#define EGO_ALGORITHM_NONE 3U
283
284#define STAGING_MODE_TABLE 0
285#define STAGING_MODE_AUTO 1
286
287#define NITROUS_OFF 0
288#define NITROUS_STAGE1 1
289#define NITROUS_STAGE2 2
290#define NITROUS_BOTH 3
291
292#define PROTECT_CUT_OFF 0
293#define PROTECT_CUT_IGN 1
294#define PROTECT_CUT_FUEL 2
295#define PROTECT_CUT_BOTH 3
296#define PROTECT_IO_ERROR 7
297
298#define AE_MODE_TPS 0
299#define AE_MODE_MAP 1
300
301#define AE_MODE_MULTIPLIER 0
302#define AE_MODE_ADDER 1
303
304#define KNOCK_MODE_OFF 0U
305#define KNOCK_MODE_DIGITAL 1U
306#define KNOCK_MODE_ANALOG 2U
307
308#define KNOCK_TRIGGER_HIGH 0
309#define KNOCK_TRIGGER_LOW 1
310
311#define FUEL2_MODE_OFF 0
312#define FUEL2_MODE_MULTIPLY 1
313#define FUEL2_MODE_ADD 2
314#define FUEL2_MODE_CONDITIONAL_SWITCH 3
315#define FUEL2_MODE_INPUT_SWITCH 4
316
317#define SPARK2_MODE_OFF 0
318#define SPARK2_MODE_MULTIPLY 1
319#define SPARK2_MODE_ADD 2
320#define SPARK2_MODE_CONDITIONAL_SWITCH 3
321#define SPARK2_MODE_INPUT_SWITCH 4
322
323#define FUEL2_CONDITION_RPM 0
324#define FUEL2_CONDITION_MAP 1
325#define FUEL2_CONDITION_TPS 2
326#define FUEL2_CONDITION_ETH 3
327
328#define SPARK2_CONDITION_RPM 0
329#define SPARK2_CONDITION_MAP 1
330#define SPARK2_CONDITION_TPS 2
331#define SPARK2_CONDITION_ETH 3
332
333#define RESET_CONTROL_DISABLED 0U
334#define RESET_CONTROL_PREVENT_WHEN_RUNNING 1U
335#define RESET_CONTROL_PREVENT_ALWAYS 2U
336#define RESET_CONTROL_SERIAL_COMMAND 3U
337
338#define OPEN_LOOP_BOOST 0
339#define CLOSED_LOOP_BOOST 1
340
341#define SOFT_LIMIT_FIXED 0
342#define SOFT_LIMIT_RELATIVE 1
343
344#define VVT_MODE_ONOFF 0
345#define VVT_MODE_OPEN_LOOP 1
346#define VVT_MODE_CLOSED_LOOP 2
347#define VVT_LOAD_MAP 0
348#define VVT_LOAD_TPS 1
349
350#define MULTIPLY_MAP_MODE_OFF 0
351#define MULTIPLY_MAP_MODE_BARO 1
352#define MULTIPLY_MAP_MODE_100 2
353
354#define FOUR_STROKE 0U
355#define TWO_STROKE 1U
356
357#define GOING_LOW 0
358#define GOING_HIGH 1
359
360#define BATTV_COR_MODE_WHOLE 0
361#define BATTV_COR_MODE_OPENTIME 1
362
363#define INJ1_CMD_BIT 0
364#define INJ2_CMD_BIT 1
365#define INJ3_CMD_BIT 2
366#define INJ4_CMD_BIT 3
367#define INJ5_CMD_BIT 4
368#define INJ6_CMD_BIT 5
369#define INJ7_CMD_BIT 6
370#define INJ8_CMD_BIT 7
371
372#define IGN1_CMD_BIT 0
373#define IGN2_CMD_BIT 1
374#define IGN3_CMD_BIT 2
375#define IGN4_CMD_BIT 3
376#define IGN5_CMD_BIT 4
377#define IGN6_CMD_BIT 5
378#define IGN7_CMD_BIT 6
379#define IGN8_CMD_BIT 7
380
381#define ENGINE_PROTECT_BIT_RPM 0
382#define ENGINE_PROTECT_BIT_MAP 1
383#define ENGINE_PROTECT_BIT_OIL 2
384#define ENGINE_PROTECT_BIT_AFR 3
385#define ENGINE_PROTECT_BIT_COOLANT 4
386
387
388#define CALIBRATION_TABLE_SIZE 512
389#define CALIBRATION_TEMPERATURE_OFFSET 40
391#define OFFSET_FUELTRIM 127U
392#define OFFSET_IGNITION 40
393
394#define SERIAL_BUFFER_THRESHOLD 32
395
396#define LOGGER_CSV_SEPARATOR_SEMICOLON 0
397#define LOGGER_CSV_SEPARATOR_COMMA 1
398#define LOGGER_CSV_SEPARATOR_TAB 2
399#define LOGGER_CSV_SEPARATOR_SPACE 3
400
401#define LOGGER_DISABLED 0
402#define LOGGER_CSV 1
403#define LOGGER_BINARY 2
404
405#define LOGGER_RATE_1HZ 0
406#define LOGGER_RATE_4HZ 1
407#define LOGGER_RATE_10HZ 2
408#define LOGGER_RATE_30HZ 3
409
410#define LOGGER_FILENAMING_OVERWRITE 0
411#define LOGGER_FILENAMING_DATETIME 1
412#define LOGGER_FILENAMING_SEQENTIAL 2
413
414extern const char TSfirmwareVersion[] PROGMEM;
415
416extern const byte data_structure_version; //This identifies the data structure when reading / writing. Now in use: CURRENT_DATA_VERSION (migration on-the fly) ?
417
418extern struct table3d16RpmLoad fuelTable; //16x16 fuel map
419extern struct table3d16RpmLoad fuelTable2; //16x16 fuel map
420extern struct table3d16RpmLoad ignitionTable; //16x16 ignition map
421extern struct table3d16RpmLoad ignitionTable2; //16x16 ignition map
422extern struct table3d16RpmLoad afrTable; //16x16 afr target map
423extern struct table3d8RpmLoad stagingTable; //8x8 fuel staging table
424extern struct table3d8RpmLoad boostTable; //8x8 boost map
425extern struct table3d8RpmLoad boostTableLookupDuty; //8x8 boost map
426extern struct table3d8RpmLoad vvtTable; //8x8 vvt map
427extern struct table3d8RpmLoad vvt2Table; //8x8 vvt map
428extern struct table3d8RpmLoad wmiTable; //8x8 wmi map
429
431
432extern trimTable3d trim1Table; //6x6 Fuel trim 1 map
433extern trimTable3d trim2Table; //6x6 Fuel trim 2 map
434extern trimTable3d trim3Table; //6x6 Fuel trim 3 map
435extern trimTable3d trim4Table; //6x6 Fuel trim 4 map
436extern trimTable3d trim5Table; //6x6 Fuel trim 5 map
437extern trimTable3d trim6Table; //6x6 Fuel trim 6 map
438extern trimTable3d trim7Table; //6x6 Fuel trim 7 map
439extern trimTable3d trim8Table; //6x6 Fuel trim 8 map
440
441extern struct table3d4RpmLoad dwellTable; //4x4 Dwell map
442extern struct table2D taeTable; //4 bin TPS Acceleration Enrichment map (2D)
443extern struct table2D maeTable;
444extern struct table2D WUETable; //10 bin Warm Up Enrichment map (2D)
445extern struct table2D ASETable; //4 bin After Start Enrichment map (2D)
446extern struct table2D ASECountTable; //4 bin After Start duration map (2D)
447extern struct table2D PrimingPulseTable; //4 bin Priming pulsewidth map (2D)
448extern struct table2D crankingEnrichTable; //4 bin cranking Enrichment map (2D)
449extern struct table2D dwellVCorrectionTable; //6 bin dwell voltage correction (2D)
450extern struct table2D injectorVCorrectionTable; //6 bin injector voltage correction (2D)
451extern struct table2D injectorAngleTable; //4 bin injector timing curve (2D)
452extern struct table2D IATDensityCorrectionTable; //9 bin inlet air temperature density correction (2D)
453extern struct table2D baroFuelTable; //8 bin baro correction curve (2D)
454extern struct table2D IATRetardTable; //6 bin ignition adjustment based on inlet air temperature (2D)
455extern struct table2D idleTargetTable; //10 bin idle target table for idle timing (2D)
456extern struct table2D idleAdvanceTable; //6 bin idle advance adjustment table based on RPM difference (2D)
457extern struct table2D CLTAdvanceTable; //6 bin ignition adjustment based on coolant temperature (2D)
458extern struct table2D rotarySplitTable; //8 bin ignition split curve for rotary leading/trailing (2D)
459extern struct table2D flexFuelTable; //6 bin flex fuel correction table for fuel adjustments (2D)
460extern struct table2D flexAdvTable; //6 bin flex fuel correction table for timing advance (2D)
461extern struct table2D flexBoostTable; //6 bin flex fuel correction table for boost adjustments (2D)
462extern struct table2D fuelTempTable; //6 bin fuel temperature correction table for fuel adjustments (2D)
463extern struct table2D knockWindowStartTable;
465extern struct table2D oilPressureProtectTable;
466extern struct table2D wmiAdvTable; //6 bin wmi correction table for timing advance (2D)
467extern struct table2D coolantProtectTable; //6 bin coolant temperature protection table for engine protection (2D)
468extern struct table2D fanPWMTable;
469extern struct table2D rollingCutTable;
470
471//These are for the direct port manipulation of the injectors, coils and aux outputs
472extern volatile PORT_TYPE *inj1_pin_port;
473extern volatile PINMASK_TYPE inj1_pin_mask;
474extern volatile PORT_TYPE *inj2_pin_port;
475extern volatile PINMASK_TYPE inj2_pin_mask;
476extern volatile PORT_TYPE *inj3_pin_port;
477extern volatile PINMASK_TYPE inj3_pin_mask;
478extern volatile PORT_TYPE *inj4_pin_port;
479extern volatile PINMASK_TYPE inj4_pin_mask;
480extern volatile PORT_TYPE *inj5_pin_port;
481extern volatile PINMASK_TYPE inj5_pin_mask;
482extern volatile PORT_TYPE *inj6_pin_port;
483extern volatile PINMASK_TYPE inj6_pin_mask;
484extern volatile PORT_TYPE *inj7_pin_port;
485extern volatile PINMASK_TYPE inj7_pin_mask;
486extern volatile PORT_TYPE *inj8_pin_port;
487extern volatile PINMASK_TYPE inj8_pin_mask;
488
489extern volatile PORT_TYPE *ign1_pin_port;
490extern volatile PINMASK_TYPE ign1_pin_mask;
491extern volatile PORT_TYPE *ign2_pin_port;
492extern volatile PINMASK_TYPE ign2_pin_mask;
493extern volatile PORT_TYPE *ign3_pin_port;
494extern volatile PINMASK_TYPE ign3_pin_mask;
495extern volatile PORT_TYPE *ign4_pin_port;
496extern volatile PINMASK_TYPE ign4_pin_mask;
497extern volatile PORT_TYPE *ign5_pin_port;
498extern volatile PINMASK_TYPE ign5_pin_mask;
499extern volatile PORT_TYPE *ign6_pin_port;
500extern volatile PINMASK_TYPE ign6_pin_mask;
501extern volatile PORT_TYPE *ign7_pin_port;
502extern volatile PINMASK_TYPE ign7_pin_mask;
503extern volatile PORT_TYPE *ign8_pin_port;
504extern volatile PINMASK_TYPE ign8_pin_mask;
505
506extern volatile PORT_TYPE *tach_pin_port;
507extern volatile PINMASK_TYPE tach_pin_mask;
508extern volatile PORT_TYPE *pump_pin_port;
509extern volatile PINMASK_TYPE pump_pin_mask;
510
511extern volatile PORT_TYPE *flex_pin_port;
512extern volatile PINMASK_TYPE flex_pin_mask;
513
514extern volatile PORT_TYPE *triggerPri_pin_port;
515extern volatile PINMASK_TYPE triggerPri_pin_mask;
516extern volatile PORT_TYPE *triggerSec_pin_port;
517extern volatile PINMASK_TYPE triggerSec_pin_mask;
518extern volatile PORT_TYPE *triggerThird_pin_port;
519extern volatile PINMASK_TYPE triggerThird_pin_mask;
520
521extern byte triggerInterrupt;
522extern byte triggerInterrupt2;
523extern byte triggerInterrupt3;
524
525
526extern byte fpPrimeTime; //The time (in seconds, based on currentStatus.secl) that the fuel pump started priming
527extern uint8_t softLimitTime; //The time (in 0.1 seconds, based on seclx10) that the soft limiter started
528extern volatile uint16_t mainLoopCount;
529extern uint32_t revolutionTime; //The time in uS that one revolution would take at current speed (The time tooth 1 was last seen, minus the time it was seen prior to that)
530extern volatile unsigned long timer5_overflow_count; //Increments every time counter 5 overflows. Used for the fast version of micros()
531extern volatile unsigned long ms_counter; //A counter that increments once per ms
533extern volatile uint32_t toothHistory[TOOTH_LOG_SIZE];
535extern volatile unsigned int toothHistoryIndex;
536extern unsigned long currentLoopTime;
537extern volatile uint16_t ignitionCount;
538//The below shouldn't be needed and probably should be cleaned up, but the Atmel SAM (ARM) boards use a specific type for the trigger edge values rather than a simple byte/int
539#if defined(CORE_SAMD21)
543#else
544 extern byte primaryTriggerEdge;
545 extern byte secondaryTriggerEdge;
546 extern byte tertiaryTriggerEdge;
547#endif
548extern int CRANK_ANGLE_MAX_IGN;
549extern int CRANK_ANGLE_MAX_INJ;
550extern volatile uint32_t runSecsX10;
551extern volatile uint32_t seclx10;
552extern volatile byte HWTest_INJ;
553extern volatile byte HWTest_INJ_Pulsed;
554extern volatile byte HWTest_IGN;
555extern volatile byte HWTest_IGN_Pulsed;
556extern byte maxIgnOutputs;
557extern byte maxInjOutputs;
558extern byte resetControl;
559extern volatile byte TIMER_mask;
560extern volatile byte LOOP_TIMER;
561
562//These functions all do checks on a pin to determine if it is already in use by another (higher importance) function
563#define pinIsInjector(pin) ( ((pin) == pinInjector1) || ((pin) == pinInjector2) || ((pin) == pinInjector3) || ((pin) == pinInjector4) || ((pin) == pinInjector5) || ((pin) == pinInjector6) || ((pin) == pinInjector7) || ((pin) == pinInjector8) )
564#define pinIsIgnition(pin) ( ((pin) == pinCoil1) || ((pin) == pinCoil2) || ((pin) == pinCoil3) || ((pin) == pinCoil4) || ((pin) == pinCoil5) || ((pin) == pinCoil6) || ((pin) == pinCoil7) || ((pin) == pinCoil8) )
565//#define pinIsOutput(pin) ( pinIsInjector((pin)) || pinIsIgnition((pin)) || ((pin) == pinFuelPump) || ((pin) == pinFan) || ((pin) == pinAirConComp) || ((pin) == pinAirConFan)|| ((pin) == pinVVT_1) || ((pin) == pinVVT_2) || ( ((pin) == pinBoost) && configPage6.boostEnabled) || ((pin) == pinIdle1) || ((pin) == pinIdle2) || ((pin) == pinTachOut) || ((pin) == pinStepperEnable) || ((pin) == pinStepperStep) )
566#define pinIsSensor(pin) ( ((pin) == pinCLT) || ((pin) == pinIAT) || ((pin) == pinMAP) || ((pin) == pinTPS) || ((pin) == pinO2) || ((pin) == pinBat) || (((pin) == pinFlex) && (configPage2.flexEnabled != 0)) )
567//#define pinIsUsed(pin) ( pinIsSensor((pin)) || pinIsOutput((pin)) || pinIsReserved((pin)) )
568
569
575struct statuses {
576 volatile bool hasSync : 1;
578 bool initialisationComplete : 1; //Tracks whether the setup() function has run completely
581 volatile bool fpPrimed : 1; //Tracks whether or not the fuel pump priming has been completed yet
582 volatile bool injPrimed : 1; //Tracks whether or not the injector priming has been completed yet
583 volatile bool tachoSweepEnabled : 1;
584 volatile bool tachoAlt : 1;
585
588 long longRPM;
590 long MAP;
596 byte TPSlast;
598 volatile int rpmDOT;
599 byte VE;
600 byte VE1;
601 byte VE2;
606 int IAT;
632 volatile byte ethanolPct;
633 volatile int8_t fuelTemp;
634 unsigned long AEEndTime;
635 volatile byte status1;
636 volatile byte status2;
637 volatile byte status3;
638 volatile byte status4;
639 volatile byte status5;
641 unsigned int PW1;
642 unsigned int PW2;
643 unsigned int PW3;
644 unsigned int PW4;
645 unsigned int PW5;
646 unsigned int PW6;
647 unsigned int PW7;
648 unsigned int PW8;
649 volatile byte runSecs;
650 volatile byte secl;
655 unsigned int clutchEngagedRPM;
660 bool testActive; // Not in use ? Replaced by testOutputs ?
662 byte idleLoad;
668 byte nSquirts;
675 volatile byte syncLossCounter;
677 volatile byte knockCount;
679 byte compositeTriggerUsed; // 0 means composite logger disabled, 2 means use secondary input (1st cam), 3 means use tertiary input (2nd cam), 4 means log both cams together
680 int16_t vvt1Angle; //Has to be a long for PID calcs (CL VVT control)
682 long vvt1Duty; //Has to be a long for PID calcs (CL VVT control)
687 byte gear;
692 byte wmiPW;
693 int16_t vvt2Angle; //Has to be a long for PID calcs (CL VVT control)
695 long vvt2Duty; //Has to be a long for PID calcs (CL VVT control)
697 byte TS_SD_Status; //TunerStudios SD card status
699};
700
705static inline bool HasAnySyncUnsafe(const statuses &status) {
706 return status.hasSync || BIT_CHECK(status.status3, BIT_STATUS3_HALFSYNC);
707}
708
709static inline bool HasAnySync(const statuses &status) {
710 ATOMIC() {
711 return HasAnySyncUnsafe(status);
712 }
713 return false; // Just here to avoid compiler warning.
714}
715
722
730struct config2 {
731
733 byte aeColdPct; //AE cold clt modifier %
734 byte aeColdTaperMin; //AE cold modifier, taper start temp (full modifier, was ASE in early versions)
735 byte aeMode : 2;
736 byte battVCorMode : 1;
739 byte aeApplyMode : 1;
740 byte multiplyMAP : 2;
741 byte wueValues[10];
744 byte tachoPin : 6;
745 byte tachoDiv : 2;
746 byte tachoDuration; //The duration of the tacho pulse in mS
749 byte aeTime;
753 //Display config bits
754 byte displayB1 : 4; //23
755 byte displayB2 : 4;
756
757 byte reqFuel; //24
759 byte injTiming : 1;
761 byte includeAFR : 1; //< Enable AFR compensation ? (See also @ref config2.incorporateAFR)
762 byte hardCutType : 1;
763 byte ignAlgorithm : 3;
764 byte indInjAng : 1;
765 byte injOpen;
767
768 //config1 in ini
770 byte strokes : 1;
771 byte injType : 1;
772 byte nCylinders : 4;
773
774 //config2 in ini
776 byte fixAngEnable : 1;
777 byte nInjectors : 4;
778
779
780 //config3 in ini
781 byte engineType : 1;
782 byte flexEnabled : 1;
783 byte legacyMAP : 1;
784 byte baroCorr : 1; // Unused ?
785 byte injLayout : 2;
787 byte perToothIgn : 1;
788 byte dfcoEnabled : 1;
789
792 byte flexFreqLow; //Lowest valid frequency reading from the flex sensor
793 byte flexFreqHigh; //Highest valid frequency reading from the flex sensor
794
796 byte tpsMin;
797 byte tpsMax;
798 int8_t mapMin; //Must be signed
800 byte fpPrime;
801 byte stoich;
805
806 byte idleUpPin : 6;
809
813
817
818 int8_t baroMin; //Must be signed
820
821 int8_t EMAPMin; //Must be signed
823
824 byte fanWhenOff : 1;
826 byte useDwellMap : 1;
827 byte fanEnable : 2;
828 byte rtc_mode : 2; // Unused ?
829 byte incorporateAFR : 1;
830 byte asePct[4];
831 byte aseCount[4];
832 byte aseBins[4];
833 byte primePulse[4];//Priming pulsewidth values (mS, copied to @ref PrimingPulseTable)
834 byte primeBins[4]; //Priming temperatures (source,x-axis)
835
836 byte CTPSPin : 6;
837 byte CTPSPolarity : 1;
838 byte CTPSEnabled : 1;
839
842 byte idleAdvDelay : 5;
843
846
847 byte injAngRPM[4];
848
852
853 //VSS Stuff
854 byte vssMode : 2;
855 byte vssPin : 6;
856
865
869
872
875
879
882 byte canWBO : 2 ;
883 byte vssAuxCh : 4;
884
886
887#if defined(CORE_AVR)
888 };
889#else
890 } __attribute__((packed,aligned(__alignof__(uint16_t)))); //The 32 bit systems require all structs to be fully packed, aligned to their largest member type
891#endif
892
893#define IDLEADVANCE_MODE_OFF 0U
894#define IDLEADVANCE_MODE_ADDED 1U
895#define IDLEADVANCE_MODE_SWITCHED 2U
896
897#define IDLEADVANCE_ALGO_TPS 0U
898#define IDLEADVANCE_ALGO_CTPS 1U
899
903struct config4 {
904
909
910 byte TrigEdge : 1;
911 byte TrigSpeed : 1;
912 byte IgInv : 1;
913 byte TrigPattern : 5;
914
915 byte TrigEdgeSec : 1;
916 byte fuelPumpPin : 6;
917 byte useResync : 1;
918
919 byte sparkDur;
920 byte trigPatternSec : 7;
921 byte PollLevelPolarity : 1; //for poll level cam trigger. Sets if the cam trigger is supposed to be high or low for revolution one.
922 uint8_t bootloaderCaps; //Capabilities of the bootloader over stock. e.g., 0=Stock, 1=Reset protection, etc.
923
927
928 byte StgCycles; //The number of initial cycles before the ignition should fire when first cranking
929
930 byte boostType : 1;
931 byte useDwellLim : 1; //Whether the dwell limiter is off or on
932 byte sparkMode : 3;
934 byte triggerFilter : 2; //The mode of trigger filter being used (0=Off, 1=Light (Not currently used), 2=Normal, 3=Aggressive)
935 byte ignCranklock : 1; //Whether or not the ignition timing during cranking is locked to a CAS (crank) pulse. Only currently valid for Basic distributor and 4G63.
936
941 byte crankRPM;
947 byte taeBins[4];
948 byte taeValues[4];
949 byte wueBins[10];
952 byte iatRetBins[6];
953 byte iatRetValues[6];
954 byte dfcoRPM;
955 byte dfcoHyster; //Hysteris RPM for DFCO
956 byte dfcoTPSThresh; //TPS must be below this figure for DFCO to engage (Unit: ...)
957
958 byte ignBypassEnabled : 1; //Whether or not the ignition bypass is enabled
959 byte ignBypassPin : 6; //Pin the ignition bypass is activated on
960 byte ignBypassHiLo : 1; //Whether this should be active high or low.
961
967 uint8_t ADCFILTER_MAP; //This is only used on Instantaneous MAP readings and is intentionally very weak to allow for faster response
969
970 byte cltAdvBins[6];
971 byte cltAdvValues[6];
973 byte maeBins[4];
974 byte maeRates[4];
980
981 byte idleAdvBins[6];
983
985
987 byte vvt2PWMdir : 1;
991 byte unusedBits4 : 1;
996
997#if defined(CORE_AVR)
998 };
999#else
1000 } __attribute__((packed,aligned(__alignof__(uint16_t)))); //The 32 bit systems require all structs to be fully packed, aligned to their largest member type
1001#endif
1002
1006struct config6 {
1007
1008 byte egoAlgorithm : 2;
1009 byte egoType : 2;
1010 byte boostEnabled : 1;
1011 byte vvtEnabled : 1;
1013
1014 byte egoKP;
1015 byte egoKI;
1016 byte egoKD;
1017 byte egoTemp;
1019 byte vvtMode : 2;
1020 byte vvtLoadSource : 2;
1021 byte vvtPWMdir : 1;
1022 byte vvtCLUseHold : 1; //Whether or not to use a hold duty cycle (Most cases are Yes)
1026 byte ego_min;
1027 byte ego_max;
1029 byte egoRPM;
1031 byte vvt1Pin : 6;
1032 byte useExtBaro : 1;
1033 byte boostMode : 1;
1034 byte boostPin : 6;
1035 byte tachoMode : 1;
1036 byte useEMAP : 1;
1037 byte voltageCorrectionBins[6]; //X axis bins for voltage correction tables
1038 byte injVoltageCorrectionValues[6]; //Correction table for injector PW vs battery voltage
1039 byte airDenBins[9];
1042 byte vvtFreq;
1044 // Launch stuff, see beginning of speeduino.ino main loop
1045 byte launchPin : 6;
1046 byte launchEnabled : 1;
1047 byte launchHiLo : 1; //
1048
1050 int8_t lnchRetard; //Allow for negative advance value (ATDC)
1053
1054 //PID values for idle needed to go here as out of room in the idle page
1058
1063
1064 byte lnchPullRes : 1;
1065 byte iacPWMrun : 1;
1067 byte flatSEnable : 1;
1068 byte baroPin : 4;
1072
1073 byte iacCLValues[10]; //Closed loop target RPM value
1074 byte iacOLStepVal[10]; //Open loop step values for stepper motors
1075 byte iacOLPWMVal[10]; //Open loop duty values for PMWM valves
1076 byte iacBins[10]; //Temperature Bins for the above 3 curves
1077 byte iacCrankSteps[4]; //Steps to use when cranking (Stepper motor)
1078 byte iacCrankDuty[4]; //Duty cycle to use on PWM valves when cranking
1079 byte iacCrankBins[4]; //Temperature Bins for the above 2 curves
1080
1081 byte iacAlgorithm : 3; //Valid values are: "None", "On/Off", "PWM", "PWM Closed Loop", "Stepper", "Stepper Closed Loop"
1082 byte iacStepTime : 3; //How long to pulse the stepper for to ensure the step completes (ms)
1083 byte iacChannels : 1; //How many outputs to use in PWM mode (0 = 1 channel, 1 = 2 channels)
1084 byte iacPWMdir : 1; //Direction of the PWM valve. 0 = Normal = Higher RPM with more duty. 1 = Reverse = Lower RPM with more duty
1085
1086 byte iacFastTemp; //Fast idle temp when using a simple on/off valve
1087
1088 byte iacStepHome; //When using a stepper motor, the number of steps to be taken on startup to home the motor
1089 byte iacStepHyster; //Hysteresis temperature (*10). Eg 2.2C = 22
1090
1091 byte fanInv : 1; // Fan output inversion bit
1092 byte fanUnused : 1;
1093 byte fanPin : 6;
1094 byte fanSP; // Cooling fan start temperature
1095 byte fanHyster; // Fan hysteresis
1096 byte fanFreq; // Fan PWM frequency
1097 byte fanPWMBins[4]; //Temperature Bins for the PWM fan control
1098
1099#if defined(CORE_AVR)
1100 };
1101#else
1102 } __attribute__((packed,aligned(__alignof__(uint8_t)))); //The 32 bit systems require all structs to be fully packed, aligned to their largest member type
1103#endif
1104
1108struct config9 {
1109 byte enable_secondarySerial:1; //enable secondary serial
1110 byte intcan_available:1; //enable internal can module
1112 byte secondarySerialProtocol:4; //protocol for secondary serial. 0=Generic (Fixed list), 1=Generic (ini based list), 2=CAN, 3=msDroid, 4=Real Dash
1114
1115 byte caninput_sel[16]; //bit status on/Can/analog_local/digtal_local if input is enabled
1116 uint16_t caninput_source_can_address[16]; //u16 [15] array holding can address of input
1117 uint8_t caninput_source_start_byte[16]; //u08 [15] array holds the start byte number(value of 0-7)
1118 uint16_t caninput_source_num_bytes; //u16 bit status of the number of bytes length 1 or 2
1119
1121 //byte unused:2
1122 //...
1129
1132 byte egoMAPMax; //needs to be multiplied by 2 to get the proper value
1133 byte egoMAPMin; //needs to be multiplied by 2 to get the proper value
1134 byte speeduino_tsCanId:4; //speeduino TS canid (0-14)
1135 uint16_t true_address; //speeduino 11bit can address
1136 uint16_t realtime_base_address; //speeduino 11 bit realtime base address
1137 uint16_t obd_address; //speeduino OBD diagnostic address
1138 uint8_t Auxinpina[16]; //analog pin number when internal aux in use
1139 uint8_t Auxinpinb[16]; // digital pin number when internal aux in use
1140
1141 byte iacStepperInv : 1; //stepper direction of travel to allow reversing. 0=normal, 1=inverted.
1142 byte iacCoolTime : 3; // how long to wait for the stepper to cool between steps
1143
1145 byte blankField : 1;
1146 byte iacStepperPower : 1; //Whether or not to power the stepper motor when not in use
1147
1148 byte iacMaxSteps; // Step limit beyond which the stepper won't be driven. Should always be less than homing steps. Stored div 3 as per home steps.
1149 byte idleAdvStartDelay; //delay for idle advance engage
1150
1157
1158 byte PWMFanDuty[4];
1159 byte hardRevMode : 2;
1162
1169
1171
1172 byte afrProtectEnabled : 2; /* < AFR protection enabled status. 0 = disabled, 1 = fixed mode, 2 = table mode */
1173 byte afrProtectMinMAP; /* < Minimum MAP. Stored value is divided by 2. Increments of 2 kPa, maximum 511 (?) kPa */
1174 byte afrProtectMinRPM; /* < Minimum RPM. Stored value is divided by 100. Increments of 100 RPM, maximum 25500 RPM */
1175 byte afrProtectMinTPS; /* < Minimum TPS. */
1176 byte afrProtectDeviation; /* < Maximum deviation from AFR target table. Stored value is multiplied by 10 */
1177 byte afrProtectCutTime; /* < Time in ms before cut. Stored value is divided by 100. Maximum of 2550 ms */
1178 byte afrProtectReactivationTPS; /* Disable engine protection cut once below this TPS percentage */
1179
1180#if defined(CORE_AVR)
1181 };
1182#else
1183 } __attribute__((packed,aligned(__alignof__(uint16_t)))); //The 32 bit systems require all structs to be fully packed, aligned to their largest member type
1184#endif
1185
1190struct config10 {
1191 byte crankingEnrichBins[4]; //Bytes 0-3
1192 byte crankingEnrichValues[4]; //Bytes 4-7
1193
1194 //Byte 8
1195 byte rotaryType : 2;
1197 byte stagingMode : 1;
1198 byte EMAPPin : 4;
1199
1200 byte rotarySplitValues[8]; //Bytes 9-16
1201 byte rotarySplitBins[8]; //Bytes 17-24
1202
1203 byte boostIntv; //Byte 25
1204 uint16_t boostSens; //Bytes 26-27
1207
1208 uint8_t flexBoostBins[6]; //Bytes 32-37
1209 int16_t flexBoostAdj[6]; //kPa to be added to the boost target @ current ethanol (negative values allowed). Bytes 38-49
1210 uint8_t flexFuelBins[6]; //Bytes 50-55
1211 uint8_t flexFuelAdj[6]; //Fuel % @ current ethanol (typically 100% @ 0%, 163% @ 100%). Bytes 56-61
1212 uint8_t flexAdvBins[6]; //Bytes 62-67
1213 uint8_t flexAdvAdj[6]; //Additional advance (in degrees) @ current ethanol (typically 0 @ 0%, 10-20 @ 100%). NOTE: THIS SHOULD BE A SIGNED VALUE BUT 2d TABLE LOOKUP NOT WORKING WITH IT CURRENTLY!
1214 //And another three corn rows die.
1215 //Bytes 68-73
1216
1217 //Byte 75
1218 byte lnchCtrlTPS; //Byte 74
1219 byte n2o_enable : 2;
1221 byte n2o_minCLT; //Byte 76
1222 byte n2o_maxMAP; //Byte 77
1223 byte n2o_minTPS; //Byte 78
1224 byte n2o_maxAFR; //Byte 79
1225
1226 //Byte 80
1230 byte n2o_stage1_minRPM; //Byte 81
1231 byte n2o_stage1_maxRPM; //Byte 82
1232 byte n2o_stage1_adderMin; //Byte 83
1233 byte n2o_stage1_adderMax; //Byte 84
1234 byte n2o_stage1_retard; //Byte 85
1235
1236 //Byte 86
1239 byte n2o_stage2_minRPM; //Byte 87
1240 byte n2o_stage2_maxRPM; //Byte 88
1241 byte n2o_stage2_adderMin; //Byte 89
1242 byte n2o_stage2_adderMax; //Byte 90
1243 byte n2o_stage2_retard; //Byte 91
1244
1245 //Byte 92
1246 byte knock_mode : 2;
1247 byte knock_pin : 6;
1248
1249 //Byte 93
1254 byte knock_count : 3;
1255
1256 byte knock_threshold; //Byte 94
1257 byte knock_maxMAP; //Byte 95
1258 byte knock_maxRPM; //Byte 96
1259 byte knock_window_rpms[6]; //Bytes 97-102
1260 byte knock_window_angle[6]; //Bytes 103-108
1261 byte knock_window_dur[6]; //Bytes 109-114
1262
1263 byte knock_maxRetard; //Byte 115
1264 byte knock_firstStep; //Byte 116
1265 byte knock_stepSize; //Byte 117
1266 byte knock_stepTime; //Byte 118
1267
1268 byte knock_duration; //Time after knock retard starts that it should start recovering. Byte 119
1269 byte knock_recoveryStepTime; //Byte 120
1270 byte knock_recoveryStep; //Byte 121
1271
1272 //Byte 122
1274 byte fuel2Mode : 3;
1276
1277 //Bytes 123-124
1279
1280 //Byte 125
1284
1285 byte vvtCLholdDuty; //Byte 126
1286 byte vvtCLKP; //Byte 127
1287 byte vvtCLKI; //Byte 128
1288 byte vvtCLKD; //Byte 129
1289 int16_t vvtCL0DutyAng; //Bytes 130-131
1292
1293 byte crankingEnrichTaper; //Byte 134
1294
1299
1302
1307
1310
1311 byte wmiEnabled : 1; // Byte 149
1312 byte wmiMode : 6;
1313
1315
1316 byte wmiTPS; // Byte 150
1317 byte wmiRPM; // Byte 151
1318 byte wmiMAP; // Byte 152
1319 byte wmiMAP2; // Byte 153
1320 byte wmiIAT; // Byte 154
1321 int8_t wmiOffset; // Byte 155
1322
1323 byte wmiIndicatorEnabled : 1; // 156
1326
1327 byte wmiEmptyEnabled : 1; // 157
1328 byte wmiEmptyPin : 6;
1330
1331 byte wmiEnabledPin; // 158
1332
1333 byte wmiAdvBins[6]; //Bytes 159-164
1334 byte wmiAdvAdj[6]; //Additional advance (in degrees)
1335 //Bytes 165-170
1338 byte vvt2Pin : 6;
1339 byte vvt2Enabled : 1;
1341
1343 byte fuelTempValues[6]; //180
1344
1345 //Byte 186
1347 byte spark2Mode : 3;
1349
1350 //Bytes 187-188
1352
1353 //Byte 189
1357
1358 //Byte 190
1360
1361 //Byte 191
1363
1364#if defined(CORE_AVR)
1365 };
1366#else
1367 } __attribute__((packed,aligned(2))); //The 32 bit systems require all structs to be fully packed, aligned to their largest member type
1368#endif
1377
1382struct config13 {
1390 uint8_t unused_13[8]; // Unused
1393 //89bytes
1395
1397
1399
1400 byte onboard_log_csv_separator :2; //";", ",", "tab", "space"
1401 byte onboard_log_file_style :2; // "Disabled", "CSV", "Binary", "INVALID"
1402 byte onboard_log_file_rate :2; // "1Hz", "4Hz", "10Hz", "30Hz"
1403 byte onboard_log_filenaming :2; // "Overwrite", "Date-time", "Sequential", "INVALID"
1404 byte onboard_log_storage :2; // "sd-card", "INVALID", "INVALID", "INVALID" ;In the future maybe an onboard spi flash can be used, or switch between SDIO vs SPI sd card interfaces.
1405 byte onboard_log_trigger_boot :1; // "Disabled", "On boot"
1406 byte onboard_log_trigger_RPM :1; // "Disabled", "Enabled"
1407 byte onboard_log_trigger_prot :1; // "Disabled", "Enabled"
1408 byte onboard_log_trigger_Vbat :1; // "Disabled", "Enabled"
1409 byte onboard_log_trigger_Epin :2; // "Disabled", "polling", "toggle" , "INVALID"
1410 uint16_t onboard_log_tr1_duration; // Duration of logging that starts on boot
1411 byte onboard_log_tr2_thr_on; // "RPM", 100.0, 0.0, 0, 10000, 0
1412 byte onboard_log_tr2_thr_off; // "RPM", 100.0, 0.0, 0, 10000, 0
1413 byte onboard_log_tr3_thr_RPM :1; // "Disabled", "Enabled"
1414 byte onboard_log_tr3_thr_MAP :1; // "Disabled", "Enabled"
1415 byte onboard_log_tr3_thr_Oil :1; // "Disabled", "Enabled"
1416 byte onboard_log_tr3_thr_AFR :1; // "Disabled", "Enabled"
1417 byte onboard_log_tr4_thr_on; // "V", 0.1, 0.0, 0.0, 15.90, 2 ; * ( 1 byte)
1418 byte onboard_log_tr4_thr_off; // "V", 0.1, 0.0, 0.0, 15.90, 2 ; * ( 1 byte)
1419 byte onboard_log_tr5_Epin_pin :6; // "pin", 0, 0, 0, 1, 255, 0 ;
1421
1424
1425#if defined(CORE_AVR)
1426 };
1427#else
1428 } __attribute__((packed,aligned(__alignof__(uint16_t)))); //The 32 bit systems require all structs to be fully packed, aligned to their largest member type
1429#endif
1430
1435struct config15 {
1437 byte unused15_1 : 7; //7bits unused
1439 byte boostControlEnableThreshold; //if fixed value enable set threshold here.
1440
1441 //Byte 83 - Air conditioning binary points
1449
1450 //Bytes 84-97 - Air conditioning analog points
1468
1469 int8_t rollingProtRPMDelta[4]; // Signed RPM value representing how much below the RPM limit. Divided by 10
1471
1472 //Bytes 106-255
1474
1475#if defined(CORE_AVR)
1476 };
1477#else
1478 } __attribute__((packed,aligned(__alignof__(uint16_t)))); //The 32 bit systems require all structs to be fully packed, aligned to their largest member type
1479#endif
1480
1481extern byte pinInjector1; //Output pin injector 1
1482extern byte pinInjector2; //Output pin injector 2
1483extern byte pinInjector3; //Output pin injector 3
1484extern byte pinInjector4; //Output pin injector 4
1485extern byte pinInjector5; //Output pin injector 5
1486extern byte pinInjector6; //Output pin injector 6
1487extern byte pinInjector7; //Output pin injector 7
1488extern byte pinInjector8; //Output pin injector 8
1489extern byte injectorOutputControl; //Specifies whether the injectors are controlled directly (Via an IO pin) or using something like the MC33810
1490extern byte pinCoil1; //Pin for coil 1
1491extern byte pinCoil2; //Pin for coil 2
1492extern byte pinCoil3; //Pin for coil 3
1493extern byte pinCoil4; //Pin for coil 4
1494extern byte pinCoil5; //Pin for coil 5
1495extern byte pinCoil6; //Pin for coil 6
1496extern byte pinCoil7; //Pin for coil 7
1497extern byte pinCoil8; //Pin for coil 8
1498extern byte ignitionOutputControl; //Specifies whether the coils are controlled directly (Via an IO pin) or using something like the MC33810
1499extern byte pinTrigger; //The CAS pin
1500extern byte pinTrigger2; //The Cam Sensor pin known as secondary input
1501extern byte pinTrigger3; //the 2nd cam sensor pin known as tertiary input
1502extern byte pinTPS;//TPS input pin
1503extern byte pinMAP; //MAP sensor pin
1504extern byte pinEMAP; //EMAP sensor pin
1505extern byte pinMAP2; //2nd MAP sensor (Currently unused)
1506extern byte pinIAT; //IAT sensor pin
1507extern byte pinCLT; //CLS sensor pin
1508extern byte pinO2; //O2 Sensor pin
1509extern byte pinO2_2; //second O2 pin
1510extern byte pinBat; //Battery voltage pin
1511extern byte pinDisplayReset; // OLED reset pin
1512extern byte pinTachOut; //Tacho output
1513extern byte pinFuelPump; //Fuel pump on/off
1514extern byte pinIdle1; //Single wire idle control
1515extern byte pinIdle2; //2 wire idle control (Not currently used)
1516extern byte pinIdleUp; //Input for triggering Idle Up
1517extern byte pinIdleUpOutput; //Output that follows (normal or inverted) the idle up pin
1518extern byte pinCTPS; //Input for triggering closed throttle state
1519extern byte pinFuel2Input; //Input for switching to the 2nd fuel table
1520extern byte pinSpark2Input; //Input for switching to the 2nd ignition table
1521extern byte pinSpareTemp1; // Future use only
1522extern byte pinSpareTemp2; // Future use only
1523extern byte pinSpareOut1; //Generic output
1524extern byte pinSpareOut2; //Generic output
1525extern byte pinSpareOut3; //Generic output
1526extern byte pinSpareOut4; //Generic output
1527extern byte pinSpareOut5; //Generic output
1528extern byte pinSpareOut6; //Generic output
1529extern byte pinSpareHOut1; //spare high current output
1530extern byte pinSpareHOut2; // spare high current output
1531extern byte pinSpareLOut1; // spare low current output
1532extern byte pinSpareLOut2; // spare low current output
1533extern byte pinSpareLOut3;
1534extern byte pinSpareLOut4;
1535extern byte pinSpareLOut5;
1536extern byte pinBoost;
1537extern byte pinVVT_1; // vvt output 1
1538extern byte pinVVT_2; // vvt output 2
1539extern byte pinFan; // Cooling fan output
1540extern byte pinStepperDir; //Direction pin for the stepper motor driver
1541extern byte pinStepperStep; //Step pin for the stepper motor driver
1542extern byte pinStepperEnable; //Turning the DRV8825 driver on/off
1543extern byte pinLaunch;
1544extern byte pinIgnBypass; //The pin used for an ignition bypass (Optional)
1545extern byte pinFlex; //Pin with the flex sensor attached
1546extern byte pinVSS;
1547extern byte pinBaro; //Pin that an external barometric pressure sensor is attached to (If used)
1548extern byte pinResetControl; // Output pin used control resetting the Arduino
1549extern byte pinFuelPressure;
1550extern byte pinOilPressure;
1551extern byte pinWMIEmpty; // Water tank empty sensor
1552extern byte pinWMIIndicator; // No water indicator bulb
1553extern byte pinWMIEnabled; // ON-OFF output to relay/pump/solenoid
1554extern byte pinMC33810_1_CS;
1555extern byte pinMC33810_2_CS;
1556extern byte pinSDEnable; //Input for manually enabling SD logging
1557#ifdef USE_SPI_EEPROM
1558 extern byte pinSPIFlash_CS;
1559#endif
1560extern byte pinAirConComp; // Air conditioning compressor output
1561extern byte pinAirConFan; // Stand-alone air conditioning fan output
1562extern byte pinAirConRequest; // Air conditioning request input
1563
1564/* global variables */ // from speeduino.ino
1565//#ifndef UNIT_TEST
1566
1567//#endif
1568
1569extern struct statuses currentStatus; //The global status object
1570extern struct config2 configPage2;
1571extern struct config4 configPage4;
1572extern struct config6 configPage6;
1573extern struct config9 configPage9;
1574extern struct config10 configPage10;
1575extern struct config13 configPage13;
1576extern struct config15 configPage15;
1577//extern byte cltCalibrationTable[CALIBRATION_TABLE_SIZE]; /**< An array containing the coolant sensor calibration values */
1578//extern byte iatCalibrationTable[CALIBRATION_TABLE_SIZE]; /**< An array containing the inlet air temperature sensor calibration values */
1579//extern byte o2CalibrationTable[CALIBRATION_TABLE_SIZE]; /**< An array containing the O2 sensor calibration values */
1580
1581extern uint16_t cltCalibration_bins[32];
1583extern uint16_t iatCalibration_bins[32];
1585extern uint16_t o2Calibration_bins[32];
1586extern uint8_t o2Calibration_values[32]; // Note 8-bit values
1587extern struct table2D cltCalibrationTable;
1588extern struct table2D iatCalibrationTable;
1589extern struct table2D o2CalibrationTable;
1591bool pinIsOutput(byte pin);
1592bool pinIsUsed(byte pin);
1593
1594#endif // GLOBALS_H
volatile PINMASK_TYPE pump_pin_mask
Definition globals.cpp:97
static bool HasAnySync(const statuses &status)
Definition globals.h:709
byte pinTrigger3
the 2nd cam sensor pin
Definition globals.cpp:173
byte pinStepperEnable
Definition globals.cpp:214
volatile uint16_t ignitionCount
Definition globals.cpp:123
byte pinMC33810_2_CS
Definition globals.cpp:227
int CRANK_ANGLE_MAX_IGN
Definition globals.cpp:133
int CRANK_ANGLE_MAX_INJ
The number of crank degrees that the system track over. 360 for wasted / timed batch and 720 for sequ...
Definition globals.cpp:134
byte pinVSS
Definition globals.cpp:218
struct table2D PrimingPulseTable
4 bin Priming pulsewidth map (2D)
Definition globals.cpp:35
byte pinSpareLOut4
Definition globals.cpp:206
byte triggerInterrupt
byte pinSpareLOut2
Definition globals.cpp:204
byte pinFuelPump
Definition globals.cpp:185
byte pinSpareOut6
Definition globals.cpp:200
byte pinCoil4
Pin for coil 4.
Definition globals.cpp:164
volatile PORT_TYPE * inj7_pin_port
Definition globals.cpp:72
volatile PINMASK_TYPE ign7_pin_mask
Definition globals.cpp:90
struct table3d8RpmLoad stagingTable
8x8 fuel staging table
Definition globals.cpp:15
struct table2D flexFuelTable
6 bin flex fuel correction table for fuel adjustments (2D)
Definition globals.cpp:47
struct table2D fuelTempTable
6 bin flex fuel correction table for fuel adjustments (2D)
Definition globals.cpp:50
struct table2D flexBoostTable
6 bin flex fuel correction table for boost adjustments (2D)
Definition globals.cpp:49
byte pinTrigger2
RPM2 (Typically the Cam Sensor) pin.
Definition globals.cpp:172
volatile PORT_TYPE * inj4_pin_port
Definition globals.cpp:66
byte pinTPS
Definition globals.cpp:174
uint16_t o2Calibration_bins[32]
Definition globals.cpp:255
byte injectorOutputControl
Definition globals.cpp:159
byte maxIgnOutputs
Definition globals.cpp:141
volatile PINMASK_TYPE ign2_pin_mask
Definition globals.cpp:80
struct statuses currentStatus
Definition auxiliaries.cpp:77
trimTable3d trim5Table
6x6 Fuel trim 5 map
Definition globals.cpp:25
const byte data_structure_version
Definition globals.cpp:8
volatile PORT_TYPE * flex_pin_port
Definition globals.cpp:99
byte pinFan
Cooling fan output (on/off? See: auxiliaries.ino)
Definition globals.cpp:211
volatile byte TIMER_mask
Definition globals.cpp:147
struct table2D fanPWMTable
Definition globals.cpp:56
struct table2D o2CalibrationTable
Definition globals.cpp:257
trimTable3d trim3Table
6x6 Fuel trim 3 map
Definition globals.cpp:23
byte pinBat
Definition globals.cpp:182
volatile uint32_t seclx10
Definition globals.cpp:136
byte pinTachOut
Definition globals.cpp:184
volatile PINMASK_TYPE inj5_pin_mask
Definition globals.cpp:69
byte pinO2_2
Definition globals.cpp:181
volatile PINMASK_TYPE flex_pin_mask
Definition globals.cpp:100
volatile PORT_TYPE * inj1_pin_port
volatile inj*_pin_port and inj*_pin_mask vars are for the direct port manipulation of the injectors,...
Definition globals.cpp:60
volatile PORT_TYPE * tach_pin_port
Definition globals.cpp:94
byte pinVVT_2
vvt (variable valve timing) output 2
Definition globals.cpp:210
struct table3d8RpmLoad vvt2Table
8x8 vvt2 map
Definition globals.cpp:19
struct table2D iatCalibrationTable
Definition globals.cpp:254
volatile unsigned int toothHistoryIndex
Current index to toothHistory array.
Definition globals.cpp:121
trimTable3d trim4Table
6x6 Fuel trim 4 map
Definition globals.cpp:24
byte pinAirConComp
Definition globals.cpp:232
struct table2D flexAdvTable
6 bin flex fuel correction table for timing advance (2D)
Definition globals.cpp:48
volatile PORT_TYPE * inj5_pin_port
Definition globals.cpp:68
volatile PINMASK_TYPE ign6_pin_mask
Definition globals.cpp:88
unsigned long currentLoopTime
Definition globals.cpp:122
volatile PINMASK_TYPE ign4_pin_mask
Definition globals.cpp:84
byte ignitionOutputControl
Definition globals.cpp:169
byte pinAirConFan
Definition globals.cpp:233
volatile uint32_t runSecsX10
Definition globals.cpp:135
volatile PINMASK_TYPE inj8_pin_mask
Definition globals.cpp:75
#define TOOTH_LOG_SIZE
Definition globals.h:209
uint16_t fixedCrankingOverride
Definition globals.cpp:116
struct table3d16RpmLoad afrTable
16x16 afr target map
Definition globals.cpp:14
volatile PORT_TYPE * inj2_pin_port
Definition globals.cpp:62
byte pinInjector3
Output pin injector 3.
Definition globals.cpp:153
byte triggerInterrupt2
byte pinInjector2
Output pin injector 2.
Definition globals.cpp:152
struct table2D idleAdvanceTable
6 bin idle advance adjustment table based on RPM difference (2D)
Definition globals.cpp:44
volatile byte HWTest_IGN_Pulsed
Definition globals.cpp:140
byte fpPrimeTime
The time (in seconds, based on statuses::secl) that the fuel pump started priming.
Definition globals.cpp:110
struct table3d16RpmLoad ignitionTable2
16x16 ignition map
Definition globals.cpp:13
volatile PORT_TYPE * ign8_pin_port
Definition globals.cpp:91
byte pinCTPS
Definition globals.cpp:190
byte pinMAP
Definition globals.cpp:175
byte pinCoil5
Pin for coil 5.
Definition globals.cpp:165
volatile PINMASK_TYPE inj4_pin_mask
Definition globals.cpp:67
MAPSamplingMethod
Definition globals.h:716
@ MAPSamplingCycleMinimum
Definition globals.h:719
@ MAPSamplingInstantaneous
Definition globals.h:717
@ MAPSamplingCycleAverage
Definition globals.h:718
@ MAPSamplingIgnitionEventAverage
Definition globals.h:720
bool pinIsOutput(byte pin)
Definition globals.cpp:260
byte pinWMIEnabled
Definition globals.cpp:225
byte maxInjOutputs
Definition globals.cpp:142
byte pinResetControl
Definition globals.cpp:220
byte secondaryTriggerEdge
Definition globals.cpp:130
byte pinSpareOut5
Definition globals.cpp:199
byte pinBoost
Definition globals.cpp:208
volatile PINMASK_TYPE ign5_pin_mask
Definition globals.cpp:86
byte resetControl
resetControl needs to be here (as global) because using the config page (4) directly can prevent burn...
Definition globals.cpp:145
byte pinIdleUp
Definition globals.cpp:188
byte pinIgnBypass
Definition globals.cpp:216
byte pinSpareTemp2
Definition globals.cpp:194
byte pinSpareOut3
Definition globals.cpp:197
byte pinCoil3
Pin for coil 3.
Definition globals.cpp:163
struct table2D knockWindowStartTable
Definition globals.cpp:51
volatile PORT_TYPE * pump_pin_port
Definition globals.cpp:96
volatile byte HWTest_INJ
Definition globals.cpp:137
byte pinBaro
Definition globals.cpp:219
byte pinCoil8
Pin for coil 8.
Definition globals.cpp:168
uint8_t o2Calibration_values[32]
Definition globals.cpp:256
#define BIT_CHECK(var, pos)
Definition globals.h:113
volatile PORT_TYPE * ign5_pin_port
Definition globals.cpp:85
byte pinCLT
Definition globals.cpp:179
struct table3d16RpmLoad fuelTable2
16x16 fuel map
Definition globals.cpp:11
byte pinLaunch
Definition globals.cpp:215
struct table2D crankingEnrichTable
4 bin cranking Enrichment map (2D)
Definition globals.cpp:36
volatile PORT_TYPE * ign7_pin_port
Definition globals.cpp:89
uint16_t iatCalibration_bins[32]
Definition globals.cpp:252
trimTable3d trim6Table
6x6 Fuel trim 6 map
Definition globals.cpp:26
byte pinEMAP
Definition globals.cpp:176
struct table2D ASECountTable
4 bin After Start duration map (2D)
Definition globals.cpp:34
byte pinO2
Definition globals.cpp:180
byte pinTrigger
RPM1 (Typically CAS=crankshaft angle sensor) pin.
Definition globals.cpp:171
struct table2D CLTAdvanceTable
6 bin ignition adjustment based on coolant temperature (2D)
Definition globals.cpp:45
byte pinInjector6
Output pin injector 6.
Definition globals.cpp:156
struct table2D dwellVCorrectionTable
6 bin dwell voltage correction (2D)
Definition globals.cpp:37
byte pinStepperDir
Definition globals.cpp:212
byte pinSpareTemp1
Definition globals.cpp:193
byte pinSpark2Input
Definition globals.cpp:192
struct table2D oilPressureProtectTable
Definition globals.cpp:53
byte pinFlex
Definition globals.cpp:217
#define BIT_STATUS3_HALFSYNC
Definition globals.h:185
struct table2D injectorVCorrectionTable
6 bin injector voltage correction (2D)
Definition globals.cpp:38
byte pinCoil1
Pin for coil 1.
Definition globals.cpp:161
byte pinIAT
Definition globals.cpp:178
byte pinWMIEmpty
Definition globals.cpp:223
byte pinSpareHOut2
Definition globals.cpp:202
struct config15 configPage15
Definition globals.cpp:243
struct table3d8RpmLoad wmiTable
8x8 wmi map
Definition globals.cpp:20
byte pinInjector1
Various pin numbering (Injectors, Ign outputs, CAS, Cam, Sensors. etc.) assignments.
Definition globals.cpp:151
struct config10 configPage10
Definition globals.cpp:241
volatile byte LOOP_TIMER
Definition globals.cpp:148
volatile PORT_TYPE * inj6_pin_port
Definition globals.cpp:70
volatile PORT_TYPE * triggerSec_pin_port
Definition globals.cpp:104
byte pinWMIIndicator
Definition globals.cpp:224
byte pinSpareLOut1
Definition globals.cpp:203
byte pinInjector5
Output pin injector 5.
Definition globals.cpp:155
static bool HasAnySyncUnsafe(const statuses &status)
Non-atomic version of HasAnySync. **Should only be called in an ATOMIC() block***.
Definition globals.h:705
byte pinStepperStep
Definition globals.cpp:213
volatile unsigned long timer5_overflow_count
Definition globals.cpp:114
trimTable3d trim7Table
6x6 Fuel trim 7 map
Definition globals.cpp:27
struct table2D knockWindowDurationTable
Definition globals.cpp:52
byte pinSpareLOut5
Definition globals.cpp:207
byte pinSpareOut4
Definition globals.cpp:198
byte pinIdle1
Definition globals.cpp:186
volatile PINMASK_TYPE inj6_pin_mask
Definition globals.cpp:71
volatile byte HWTest_IGN
Definition globals.cpp:139
struct table3d4RpmLoad dwellTable
4x4 Dwell map
Definition globals.cpp:29
byte pinDisplayReset
Definition globals.cpp:183
struct table2D wmiAdvTable
Definition globals.cpp:54
byte pinVVT_1
vvt (variable valve timing) output 1
Definition globals.cpp:209
struct table3d8RpmLoad boostTable
8x8 boost map
Definition globals.cpp:16
struct config9 configPage9
Definition globals.cpp:240
struct table2D rotarySplitTable
8 bin ignition split curve for rotary leading/trailing (2D)
Definition globals.cpp:46
volatile PINMASK_TYPE inj3_pin_mask
Definition globals.cpp:65
struct table2D IATDensityCorrectionTable
9 bin inlet air temperature density correction (2D)
Definition globals.cpp:40
struct table2D IATRetardTable
6 bin ignition adjustment based on inlet air temperature (2D)
Definition globals.cpp:42
struct table2D coolantProtectTable
Definition globals.cpp:55
struct table2D injectorAngleTable
4 bin injector angle curve (2D)
Definition globals.cpp:39
volatile PORT_TYPE * ign3_pin_port
Definition globals.cpp:81
uint8_t softLimitTime
Definition globals.cpp:111
struct table2D taeTable
4 bin TPS Acceleration Enrichment map (2D)
Definition globals.cpp:30
byte pinIdle2
Definition globals.cpp:187
struct table3d16RpmLoad fuelTable
16x16 fuel map
Definition globals.cpp:10
volatile PINMASK_TYPE triggerThird_pin_mask
Definition globals.cpp:107
volatile PINMASK_TYPE triggerPri_pin_mask
Definition globals.cpp:103
volatile PINMASK_TYPE triggerSec_pin_mask
Definition globals.cpp:105
volatile PORT_TYPE * inj3_pin_port
Definition globals.cpp:64
byte triggerInterrupt3
volatile PORT_TYPE * inj8_pin_port
Definition globals.cpp:74
uint16_t cltCalibration_values[32]
Definition globals.cpp:250
byte pinSpareOut1
Definition globals.cpp:195
volatile byte HWTest_INJ_Pulsed
Definition globals.cpp:138
const char TSfirmwareVersion[]
Definition globals.cpp:6
byte pinCoil6
Pin for coil 6.
Definition globals.cpp:166
volatile uint8_t compositeLogHistory[TOOTH_LOG_SIZE]
Definition globals.cpp:120
byte pinInjector8
Output pin injector 8.
Definition globals.cpp:158
struct table2D maeTable
Definition globals.cpp:31
byte pinInjector7
Output pin injector 7.
Definition globals.cpp:157
volatile PINMASK_TYPE inj7_pin_mask
Definition globals.cpp:73
byte pinAirConRequest
Definition globals.cpp:234
struct config13 configPage13
Definition globals.cpp:242
byte pinSpareLOut3
Definition globals.cpp:205
volatile unsigned long ms_counter
Definition globals.cpp:115
byte primaryTriggerEdge
Definition globals.cpp:129
struct config6 configPage6
Definition globals.cpp:239
volatile uint16_t mainLoopCount
Definition globals.cpp:112
byte pinMAP2
Definition globals.cpp:177
byte pinSpareOut2
Definition globals.cpp:196
struct table2D idleTargetTable
10 bin idle target table for idle timing (2D)
Definition globals.cpp:43
struct config2 configPage2
Definition globals.cpp:237
byte pinMC33810_1_CS
Definition globals.cpp:226
volatile PORT_TYPE * ign2_pin_port
Definition globals.cpp:79
struct table3d8RpmLoad boostTableLookupDuty
8x8 boost map lookup table
Definition globals.cpp:17
byte pinFuel2Input
Definition globals.cpp:191
volatile PORT_TYPE * ign4_pin_port
Definition globals.cpp:83
byte pinFuelPressure
Definition globals.cpp:221
byte pinSDEnable
Definition globals.cpp:228
volatile uint32_t toothHistory[TOOTH_LOG_SIZE]
Tooth trigger history - delta time (in uS) from last tooth (Indexed by toothHistoryIndex)
Definition globals.cpp:119
volatile PINMASK_TYPE inj2_pin_mask
Definition globals.cpp:63
volatile PINMASK_TYPE ign1_pin_mask
Definition globals.cpp:78
bool pinIsUsed(byte pin)
Definition globals.cpp:313
trimTable3d trim2Table
6x6 Fuel trim 2 map
Definition globals.cpp:22
uint16_t cltCalibration_bins[32]
Definition globals.cpp:249
struct config4 configPage4
Definition globals.cpp:238
volatile PINMASK_TYPE tach_pin_mask
Definition globals.cpp:95
byte tertiaryTriggerEdge
Definition globals.cpp:131
volatile PORT_TYPE * ign6_pin_port
Definition globals.cpp:87
byte pinCoil2
Pin for coil 2.
Definition globals.cpp:162
byte pinSpareHOut1
Definition globals.cpp:201
volatile PINMASK_TYPE ign3_pin_mask
Definition globals.cpp:82
volatile PINMASK_TYPE ign8_pin_mask
Definition globals.cpp:92
byte pinOilPressure
Definition globals.cpp:222
volatile PORT_TYPE * triggerThird_pin_port
Definition globals.cpp:106
volatile PORT_TYPE * ign1_pin_port
Definition globals.cpp:77
byte pinIdleUpOutput
Definition globals.cpp:189
struct table2D WUETable
10 bin Warm Up Enrichment map (2D)
Definition globals.cpp:32
volatile PORT_TYPE * triggerPri_pin_port
Definition globals.cpp:102
byte pinInjector4
Output pin injector 4.
Definition globals.cpp:154
struct table2D cltCalibrationTable
Definition globals.cpp:251
struct table3d16RpmLoad ignitionTable
16x16 ignition map
Definition globals.cpp:12
volatile PINMASK_TYPE inj1_pin_mask
Definition globals.cpp:61
byte pinCoil7
Pin for coil 7.
Definition globals.cpp:167
trimTable3d trim1Table
6x6 Fuel trim 1 map
Definition globals.cpp:21
struct table2D rollingCutTable
Definition globals.cpp:57
uint16_t iatCalibration_values[32]
Definition globals.cpp:253
struct table2D ASETable
4 bin After Start Enrichment map (2D)
Definition globals.cpp:33
uint32_t revolutionTime
Definition globals.cpp:113
table3d6RpmLoad trimTable3d
Definition globals.h:430
trimTable3d trim8Table
6x6 Fuel trim 8 map
Definition globals.cpp:28
struct table2D baroFuelTable
8 bin baro correction curve (2D)
Definition globals.cpp:41
struct table3d8RpmLoad vvtTable
8x8 vvt map
Definition globals.cpp:18
static uint32_t rshift(uint32_t a)
Bitwise right shift - generic, unoptimized, case.
Definition bit_shifts.h:349
Definition globals.h:1372
uint8_t firstCompType
First cmp. op (COMPARATOR_* ops, see below)
Definition globals.h:1373
uint8_t bitwise
BITWISE_AND, BITWISE_OR, BITWISE_XOR.
Definition globals.h:1375
uint8_t secondCompType
Second cmp. op (0=COMPARATOR_EQUAL, 1=COMPARATOR_NOT_EQUAL,2=COMPARATOR_GREATER,3=COMPARATOR_GREATER_...
Definition globals.h:1374
Definition globals.h:1190
byte vvtCLKP
Definition globals.h:1286
byte rotaryType
Definition globals.h:1195
byte n2o_maxAFR
Definition globals.h:1224
byte fuelTempValues[6]
Definition globals.h:1343
int16_t flexBoostAdj[6]
Definition globals.h:1209
int8_t wmiOffset
Definition globals.h:1321
byte EMAPPin
Definition globals.h:1198
byte knock_window_angle[6]
Definition globals.h:1260
byte knock_maxRetard
Definition globals.h:1263
byte wmiAdvEnabled
Definition globals.h:1314
byte crankingEnrichValues[4]
Definition globals.h:1192
byte fuel2InputPolarity
Definition globals.h:1282
byte vvt2Pin
Definition globals.h:1338
byte fuel2InputPin
Definition globals.h:1281
byte rotarySplitValues[8]
Definition globals.h:1200
byte oilPressureProtRPM[4]
Definition globals.h:1308
byte spark2SwitchVariable
Definition globals.h:1348
uint16_t stagedInjSizeSec
Definition globals.h:1206
byte oilPressurePin
Definition globals.h:1298
byte spark2Mode
Definition globals.h:1347
byte crankingEnrichTaper
Definition globals.h:1293
byte wmiIAT
Definition globals.h:1320
int8_t fuelPressureMin
Definition globals.h:1303
byte wmiEmptyPolarity
Definition globals.h:1329
uint16_t fuel2SwitchValue
Definition globals.h:1278
byte oilPressureProtEnbl
Definition globals.h:1297
byte unused11_165
Definition globals.h:1301
byte knock_window_rpms[6]
Definition globals.h:1259
byte wmiEnabledPin
Definition globals.h:1331
byte n2o_stage1_retard
Definition globals.h:1234
byte fuelPressureEnable
Enable fuel pressure sensing from an analog pin (pinFuelPressure)
Definition globals.h:1295
uint8_t vvtCLMinAng
Definition globals.h:1290
uint16_t stagedInjSizePri
Definition globals.h:1205
byte fuel2Algorithm
Definition globals.h:1273
byte n2o_stage1_adderMin
Definition globals.h:1232
uint16_t spark2SwitchValue
Definition globals.h:1351
uint8_t flexAdvAdj[6]
Definition globals.h:1213
uint8_t vvtCLMaxAng
Definition globals.h:1291
byte n2o_stage2_unused
Definition globals.h:1238
byte knock_recoveryStepTime
Definition globals.h:1269
byte oilPressureProtTime
Definition globals.h:1359
uint8_t flexAdvBins[6]
Definition globals.h:1212
byte vvtCLholdDuty
Definition globals.h:1285
byte knock_window_dur[6]
Definition globals.h:1261
int8_t oilPressureMin
Definition globals.h:1305
byte knock_trigger
Definition globals.h:1250
byte fuelPressureMax
Definition globals.h:1304
byte knock_firstStep
Definition globals.h:1264
byte fuelTempBins[6]
Definition globals.h:1342
byte n2o_stage2_maxRPM
Definition globals.h:1240
byte wmiTPS
Definition globals.h:1316
byte wmiAdvBins[6]
Definition globals.h:1333
byte knock_unused
Definition globals.h:1253
int16_t vvtCL0DutyAng
Definition globals.h:1289
uint8_t flexFuelAdj[6]
Definition globals.h:1211
byte boostIntv
Definition globals.h:1203
byte n2o_stage2_pin
Definition globals.h:1237
byte wmiIndicatorEnabled
Definition globals.h:1323
byte crankingEnrichBins[4]
Definition globals.h:1191
byte n2o_stage1_unused
Definition globals.h:1229
byte lnchCtrlTPS
Definition globals.h:1218
byte knock_stepSize
Definition globals.h:1265
byte oilPressureMax
Definition globals.h:1306
byte spark2InputPin
Definition globals.h:1354
byte fuel2SwitchVariable
Definition globals.h:1275
byte wmiRPM
Definition globals.h:1317
byte n2o_stage2_adderMin
Definition globals.h:1241
byte vvtCLKI
Definition globals.h:1287
byte knock_threshold
Definition globals.h:1256
byte n2o_stage1_adderMax
Definition globals.h:1233
byte knock_pin
Definition globals.h:1247
byte knock_pullup
Definition globals.h:1251
byte n2o_stage1_minRPM
Definition globals.h:1230
byte n2o_minTPS
Definition globals.h:1223
byte vvt2Enabled
Definition globals.h:1339
uint16_t boostSens
Definition globals.h:1204
byte rotarySplitBins[8]
Definition globals.h:1201
byte knock_duration
Definition globals.h:1268
byte wmiMAP2
Definition globals.h:1319
byte spark2Algorithm
Definition globals.h:1346
byte n2o_stage1_pin
Definition globals.h:1227
byte vvtCLminDuty
Definition globals.h:1336
byte n2o_stage2_adderMax
Definition globals.h:1242
byte n2o_pin_polarity
Definition globals.h:1228
byte oilPressureEnable
Enable oil pressure sensing from an analog pin (pinOilPressure)
Definition globals.h:1296
byte lnchCtrlVss
Definition globals.h:1362
byte wmiAdvAdj[6]
Definition globals.h:1334
byte n2o_maxMAP
Definition globals.h:1222
byte knock_count
Definition globals.h:1254
byte n2o_minCLT
Definition globals.h:1221
byte n2o_enable
Definition globals.h:1219
byte knock_recoveryStep
Definition globals.h:1270
byte n2o_stage1_maxRPM
Definition globals.h:1231
byte n2o_arming_pin
Definition globals.h:1220
uint8_t flexFuelBins[6]
Definition globals.h:1210
byte wmiEnabled
Definition globals.h:1311
byte wmiMode
Definition globals.h:1312
byte n2o_stage2_retard
Definition globals.h:1243
byte n2o_stage2_minRPM
Definition globals.h:1239
byte knock_stepTime
Definition globals.h:1266
byte knock_maxMAP
Definition globals.h:1257
byte oilPressureProtMins[4]
Definition globals.h:1309
byte fuel2Mode
Definition globals.h:1274
byte wmiEmptyEnabled
Definition globals.h:1327
byte stagingMode
Definition globals.h:1197
byte TrigEdgeThrd
Definition globals.h:1340
byte fuel2InputPullup
Definition globals.h:1283
uint8_t flexBoostBins[6]
Definition globals.h:1208
byte knock_limiterDisable
Definition globals.h:1252
byte wmiIndicatorPolarity
Definition globals.h:1325
byte wmiMAP
Definition globals.h:1318
byte wmiEmptyPin
Definition globals.h:1328
byte stagingEnabled
Definition globals.h:1196
byte knock_mode
Definition globals.h:1246
byte knock_maxRPM
Definition globals.h:1258
byte spark2InputPullup
Definition globals.h:1356
byte wmiIndicatorPin
Definition globals.h:1324
byte vvtCLKD
Definition globals.h:1288
byte spark2InputPolarity
Definition globals.h:1355
byte fuelPressurePin
Definition globals.h:1300
byte vvtCLmaxDuty
Definition globals.h:1337
Definition globals.h:1382
byte onboard_log_tr3_thr_RPM
Definition globals.h:1413
byte onboard_log_tr4_thr_off
Definition globals.h:1418
int16_t secondTarget[8]
second target value to compare with bitwise op
Definition globals.h:1392
byte onboard_log_tr3_thr_AFR
Definition globals.h:1416
byte onboard_log_file_style
Definition globals.h:1401
byte hwTestInjDuration
Definition globals.h:1423
int16_t firstTarget[8]
first target value to compare with numeric comp
Definition globals.h:1391
byte onboard_log_tr3_thr_Oil
Definition globals.h:1415
byte onboard_log_trigger_RPM
Definition globals.h:1406
byte onboard_log_file_rate
Definition globals.h:1402
byte onboard_log_storage
Definition globals.h:1404
byte onboard_log_filenaming
Definition globals.h:1403
struct cmpOperation operation[8]
I/O variable comparison operations (See cmpOperation)
Definition globals.h:1394
byte hwTestIgnDuration
Definition globals.h:1422
uint8_t kindOfLimiting
Select which kind of output limiting are active (0 - minimum | 1 - maximum)
Definition globals.h:1384
byte onboard_log_tr3_thr_MAP
Definition globals.h:1414
byte onboard_log_tr4_thr_on
Definition globals.h:1417
byte onboard_log_tr2_thr_off
Definition globals.h:1412
byte onboard_log_tr2_thr_on
Definition globals.h:1411
byte onboard_log_trigger_boot
Definition globals.h:1405
byte onboard_log_tr5_Epin_pin
Definition globals.h:1419
uint8_t outputInverted
Invert (on/off) value before writing to output pin (for all programmable I/O:s).
Definition globals.h:1383
byte unused12_106_116[10]
Definition globals.h:1398
byte onboard_log_csv_separator
Definition globals.h:1400
uint8_t outputDelay[8]
Output write delay for each programmable I/O (Unit: 0.1S)
Definition globals.h:1386
byte onboard_log_trigger_Epin
Definition globals.h:1409
uint8_t firstDataIn[8]
Set of first I/O vars to compare.
Definition globals.h:1387
byte unused13_125_2
Definition globals.h:1420
uint16_t candID[8]
Actual CAN ID need 16bits, this is a placeholder.
Definition globals.h:1396
byte onboard_log_trigger_Vbat
Definition globals.h:1408
uint8_t outputPin[8]
Disable(0) or enable (set to valid pin number) Programmable Pin (output/target pin to set)
Definition globals.h:1385
uint8_t secondDataIn[8]
Set of second I/O vars to compare.
Definition globals.h:1388
uint8_t unused_13[8]
Definition globals.h:1390
byte onboard_log_trigger_prot
Definition globals.h:1407
uint8_t outputTimeLimit[8]
Output delay for each programmable I/O, kindOfLimiting bit dependent(Unit: 0.1S)
Definition globals.h:1389
uint16_t onboard_log_tr1_duration
Definition globals.h:1410
Definition globals.h:1435
byte airConMaxRPMdiv100
Definition globals.h:1457
byte airConUnused1
Definition globals.h:1448
byte airConPwmFanMinDuty
Definition globals.h:1467
byte airConFanPin
Definition globals.h:1464
byte airConEnable
Definition globals.h:1442
byte boostControlEnable
Definition globals.h:1436
byte airConClTempCut
Definition globals.h:1458
byte airConIdleSteps
Definition globals.h:1459
byte airConTurnsFanOn
Definition globals.h:1445
byte unused15_1
Definition globals.h:1437
byte airConFanPol
Definition globals.h:1447
byte airConIdleUpRPMAdder
Definition globals.h:1466
byte airConTPSCutTime
Definition globals.h:1460
byte airConReqPol
Definition globals.h:1444
byte airConFanEnabled
Definition globals.h:1446
byte airConTPSCut
Definition globals.h:1455
int8_t rollingProtRPMDelta[4]
Definition globals.h:1469
byte airConAfterStartDelay
Definition globals.h:1462
byte airConReqPin
Definition globals.h:1453
byte airConUnused3
Definition globals.h:1454
byte airConMinRPMdiv10
Definition globals.h:1456
byte rollingProtCutPercent[4]
Definition globals.h:1470
byte airConCompOnDelay
Definition globals.h:1461
byte airConRPMCutTime
Definition globals.h:1463
byte Unused15_106_255[150]
Definition globals.h:1473
byte boostDCWhenDisabled
Definition globals.h:1438
byte boostControlEnableThreshold
Definition globals.h:1439
byte airConUnused4
Definition globals.h:1465
byte airConCompPin
Definition globals.h:1451
byte airConUnused2
Definition globals.h:1452
byte airConCompPol
Definition globals.h:1443
Definition globals.h:730
byte aeColdTaperMax
AE cold modifier, taper end temp (no modifier applied, was primePulse in early versions)
Definition globals.h:790
byte aseCount[4]
Afterstart enrichment cycles. This is the number of ignition cycles that the afterstart enrichment % ...
Definition globals.h:831
byte displayB1
Definition globals.h:754
byte divider
Definition globals.h:758
byte injTiming
Injector timing (aka. injector staging) 0=simultaneous, 1=alternating.
Definition globals.h:759
byte idleUpOutputPin
Definition globals.h:868
byte tpsMax
Definition globals.h:797
byte iacRPMlimitHysteresis
Definition globals.h:874
byte fanEnable
Fan mode. 0=Off, 1=On/Off, 2=PWM.
Definition globals.h:827
byte wueValues[10]
Warm up enrichment array (10 bytes, transferred to WUETable)
Definition globals.h:741
byte dfcoMinCLT
Definition globals.h:851
byte crkngAddCLTAdv
Definition globals.h:760
byte fuelAlgorithm
Fuel algorithm - 0=Manifold pressure/MAP (LOAD_SOURCE_MAP, default, proven), 1=Throttle/TPS (LOAD_SOU...
Definition globals.h:775
byte iacCLminValue
Definition globals.h:814
MAPSamplingMethod mapSample
MAP sampling method (0=Instantaneous, 1=Cycle Average, 2=Cycle Minimum, 4=Ign. event average,...
Definition globals.h:769
byte tachoPin
Custom pin setting for tacho output (if != 0, override copied to pinTachOut, which defaults to board ...
Definition globals.h:744
byte idleUpPin
Definition globals.h:806
byte useDwellMap
Setting to change between fixed dwell value and dwell map (0=Fixed value from configPage4....
Definition globals.h:826
byte fanWhenCranking
Set whether the fan output will stay on when the engine is cranking (0=force off, 1=allow on)
Definition globals.h:825
byte strokes
Engine cycle type: four-stroke (0) / two-stroke (1)
Definition globals.h:770
byte maeMinChange
Definition globals.h:751
uint16_t vssPulsesPerKm
VSS (Vehicle speed sensor) pulses per Km.
Definition globals.h:857
byte dfcoEnabled
Whether or not DFCO (deceleration fuel cut-off) is turned on.
Definition globals.h:788
byte multiplyMAP
MAP value processing: 0 = off, 1 = div by currentStatus.baro, 2 = div by 100 (to gain usable value)
Definition globals.h:740
byte taeMinChange
Definition globals.h:750
byte rtc_mode
Definition globals.h:828
byte aeTaperMin
Definition globals.h:811
uint16_t EMAPMax
Definition globals.h:822
byte mapSwitchPoint
Definition globals.h:878
byte injAngRPM[4]
Definition globals.h:847
byte idleUpOutputInv
Definition globals.h:867
byte crankingPct
Cranking enrichment (See config10, updates.ino)
Definition globals.h:742
byte flexFreqLow
Definition globals.h:792
byte tpsMin
Definition globals.h:796
byte idleAdvVss
Definition globals.h:877
byte vssPin
VSS (Vehicle speed sensor) pin number.
Definition globals.h:855
byte iacTPSlimit
Definition globals.h:873
byte idleUpOutputEnabled
Definition globals.h:866
byte CTPSEnabled
Definition globals.h:838
uint16_t vssRatio4
Definition globals.h:862
byte reqFuel
Definition globals.h:757
uint16_t mapMax
Definition globals.h:799
byte fanWhenOff
Allow running fan with engine off: 0 = Only run fan when engine is running, 1 = Allow even with engin...
Definition globals.h:824
byte aeApplyMode
Acceleration enrichment calc mode: 0 = Multiply | 1 = Add (AE_MODE_ADDER)
Definition globals.h:739
byte idleAdvRPM
Definition globals.h:844
byte legacyMAP
Legacy MAP reading behaviour.
Definition globals.h:783
byte flexFreqHigh
Definition globals.h:793
byte injLayout
Definition globals.h:785
byte aseTaperTime
Definition globals.h:732
byte baroCorr
Definition globals.h:784
byte asePct[4]
Afterstart enrichment values (%)
Definition globals.h:830
byte idleUpAdder
Definition globals.h:810
byte fpPrime
Time (In seconds) that the fuel pump should be primed for on power up.
Definition globals.h:800
uint16_t vssRatio5
Definition globals.h:863
byte dutyLim
Definition globals.h:791
byte SoftLimitMode
Definition globals.h:737
uint16_t oddfire3
The ATDC angle of channel 3 for oddfire.
Definition globals.h:803
byte CTPSPin
Definition globals.h:836
byte boostMaxDuty
Definition globals.h:795
byte maeThresh
Definition globals.h:747
uint16_t injAng[4]
Definition globals.h:766
byte aeTime
Definition globals.h:749
byte aeColdPct
Definition globals.h:733
byte idleUpPolarity
Definition globals.h:807
byte canWBO
Definition globals.h:882
uint16_t oddfire4
The ATDC angle of channel 4 for oddfire.
Definition globals.h:804
byte aeColdTaperMin
Definition globals.h:734
byte pinMapping
The board / ping mapping number / id to be used (See: setPinMapping in init.ino)
Definition globals.h:743
byte vssMode
VSS (Vehicle speed sensor) mode (0=none, 1=CANbus, 2,3=Interrupt driven)
Definition globals.h:854
byte idleAdvAlgorithm
Definition globals.h:841
byte nCylinders
Number of cylinders.
Definition globals.h:772
byte useTachoSweep
Definition globals.h:738
int8_t baroMin
Definition globals.h:818
byte vssSmoothing
Definition globals.h:858
byte tachoSweepMaxRPM
Definition globals.h:870
int8_t EMAPMin
Definition globals.h:821
byte taeThresh
Definition globals.h:748
uint16_t vssRatio2
Definition globals.h:860
byte nInjectors
Number of injectors.
Definition globals.h:777
byte stoich
Stoichiometric ratio (x10, so e.g. 14.7 => 147)
Definition globals.h:801
byte boostMinDuty
Definition globals.h:816
byte iacCLmaxValue
Definition globals.h:815
byte injType
Injector type 0=Port (INJ_TYPE_PORT), 1=Throttle Body / TBI (INJ_TYPE_TBODY)
Definition globals.h:771
byte engineType
Engine crank/ign phasing type: 0=even fire, 1=odd fire.
Definition globals.h:781
uint16_t vssRatio3
Definition globals.h:861
byte idleAdvTPS
Definition globals.h:845
byte ignAlgorithm
Definition globals.h:763
byte fixAngEnable
Whether fixed/locked timing is enabled (0=disable, 1=enable, See configPage4.FixAng)
Definition globals.h:776
byte aseBins[4]
Afterstart enrichment temperatures (x-axis) for (target) enrichment values.
Definition globals.h:832
byte flexEnabled
Enable Flex fuel sensing (pin / interrupt)
Definition globals.h:782
byte battVCorMode
Definition globals.h:736
byte CTPSPolarity
Definition globals.h:837
byte tachoDiv
Whether to change the tacho speed ("half speed tacho" ?)
Definition globals.h:745
byte idleAdvEnabled
Definition globals.h:840
byte incorporateAFR
Enable AFR target (stoich/afrtgt) compensation in PW calculation.
Definition globals.h:829
byte indInjAng
Definition globals.h:764
int8_t mapMin
Definition globals.h:798
int8_t rtc_trim
Definition globals.h:876
byte idleUpEnabled
Definition globals.h:808
byte unused1_126_1
Definition globals.h:880
byte injOpen
Injector opening time (ms * 10)
Definition globals.h:765
byte primePulse[4]
Definition globals.h:833
byte aeTaperMax
Definition globals.h:812
uint16_t vssRatio6
Definition globals.h:864
byte tachoDuration
Definition globals.h:746
byte primingDelay
Definition globals.h:871
uint16_t vssRatio1
Definition globals.h:859
byte idleTaperTime
Definition globals.h:849
uint16_t oddfire2
The ATDC angle of channel 2 for oddfire.
Definition globals.h:802
byte aeMode
Definition globals.h:735
byte primeBins[4]
Definition globals.h:834
byte unused1_126_2
Definition globals.h:881
byte vssAuxCh
Definition globals.h:883
byte perToothIgn
Experimental / New ignition mode ... (?) (See decoders.ino)
Definition globals.h:787
byte idleAdvDelay
Definition globals.h:842
uint16_t baroMax
Definition globals.h:819
byte displayB2
Definition globals.h:755
byte hardCutType
Definition globals.h:762
byte dfcoDelay
Definition globals.h:850
byte includeAFR
Definition globals.h:761
byte decelAmount
Definition globals.h:885
Definition globals.h:903
uint8_t ADCFILTER_O2
Definition globals.h:965
int8_t CrankAng
Fixed start-up/cranking ignition angle (See: corrections.ino)
Definition globals.h:907
byte idleAdvBins[6]
Definition globals.h:981
uint8_t ADCFILTER_MAP
Definition globals.h:967
byte dwellErrCorrect
Definition globals.h:989
byte ignBypassHiLo
Definition globals.h:960
byte dfcoRPM
RPM at which DFCO turns off/on at.
Definition globals.h:954
byte resetControlPin
Definition globals.h:926
byte fuelPumpPin
Fuel pump pin (copied as override to pinFuelPump, defaults to board default, See: init....
Definition globals.h:916
byte vvtMinClt
Definition globals.h:994
byte engineProtectMaxRPM
Definition globals.h:984
byte taeBins[4]
TPS based acceleration enrichment bins (Unit: %/s)
Definition globals.h:947
byte StgCycles
Definition globals.h:928
uint8_t bootloaderCaps
Definition globals.h:922
byte dfcoTPSThresh
Definition globals.h:956
uint8_t ADCFILTER_BAT
Definition globals.h:966
byte triggerTeeth
The full count of teeth on the trigger wheel if there were no gaps.
Definition globals.h:939
byte TrigEdge
Primary (RPM1) Trigger Edge - 0 - RISING, 1 = FALLING (Copied from this config to primaryTriggerEdge)
Definition globals.h:910
byte IgInv
Ignition signal invert (?) (GOING_LOW=0 (default by init.ino) / GOING_HIGH=1 )
Definition globals.h:912
byte wueBins[10]
Warmup Enrichment bins (Values are in configPage2.wueValues OLD:configTable1)
Definition globals.h:949
uint8_t ADCFILTER_TPS
Definition globals.h:962
byte SoftLimMax
Time the soft limit can run (units 0.1S)
Definition globals.h:945
uint8_t ADCFILTER_BARO
Definition globals.h:968
byte crankRPM
RPM below which the engine is considered to be cranking.
Definition globals.h:941
byte floodClear
TPS (raw adc count? % ?) value that triggers flood clear mode (No fuel whilst cranking,...
Definition globals.h:942
byte vvtDelay
Definition globals.h:995
byte maeRates[4]
Definition globals.h:974
byte idleAdvValues[6]
Definition globals.h:982
byte cltAdvBins[6]
Definition globals.h:970
byte sparkDur
Spark duration in ms * 10.
Definition globals.h:919
byte vvt2PWMdir
Definition globals.h:987
byte dfcoHyster
Definition globals.h:955
byte taeValues[4]
TPS based acceleration enrichment rates (Unit: % to add), values matched to thresholds of taeBins.
Definition globals.h:948
byte iatRetBins[6]
Inlet Air Temp timing retard curve bins (Unit: ...)
Definition globals.h:952
uint8_t dwellCrank
Dwell time whilst cranking.
Definition globals.h:937
byte cltAdvValues[6]
Definition globals.h:971
byte SoftRevLim
Soft rev limit (RPM/100)
Definition globals.h:943
byte baroFuelValues[8]
Definition globals.h:979
byte baroFuelBins[8]
Definition globals.h:978
byte HardRevLim
Hard rev limit (RPM/100)
Definition globals.h:946
byte SoftLimRetard
Amount soft limit (ignition) retard (degrees)
Definition globals.h:944
byte useDwellLim
Definition globals.h:931
int16_t triggerAngle
Angle (ATDC) when tooth No:1 on the primary wheel sends signal (-360 to +360 deg.)
Definition globals.h:905
byte TrigAngMul
Multiplier for non evenly divisible tooth counts.
Definition globals.h:908
uint8_t ADCFILTER_CLT
Definition globals.h:963
byte ignBypassEnabled
Definition globals.h:958
byte boostType
Boost Control type: 0=Open loop (OPEN_LOOP_BOOST), 1=closed loop (CLOSED_LOOP_BOOST)
Definition globals.h:930
uint8_t ADCFILTER_IAT
Definition globals.h:964
byte maeBins[4]
Definition globals.h:973
byte FILTER_FLEX
Definition globals.h:993
byte sparkMode
Definition globals.h:932
int8_t batVoltCorrect
Definition globals.h:976
byte TrigSpeed
Primary (RPM1) Trigger speed - 0 = crank speed (CRANK_SPEED), 1 = cam speed (CAM_SPEED),...
Definition globals.h:911
byte unusedBits4
Definition globals.h:991
byte dwellLimit
Definition globals.h:950
uint8_t dwellRun
Dwell time whilst running.
Definition globals.h:938
byte iatRetValues[6]
Inlet Air Temp timing retard curve values (Unit: ...)
Definition globals.h:953
byte triggerMissingTeeth
The size of the tooth gap (ie number of missing teeth)
Definition globals.h:940
int16_t vvt2CL0DutyAng
Definition globals.h:986
byte trigPatternSec
Mode for Missing tooth secondary trigger - 0=single tooth cam wheel (SEC_TRIGGER_SINGLE),...
Definition globals.h:920
byte triggerFilter
Definition globals.h:934
byte useResync
Definition globals.h:917
byte TrigPattern
Decoder configured (DECODER_MISSING_TOOTH, DECODER_BASIC_DISTRIBUTOR, DECODER_GM7X,...
Definition globals.h:913
byte PollLevelPolarity
Definition globals.h:921
byte TrigEdgeSec
Secondary (RPM2) Trigger Edge (See RPM1)
Definition globals.h:915
byte ignCranklock
Definition globals.h:935
byte ignBypassPin
Definition globals.h:959
byte dwellCorrectionValues[6]
Correction table for dwell vs battery voltage.
Definition globals.h:951
byte inj4cylPairing
Definition globals.h:988
byte CANBroadcastProtocol
Definition globals.h:990
int8_t FixAng
Fixed Ignition angle value (enabled by configPage2.fixAngEnable, copied to ignFixValue,...
Definition globals.h:906
byte resetControlConfig
Definition globals.h:924
byte ANGLEFILTER_VVT
Definition globals.h:992
Definition globals.h:1006
byte egoTemp
The temperature above which closed loop is enabled.
Definition globals.h:1017
byte flatSArm
Definition globals.h:1071
byte vvtFreq
Frequency of the boost PWM valve.
Definition globals.h:1042
byte iacCLValues[10]
Definition globals.h:1073
byte egoTPSMax
RPM must be above this for closed loop to function.
Definition globals.h:1030
byte tachoMode
Definition globals.h:1035
byte boostEnabled
Boost control enabled 0 =off, 1 = on.
Definition globals.h:1010
byte idleFreq
Frequency of the vvt PWM valve.
Definition globals.h:1043
byte boostFreq
Definition globals.h:1041
byte boostMode
Definition globals.h:1033
byte iacBins[10]
Definition globals.h:1076
byte flatSEnable
Flat shift enable.
Definition globals.h:1067
byte fanFreq
Definition globals.h:1096
byte fanSP
Definition globals.h:1094
byte vvtLoadSource
Load source for VVT (TPS or MAP)
Definition globals.h:1020
byte lnchSoftLim
Definition globals.h:1049
byte egoType
EGO Sensor Type 0=Disabled/None, 1=Narrowband, 2=Wideband.
Definition globals.h:1009
byte lnchHardLim
Definition globals.h:1051
byte egoLimit
Definition globals.h:1025
byte boostKI
Definition globals.h:1061
byte iacCrankSteps[4]
Definition globals.h:1077
byte vvt1Pin
TPS must be below this for closed loop to function.
Definition globals.h:1031
byte lnchPullRes
Definition globals.h:1064
byte egoRPM
Time in seconds after engine starts that closed loop becomes available.
Definition globals.h:1029
byte airDenRates[9]
Definition globals.h:1040
byte iacFastTemp
Definition globals.h:1086
byte idleKD
Definition globals.h:1057
byte iacAlgorithm
Definition globals.h:1081
byte voltageCorrectionBins[6]
Definition globals.h:1037
byte egoKP
Definition globals.h:1014
byte egoKI
Definition globals.h:1015
byte idleKI
Definition globals.h:1056
byte fanPin
Definition globals.h:1093
byte useEMAP
Whether to use fixed tacho pulse duration or match to dwell duration.
Definition globals.h:1036
byte fanInv
Definition globals.h:1091
byte egoAlgorithm
EGO Algorithm - Simple, PID, No correction.
Definition globals.h:1008
byte engineProtectType
Definition globals.h:1012
byte iacStepHyster
Definition globals.h:1089
byte boostKD
Definition globals.h:1062
byte fanHyster
Definition globals.h:1095
byte iacOLStepVal[10]
Definition globals.h:1074
byte iacCrankBins[4]
Definition globals.h:1079
byte fanUnused
Definition globals.h:1092
byte vvtCLAlterFuelTiming
Definition globals.h:1023
byte baroPin
Definition globals.h:1068
byte ego_max
AFR must be above this for closed loop to function.
Definition globals.h:1027
byte iacPWMrun
Run the PWM idle valve before engine is cranked over (0 = off, 1 = on)
Definition globals.h:1065
byte vvtPWMdir
VVT direction (normal or reverse)
Definition globals.h:1021
byte launchPin
Launch (control ?) pin.
Definition globals.h:1045
byte egoCount
The number of ignition cycles per (ego AFR ?) step.
Definition globals.h:1018
byte lnchFuelAdd
Definition globals.h:1052
byte launchHiLo
Definition globals.h:1047
byte iacPWMdir
Definition globals.h:1084
byte iacOLPWMVal[10]
Definition globals.h:1075
byte useExtBaro
Definition globals.h:1032
byte iacChannels
Definition globals.h:1083
byte fuelTrimEnabled
Definition globals.h:1066
byte iacStepTime
Definition globals.h:1082
byte iacCrankDuty[4]
Definition globals.h:1078
byte vvtMode
Valid VVT modes are 'on/off', 'open loop' and 'closed loop'.
Definition globals.h:1019
byte ego_min
Maximum amount the closed loop EGO control will vary the fuelling.
Definition globals.h:1026
byte flatSSoftWin
Definition globals.h:1069
byte vvtEnabled
Definition globals.h:1011
byte boostCutEnabled
Definition globals.h:1024
int8_t lnchRetard
Definition globals.h:1050
byte boostKP
Definition globals.h:1060
byte launchEnabled
Launch ...???... (control?) enabled.
Definition globals.h:1046
int8_t flatSRetard
Definition globals.h:1070
byte vvtCLUseHold
Definition globals.h:1022
byte egoKD
Definition globals.h:1016
byte fanPWMBins[4]
Definition globals.h:1097
byte injVoltageCorrectionValues[6]
Definition globals.h:1038
byte idleKP
Definition globals.h:1055
byte airDenBins[9]
Definition globals.h:1039
byte boostLimit
Boost limit (Kpa). Stored value is actual (kPa) value divided by 2, allowing kPa values up to 511.
Definition globals.h:1059
byte ego_sdelay
AFR must be below this for closed loop to function.
Definition globals.h:1028
byte iacStepHome
Definition globals.h:1088
byte boostPin
Boost control mode: 0=Simple (BOOST_MODE_SIMPLE) or 1=full (BOOST_MODE_FULL)
Definition globals.h:1034
Definition globals.h:1108
byte afrProtectMinMAP
Definition globals.h:1173
byte afrProtectDeviation
Definition globals.h:1176
byte unused10_179
Definition globals.h:1163
uint16_t caninput_source_can_address[16]
Definition globals.h:1116
byte enable_secondarySerial
Definition globals.h:1109
byte dfcoTaperFuel
Definition globals.h:1165
uint16_t canoutput_param_group[8]
Definition globals.h:1126
byte coolantProtTemp[6]
Definition globals.h:1161
byte afrProtectReactivationTPS
Definition globals.h:1178
byte boostByGear2
Definition globals.h:1152
byte iacCoolTime
Definition globals.h:1142
byte unused10_183
Definition globals.h:1168
byte speeduino_tsCanId
Definition globals.h:1134
byte coolantProtRPM[6]
Definition globals.h:1160
byte afrProtectEnabled
Definition globals.h:1172
byte hardRevMode
Definition globals.h:1159
byte dfcoTaperTime
Definition globals.h:1164
byte boostByGear4
Definition globals.h:1154
byte afrProtectMinTPS
Definition globals.h:1175
byte unused10_68
Definition globals.h:1123
byte boostByGear6
Definition globals.h:1156
byte afrProtectCutTime
Definition globals.h:1177
uint8_t canoutput_param_start_byte[8]
Definition globals.h:1127
byte idleAdvStartDelay
Definition globals.h:1149
byte unused10_111
Definition globals.h:1131
byte enable_intcan
Definition globals.h:1111
byte blankField
Definition globals.h:1145
uint16_t caninput_source_num_bytes
Definition globals.h:1118
uint8_t caninput_source_start_byte[16]
Definition globals.h:1117
byte secondarySerialProtocol
Definition globals.h:1112
byte iacStepperPower
Definition globals.h:1146
byte boostByGear5
Definition globals.h:1155
byte iacStepperInv
Definition globals.h:1141
uint8_t Auxinpina[16]
Definition globals.h:1138
byte canoutput_param_num_bytes[8]
Definition globals.h:1128
uint16_t obd_address
Definition globals.h:1137
byte PWMFanDuty[4]
Definition globals.h:1158
byte unused10_184
Definition globals.h:1170
byte canoutput_sel[8]
Definition globals.h:1125
byte unused9_0
Definition globals.h:1113
byte unused10_110
Definition globals.h:1130
byte caninput_sel[16]
Definition globals.h:1115
byte boostByGear1
Definition globals.h:1151
uint8_t Auxinpinb[16]
Definition globals.h:1139
byte intcan_available
Definition globals.h:1110
byte dfcoTaperEnable
Definition globals.h:1167
byte boostByGearEnabled
Definition globals.h:1144
uint16_t realtime_base_address
Definition globals.h:1136
byte egoMAPMax
Definition globals.h:1132
byte boostByGear3
Definition globals.h:1153
byte caninputEndianess
Definition globals.h:1120
byte afrProtectMinRPM
Definition globals.h:1174
uint16_t true_address
Definition globals.h:1135
byte iacMaxSteps
Definition globals.h:1148
byte enable_candata_out
Definition globals.h:1124
byte dfcoTaperAdvance
Definition globals.h:1166
byte egoMAPMin
Definition globals.h:1133
Definition globals.h:575
byte dwellCorrection
Definition globals.h:612
uint16_t baroADC
Definition globals.h:589
volatile byte syncLossCounter
Definition globals.h:675
byte ASEValue
Definition globals.h:684
int16_t vvt2Angle
Definition globals.h:693
byte testOutputs
Test Output bits (only first bit used/tested ?)
Definition globals.h:659
volatile bool hasSync
Definition globals.h:576
uint16_t canin[16]
16bit raw value of selected canin data for channels 0-15
Definition globals.h:663
byte oilPressure
Definition globals.h:689
uint8_t current_caninchannel
Definition globals.h:664
bool launchingSoft
Definition globals.h:652
int16_t EMAP
EMAP ... (See config6::useEMAP for EMAP enablement)
Definition globals.h:591
unsigned int PW3
In uS.
Definition globals.h:643
byte launchCorrection
Definition globals.h:624
unsigned int PW6
In uS.
Definition globals.h:646
bool idleUpActive
Definition globals.h:630
long vvt1Duty
Definition globals.h:682
bool CTPSActive
Definition globals.h:631
unsigned int PW8
In uS.
Definition globals.h:648
byte CLIdleTarget
Definition globals.h:629
byte vvt2TargetAngle
Definition globals.h:694
volatile byte status5
Status 5 ... (See also config10 Status 5* members and BIT_STATU5_* defines)
Definition globals.h:639
byte TPSlast
Definition globals.h:596
bool clutchTrigger
Definition globals.h:579
bool testActive
Definition globals.h:660
bool idleUpOutputActive
Definition globals.h:686
unsigned long AEEndTime
Definition globals.h:634
byte baroCorrection
Definition globals.h:623
bool flatShiftingHard
Definition globals.h:656
int16_t vvt1Angle
Definition globals.h:680
unsigned int PW4
In uS.
Definition globals.h:644
byte VE2
Definition globals.h:601
byte flexCorrection
Definition globals.h:625
volatile uint16_t loopsPerSecond
Definition globals.h:651
bool toothLogEnabled
Definition globals.h:678
byte VE1
Definition globals.h:600
int IAT
Definition globals.h:606
int16_t mapDOT
Definition globals.h:597
byte wueCorrection
Definition globals.h:620
byte batCorrection
Definition globals.h:621
int8_t advance
Definition globals.h:614
unsigned int PW1
In uS.
Definition globals.h:641
uint16_t dwell
dwell (coil primary winding/circuit on) time (in ms * 10 ? See correctionsDwell)
Definition globals.h:610
uint8_t tpsADC
Definition globals.h:594
uint8_t engine
Engine status bits (See BIT_ENGINE_* defines on top of this file)
Definition globals.h:640
volatile byte knockCount
Definition globals.h:677
byte nSquirts
Number of injector squirts per cycle (per injector)
Definition globals.h:668
int8_t advance2
Definition globals.h:616
volatile byte status4
Status bits (See BIT_STATUS4_* defines on top of this file)
Definition globals.h:638
uint16_t vss
Definition globals.h:685
byte knockRetard
Definition globals.h:676
byte TS_SD_Status
Definition globals.h:697
uint16_t boostTarget
Definition globals.h:658
bool fuelPumpOn
Definition globals.h:674
byte gear
Definition globals.h:687
volatile bool injPrimed
Definition globals.h:582
volatile byte secl
Definition globals.h:650
byte airConStatus
Definition globals.h:698
int coolant
Definition globals.h:604
byte VE
Definition globals.h:599
volatile uint16_t actualDwell
actual dwell time if new ignition mode is used (in uS)
Definition globals.h:611
byte fuelPressure
Definition globals.h:688
unsigned int clutchEngagedRPM
Definition globals.h:655
volatile uint32_t startRevolutions
Definition globals.h:657
unsigned int PW5
In uS.
Definition globals.h:645
volatile bool tachoAlt
Definition globals.h:584
uint16_t boostDuty
Boost Duty percentage value * 100 to give 2 points of precision.
Definition globals.h:661
bool previousClutchTrigger
Definition globals.h:580
byte battery10
Definition globals.h:613
volatile byte runSecs
Definition globals.h:649
uint16_t iatADC
Definition globals.h:607
int8_t advance1
Definition globals.h:615
uint16_t RPM
RPM - Current Revs per minute.
Definition globals.h:586
long longRPM
RPM as long int (gets assigned to / maintained in statuses.RPM as well)
Definition globals.h:588
byte wmiPW
Definition globals.h:692
volatile int8_t fuelTemp
Definition globals.h:633
byte vvt1TargetAngle
Definition globals.h:681
byte RPMdiv100
RPM value scaled (divided by 100) to fit a byte (0-255, e.g. 12000 => 120)
Definition globals.h:587
uint16_t corrections
Definition globals.h:617
long vvt2Duty
Definition globals.h:695
byte fanDuty
Definition globals.h:691
uint8_t TPS
Definition globals.h:593
byte outputsStatus
Definition globals.h:696
int16_t fuelLoad2
Definition globals.h:671
byte afrTarget
Definition globals.h:628
volatile byte status3
Status bits (See BIT_STATUS3_* defines on top of this file)
Definition globals.h:637
bool launchingHard
Definition globals.h:653
volatile int rpmDOT
Definition globals.h:598
byte fuelTempCorrection
Definition globals.h:626
int16_t fuelLoad
Definition globals.h:670
byte nChannels
Definition globals.h:669
byte nitrous_status
Definition globals.h:667
unsigned int PW2
In uS.
Definition globals.h:642
int16_t ignLoad2
Definition globals.h:673
volatile bool fpPrimed
Definition globals.h:581
int16_t tpsDOT
Definition globals.h:595
uint8_t O2_2
Definition globals.h:603
uint16_t freeRAM
Definition globals.h:654
int16_t ignLoad
Definition globals.h:672
byte compositeTriggerUsed
Definition globals.h:679
byte egoCorrection
Definition globals.h:619
int16_t flexBoostCorrection
Definition globals.h:666
bool initialisationComplete
Definition globals.h:578
int8_t flexIgnCorrection
Definition globals.h:627
byte idleLoad
Either the current steps or current duty cycle for the idle control.
Definition globals.h:662
uint16_t O2_2ADC
Definition globals.h:609
byte iatCorrection
Definition globals.h:622
uint8_t O2
Definition globals.h:602
uint16_t injAngle
Definition globals.h:683
long MAP
Manifold absolute pressure. Has to be a long for PID calcs (Boost control)
Definition globals.h:590
volatile bool tachoSweepEnabled
Definition globals.h:583
uint16_t crankRPM
Definition globals.h:665
uint8_t baro
Barometric pressure is simply the initial MAP reading, taken before the engine is running....
Definition globals.h:592
volatile byte ethanolPct
Definition globals.h:632
unsigned int PW7
In uS.
Definition globals.h:647
uint16_t AEamount
Definition globals.h:618
byte engineProtectStatus
Definition globals.h:690
volatile byte status2
status 2/control indicator bits (launch control, boost cut, spark errors, See BIT_STATUS2_* defines)
Definition globals.h:636
uint16_t cltADC
Definition globals.h:605
uint16_t O2ADC
Definition globals.h:608
volatile byte status1
Status bits (See BIT_STATUS1_* defines on top of this file)
Definition globals.h:635
Definition table2d.h:17
3D table data types and functions