Speeduino
Loading...
Searching...
No Matches
Classes | Macros | Typedefs | Enumerations | Functions | Variables
globals.h File Reference
#include <Arduino.h>
#include <SimplyAtomic.h>
#include "table2d.h"
#include "table3d.h"
#include "src/FastCRC/FastCRC.h"
#include <BOARD_H>
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  statuses
 
struct  config2
 
struct  config4
 
struct  config6
 
struct  config9
 
struct  config10
 
struct  cmpOperation
 
struct  config13
 
struct  config15
 

Macros

#define BIT_SET(a, b)   ((a) |= (1U<<(b)))
 
#define BIT_CLEAR(a, b)   ((a) &= ~(1U<<(b)))
 
#define BIT_CHECK(var, pos)   !!((var) & (1U<<(pos)))
 
#define BIT_TOGGLE(var, pos)   ((var)^= 1UL << (pos))
 
#define BIT_WRITE(var, pos, bitvalue)   ((bitvalue) ? BIT_SET((var), (pos)) : bitClear((var), (pos)))
 
#define CRANK_ANGLE_MAX   (max(CRANK_ANGLE_MAX_IGN, CRANK_ANGLE_MAX_INJ))
 
#define interruptSafe(c)   (noInterrupts(); {c} interrupts();)
 
#define MICROS_PER_SEC   INT32_C(1000000)
 
#define MICROS_PER_MIN   INT32_C(MICROS_PER_SEC*60U)
 
#define MICROS_PER_HOUR   INT32_C(MICROS_PER_MIN*60U)
 
#define SERIAL_PORT_PRIMARY   0
 
#define SERIAL_PORT_SECONDARY   3
 
#define LOAD_SOURCE_MAP   0
 
#define LOAD_SOURCE_TPS   1
 
#define LOAD_SOURCE_IMAPEMAP   2
 
#define BIT_ENGINE_RUN   0
 
#define BIT_ENGINE_CRANK   1
 
#define BIT_ENGINE_ASE   2
 
#define BIT_ENGINE_WARMUP   3
 
#define BIT_ENGINE_ACC   4
 
#define BIT_ENGINE_DCC   5
 
#define BIT_ENGINE_MAPACC   6
 
#define BIT_ENGINE_MAPDCC   7
 
#define BIT_STATUS1_INJ1   0
 
#define BIT_STATUS1_INJ2   1
 
#define BIT_STATUS1_INJ3   2
 
#define BIT_STATUS1_INJ4   3
 
#define BIT_STATUS1_DFCO   4
 
#define BIT_STATUS1_BOOSTCUT   5
 
#define BIT_STATUS1_TOOTHLOG1READY   6
 
#define BIT_STATUS1_TOOTHLOG2READY   7
 
#define BIT_STATUS2_HLAUNCH   0
 
#define BIT_STATUS2_SLAUNCH   1
 
#define BIT_STATUS2_HRDLIM   2
 
#define BIT_STATUS2_SFTLIM   3
 
#define BIT_STATUS2_BOOSTCUT   4
 
#define BIT_STATUS2_ERROR   5
 
#define BIT_STATUS2_IDLE   6
 
#define BIT_STATUS2_SYNC   7
 
#define BIT_STATUS5_FLATSH   0
 
#define BIT_STATUS5_FLATSS   1
 
#define BIT_STATUS5_SPARK2_ACTIVE   2
 
#define BIT_STATUS5_KNOCK_ACTIVE   3
 
#define BIT_STATUS5_KNOCK_PULSE   4
 
#define BIT_STATUS5_UNUSED6   5
 
#define BIT_STATUS5_UNUSED7   6
 
#define BIT_STATUS5_UNUSED8   7
 
#define BIT_TIMER_1HZ   0
 
#define BIT_TIMER_4HZ   1
 
#define BIT_TIMER_10HZ   2
 
#define BIT_TIMER_15HZ   3
 
#define BIT_TIMER_30HZ   4
 
#define BIT_TIMER_50HZ   5
 
#define BIT_TIMER_200HZ   6
 
#define BIT_TIMER_1KHZ   7
 
#define BIT_STATUS3_RESET_PREVENT   0
 
#define BIT_STATUS3_NITROUS   1
 
#define BIT_STATUS3_FUEL2_ACTIVE   2
 
#define BIT_STATUS3_VSS_REFRESH   3
 
#define BIT_STATUS3_HALFSYNC   4
 
#define BIT_STATUS3_NSQUIRTS1   5
 
#define BIT_STATUS3_NSQUIRTS2   6
 
#define BIT_STATUS3_NSQUIRTS3   7
 
#define BIT_STATUS4_WMI_EMPTY   0
 
#define BIT_STATUS4_VVT1_ERROR   1
 
#define BIT_STATUS4_VVT2_ERROR   2
 
#define BIT_STATUS4_FAN   3
 
#define BIT_STATUS4_BURNPENDING   4
 
#define BIT_STATUS4_STAGING_ACTIVE   5
 
#define BIT_STATUS4_COMMS_COMPAT   6
 
#define BIT_STATUS4_ALLOW_LEGACY_COMMS   7
 
#define BIT_AIRCON_REQUEST   0
 
#define BIT_AIRCON_COMPRESSOR   1
 
#define BIT_AIRCON_RPM_LOCKOUT   2
 
#define BIT_AIRCON_TPS_LOCKOUT   3
 
#define BIT_AIRCON_TURNING_ON   4
 
#define BIT_AIRCON_CLT_LOCKOUT   5
 
#define BIT_AIRCON_FAN   6
 
#define BIT_AIRCON_UNUSED8   7
 
#define TOOTH_LOG_SIZE   127U
 
#define O2_CALIBRATION_PAGE   2U
 
#define IAT_CALIBRATION_PAGE   1U
 
#define CLT_CALIBRATION_PAGE   0U
 
#define COMPOSITE_LOG_PRI   0
 
#define COMPOSITE_LOG_SEC   1
 
#define COMPOSITE_LOG_THIRD   2
 
#define COMPOSITE_LOG_TRIG   3
 
#define COMPOSITE_LOG_SYNC   4
 
#define COMPOSITE_ENGINE_CYCLE   5
 
#define EGO_TYPE_OFF   0
 
#define EGO_TYPE_NARROW   1
 
#define EGO_TYPE_WIDE   2
 
#define INJ_TYPE_PORT   0
 
#define INJ_TYPE_TBODY   1
 
#define INJ_PAIRED   0
 
#define INJ_SEMISEQUENTIAL   1
 
#define INJ_BANKED   2
 
#define INJ_SEQUENTIAL   3
 
#define INJ_PAIR_13_24   0
 
#define INJ_PAIR_14_23   1
 
#define OUTPUT_CONTROL_DIRECT   0
 
#define OUTPUT_CONTROL_MC33810   10
 
#define IGN_MODE_WASTED   0U
 
#define IGN_MODE_SINGLE   1U
 
#define IGN_MODE_WASTEDCOP   2U
 
#define IGN_MODE_SEQUENTIAL   3U
 
#define IGN_MODE_ROTARY   4U
 
#define SEC_TRIGGER_SINGLE   0
 
#define SEC_TRIGGER_4_1   1
 
#define SEC_TRIGGER_POLL   2
 
#define SEC_TRIGGER_5_3_2   3
 
#define SEC_TRIGGER_TOYOTA_3   4
 
#define ROTARY_IGN_FC   0
 
#define ROTARY_IGN_FD   1
 
#define ROTARY_IGN_RX8   2
 
#define BOOST_MODE_SIMPLE   0
 
#define BOOST_MODE_FULL   1
 
#define EN_BOOST_CONTROL_BARO   0
 
#define EN_BOOST_CONTROL_FIXED   1
 
#define WMI_MODE_SIMPLE   0
 
#define WMI_MODE_PROPORTIONAL   1
 
#define WMI_MODE_OPENLOOP   2
 
#define WMI_MODE_CLOSEDLOOP   3
 
#define HARD_CUT_FULL   0
 
#define HARD_CUT_ROLLING   1
 
#define EVEN_FIRE   0
 
#define ODD_FIRE   1
 
#define EGO_ALGORITHM_SIMPLE   0U
 
#define EGO_ALGORITHM_INVALID1   1U
 
#define EGO_ALGORITHM_PID   2U
 
#define EGO_ALGORITHM_NONE   3U
 
#define STAGING_MODE_TABLE   0
 
#define STAGING_MODE_AUTO   1
 
#define NITROUS_OFF   0
 
#define NITROUS_STAGE1   1
 
#define NITROUS_STAGE2   2
 
#define NITROUS_BOTH   3
 
#define PROTECT_CUT_OFF   0
 
#define PROTECT_CUT_IGN   1
 
#define PROTECT_CUT_FUEL   2
 
#define PROTECT_CUT_BOTH   3
 
#define PROTECT_IO_ERROR   7
 
#define AE_MODE_TPS   0
 
#define AE_MODE_MAP   1
 
#define AE_MODE_MULTIPLIER   0
 
#define AE_MODE_ADDER   1
 
#define KNOCK_MODE_OFF   0U
 
#define KNOCK_MODE_DIGITAL   1U
 
#define KNOCK_MODE_ANALOG   2U
 
#define KNOCK_TRIGGER_HIGH   0
 
#define KNOCK_TRIGGER_LOW   1
 
#define FUEL2_MODE_OFF   0
 
#define FUEL2_MODE_MULTIPLY   1
 
#define FUEL2_MODE_ADD   2
 
#define FUEL2_MODE_CONDITIONAL_SWITCH   3
 
#define FUEL2_MODE_INPUT_SWITCH   4
 
#define SPARK2_MODE_OFF   0
 
#define SPARK2_MODE_MULTIPLY   1
 
#define SPARK2_MODE_ADD   2
 
#define SPARK2_MODE_CONDITIONAL_SWITCH   3
 
#define SPARK2_MODE_INPUT_SWITCH   4
 
#define FUEL2_CONDITION_RPM   0
 
#define FUEL2_CONDITION_MAP   1
 
#define FUEL2_CONDITION_TPS   2
 
#define FUEL2_CONDITION_ETH   3
 
#define SPARK2_CONDITION_RPM   0
 
#define SPARK2_CONDITION_MAP   1
 
#define SPARK2_CONDITION_TPS   2
 
#define SPARK2_CONDITION_ETH   3
 
#define RESET_CONTROL_DISABLED   0U
 
#define RESET_CONTROL_PREVENT_WHEN_RUNNING   1U
 
#define RESET_CONTROL_PREVENT_ALWAYS   2U
 
#define RESET_CONTROL_SERIAL_COMMAND   3U
 
#define OPEN_LOOP_BOOST   0
 
#define CLOSED_LOOP_BOOST   1
 
#define SOFT_LIMIT_FIXED   0
 
#define SOFT_LIMIT_RELATIVE   1
 
#define VVT_MODE_ONOFF   0
 
#define VVT_MODE_OPEN_LOOP   1
 
#define VVT_MODE_CLOSED_LOOP   2
 
#define VVT_LOAD_MAP   0
 
#define VVT_LOAD_TPS   1
 
#define MULTIPLY_MAP_MODE_OFF   0
 
#define MULTIPLY_MAP_MODE_BARO   1
 
#define MULTIPLY_MAP_MODE_100   2
 
#define FOUR_STROKE   0U
 
#define TWO_STROKE   1U
 
#define GOING_LOW   0
 
#define GOING_HIGH   1
 
#define BATTV_COR_MODE_WHOLE   0
 
#define BATTV_COR_MODE_OPENTIME   1
 
#define INJ1_CMD_BIT   0
 
#define INJ2_CMD_BIT   1
 
#define INJ3_CMD_BIT   2
 
#define INJ4_CMD_BIT   3
 
#define INJ5_CMD_BIT   4
 
#define INJ6_CMD_BIT   5
 
#define INJ7_CMD_BIT   6
 
#define INJ8_CMD_BIT   7
 
#define IGN1_CMD_BIT   0
 
#define IGN2_CMD_BIT   1
 
#define IGN3_CMD_BIT   2
 
#define IGN4_CMD_BIT   3
 
#define IGN5_CMD_BIT   4
 
#define IGN6_CMD_BIT   5
 
#define IGN7_CMD_BIT   6
 
#define IGN8_CMD_BIT   7
 
#define ENGINE_PROTECT_BIT_RPM   0
 
#define ENGINE_PROTECT_BIT_MAP   1
 
#define ENGINE_PROTECT_BIT_OIL   2
 
#define ENGINE_PROTECT_BIT_AFR   3
 
#define ENGINE_PROTECT_BIT_COOLANT   4
 
#define CALIBRATION_TABLE_SIZE   512
 Calibration table size for CLT, IAT, O2.
 
#define CALIBRATION_TEMPERATURE_OFFSET   40
 
#define OFFSET_FUELTRIM   127U
 The fuel trim tables are offset by 128 to allow for -128 to +128 values.
 
#define OFFSET_IGNITION   40
 Ignition values from the main spark table are offset 40 degrees downwards to allow for negative spark timing.
 
#define SERIAL_BUFFER_THRESHOLD   32
 When the serial buffer is filled to greater than this threshold value, the serial processing operations will be performed more urgently in order to avoid it overflowing. Serial buffer is 64 bytes long, so the threshold is set at half this as a reasonable figure.
 
#define LOGGER_CSV_SEPARATOR_SEMICOLON   0
 
#define LOGGER_CSV_SEPARATOR_COMMA   1
 
#define LOGGER_CSV_SEPARATOR_TAB   2
 
#define LOGGER_CSV_SEPARATOR_SPACE   3
 
#define LOGGER_DISABLED   0
 
#define LOGGER_CSV   1
 
#define LOGGER_BINARY   2
 
#define LOGGER_RATE_1HZ   0
 
#define LOGGER_RATE_4HZ   1
 
#define LOGGER_RATE_10HZ   2
 
#define LOGGER_RATE_30HZ   3
 
#define LOGGER_FILENAMING_OVERWRITE   0
 
#define LOGGER_FILENAMING_DATETIME   1
 
#define LOGGER_FILENAMING_SEQENTIAL   2
 
#define pinIsInjector(pin)   ( ((pin) == pinInjector1) || ((pin) == pinInjector2) || ((pin) == pinInjector3) || ((pin) == pinInjector4) || ((pin) == pinInjector5) || ((pin) == pinInjector6) || ((pin) == pinInjector7) || ((pin) == pinInjector8) )
 
#define pinIsIgnition(pin)   ( ((pin) == pinCoil1) || ((pin) == pinCoil2) || ((pin) == pinCoil3) || ((pin) == pinCoil4) || ((pin) == pinCoil5) || ((pin) == pinCoil6) || ((pin) == pinCoil7) || ((pin) == pinCoil8) )
 
#define pinIsSensor(pin)   ( ((pin) == pinCLT) || ((pin) == pinIAT) || ((pin) == pinMAP) || ((pin) == pinTPS) || ((pin) == pinO2) || ((pin) == pinBat) || (((pin) == pinFlex) && (configPage2.flexEnabled != 0)) )
 
#define IDLEADVANCE_MODE_OFF   0U
 
#define IDLEADVANCE_MODE_ADDED   1U
 
#define IDLEADVANCE_MODE_SWITCHED   2U
 
#define IDLEADVANCE_ALGO_TPS   0U
 
#define IDLEADVANCE_ALGO_CTPS   1U
 

Typedefs

typedef table3d6RpmLoad trimTable3d
 

Enumerations

enum  MAPSamplingMethod { MAPSamplingInstantaneous = 0 , MAPSamplingCycleAverage = 1 , MAPSamplingCycleMinimum = 2 , MAPSamplingIgnitionEventAverage = 3 }
 

Functions

static bool HasAnySyncUnsafe (const statuses &status)
 Non-atomic version of HasAnySync. **Should only be called in an ATOMIC() block***.
 
static bool HasAnySync (const statuses &status)
 
bool pinIsOutput (byte pin)
 
bool pinIsUsed (byte pin)
 

Variables

const char TSfirmwareVersion []
 
const byte data_structure_version
 
struct table3d16RpmLoad fuelTable
 16x16 fuel map
 
struct table3d16RpmLoad fuelTable2
 16x16 fuel map
 
struct table3d16RpmLoad ignitionTable
 16x16 ignition map
 
struct table3d16RpmLoad ignitionTable2
 16x16 ignition map
 
struct table3d16RpmLoad afrTable
 16x16 afr target map
 
struct table3d8RpmLoad stagingTable
 8x8 fuel staging table
 
struct table3d8RpmLoad boostTable
 8x8 boost map
 
struct table3d8RpmLoad boostTableLookupDuty
 8x8 boost map lookup table
 
struct table3d8RpmLoad vvtTable
 8x8 vvt map
 
struct table3d8RpmLoad vvt2Table
 8x8 vvt2 map
 
struct table3d8RpmLoad wmiTable
 8x8 wmi map
 
trimTable3d trim1Table
 6x6 Fuel trim 1 map
 
trimTable3d trim2Table
 6x6 Fuel trim 2 map
 
trimTable3d trim3Table
 6x6 Fuel trim 3 map
 
trimTable3d trim4Table
 6x6 Fuel trim 4 map
 
trimTable3d trim5Table
 6x6 Fuel trim 5 map
 
trimTable3d trim6Table
 6x6 Fuel trim 6 map
 
trimTable3d trim7Table
 6x6 Fuel trim 7 map
 
trimTable3d trim8Table
 6x6 Fuel trim 8 map
 
struct table3d4RpmLoad dwellTable
 4x4 Dwell map
 
struct table2D taeTable
 4 bin TPS Acceleration Enrichment map (2D)
 
struct table2D maeTable
 
struct table2D WUETable
 10 bin Warm Up Enrichment map (2D)
 
struct table2D ASETable
 4 bin After Start Enrichment map (2D)
 
struct table2D ASECountTable
 4 bin After Start duration map (2D)
 
struct table2D PrimingPulseTable
 4 bin Priming pulsewidth map (2D)
 
struct table2D crankingEnrichTable
 4 bin cranking Enrichment map (2D)
 
struct table2D dwellVCorrectionTable
 6 bin dwell voltage correction (2D)
 
struct table2D injectorVCorrectionTable
 6 bin injector voltage correction (2D)
 
struct table2D injectorAngleTable
 4 bin injector angle curve (2D)
 
struct table2D IATDensityCorrectionTable
 9 bin inlet air temperature density correction (2D)
 
struct table2D baroFuelTable
 8 bin baro correction curve (2D)
 
struct table2D IATRetardTable
 6 bin ignition adjustment based on inlet air temperature (2D)
 
struct table2D idleTargetTable
 10 bin idle target table for idle timing (2D)
 
struct table2D idleAdvanceTable
 6 bin idle advance adjustment table based on RPM difference (2D)
 
struct table2D CLTAdvanceTable
 6 bin ignition adjustment based on coolant temperature (2D)
 
struct table2D rotarySplitTable
 8 bin ignition split curve for rotary leading/trailing (2D)
 
struct table2D flexFuelTable
 6 bin flex fuel correction table for fuel adjustments (2D)
 
struct table2D flexAdvTable
 6 bin flex fuel correction table for timing advance (2D)
 
struct table2D flexBoostTable
 6 bin flex fuel correction table for boost adjustments (2D)
 
struct table2D fuelTempTable
 6 bin flex fuel correction table for fuel adjustments (2D)
 
struct table2D knockWindowStartTable
 
struct table2D knockWindowDurationTable
 
struct table2D oilPressureProtectTable
 
struct table2D wmiAdvTable
 
struct table2D coolantProtectTable
 
struct table2D fanPWMTable
 
struct table2D rollingCutTable
 
volatile PORT_TYPEinj1_pin_port
 volatile inj*_pin_port and inj*_pin_mask vars are for the direct port manipulation of the injectors, coils and aux outputs.
 
volatile PINMASK_TYPE inj1_pin_mask
 
volatile PORT_TYPEinj2_pin_port
 
volatile PINMASK_TYPE inj2_pin_mask
 
volatile PORT_TYPEinj3_pin_port
 
volatile PINMASK_TYPE inj3_pin_mask
 
volatile PORT_TYPEinj4_pin_port
 
volatile PINMASK_TYPE inj4_pin_mask
 
volatile PORT_TYPEinj5_pin_port
 
volatile PINMASK_TYPE inj5_pin_mask
 
volatile PORT_TYPEinj6_pin_port
 
volatile PINMASK_TYPE inj6_pin_mask
 
volatile PORT_TYPEinj7_pin_port
 
volatile PINMASK_TYPE inj7_pin_mask
 
volatile PORT_TYPEinj8_pin_port
 
volatile PINMASK_TYPE inj8_pin_mask
 
volatile PORT_TYPEign1_pin_port
 
volatile PINMASK_TYPE ign1_pin_mask
 
volatile PORT_TYPEign2_pin_port
 
volatile PINMASK_TYPE ign2_pin_mask
 
volatile PORT_TYPEign3_pin_port
 
volatile PINMASK_TYPE ign3_pin_mask
 
volatile PORT_TYPEign4_pin_port
 
volatile PINMASK_TYPE ign4_pin_mask
 
volatile PORT_TYPEign5_pin_port
 
volatile PINMASK_TYPE ign5_pin_mask
 
volatile PORT_TYPEign6_pin_port
 
volatile PINMASK_TYPE ign6_pin_mask
 
volatile PORT_TYPEign7_pin_port
 
volatile PINMASK_TYPE ign7_pin_mask
 
volatile PORT_TYPEign8_pin_port
 
volatile PINMASK_TYPE ign8_pin_mask
 
volatile PORT_TYPEtach_pin_port
 
volatile PINMASK_TYPE tach_pin_mask
 
volatile PORT_TYPEpump_pin_port
 
volatile PINMASK_TYPE pump_pin_mask
 
volatile PORT_TYPEflex_pin_port
 
volatile PINMASK_TYPE flex_pin_mask
 
volatile PORT_TYPEtriggerPri_pin_port
 
volatile PINMASK_TYPE triggerPri_pin_mask
 
volatile PORT_TYPEtriggerSec_pin_port
 
volatile PINMASK_TYPE triggerSec_pin_mask
 
volatile PORT_TYPEtriggerThird_pin_port
 
volatile PINMASK_TYPE triggerThird_pin_mask
 
byte triggerInterrupt
 
byte triggerInterrupt2
 
byte triggerInterrupt3
 
byte fpPrimeTime
 The time (in seconds, based on statuses::secl) that the fuel pump started priming.
 
uint8_t softLimitTime
 
volatile uint16_t mainLoopCount
 
uint32_t revolutionTime
 
volatile unsigned long timer5_overflow_count
 
volatile unsigned long ms_counter
 
uint16_t fixedCrankingOverride
 
volatile uint32_t toothHistory [TOOTH_LOG_SIZE]
 Tooth trigger history - delta time (in uS) from last tooth (Indexed by toothHistoryIndex)
 
volatile uint8_t compositeLogHistory [TOOTH_LOG_SIZE]
 
volatile unsigned int toothHistoryIndex
 Current index to toothHistory array.
 
unsigned long currentLoopTime
 
volatile uint16_t ignitionCount
 
byte primaryTriggerEdge
 
byte secondaryTriggerEdge
 
byte tertiaryTriggerEdge
 
int CRANK_ANGLE_MAX_IGN
 
int CRANK_ANGLE_MAX_INJ
 The number of crank degrees that the system track over. 360 for wasted / timed batch and 720 for sequential.
 
volatile uint32_t runSecsX10
 
volatile uint32_t seclx10
 
volatile byte HWTest_INJ
 
volatile byte HWTest_INJ_Pulsed
 
volatile byte HWTest_IGN
 
volatile byte HWTest_IGN_Pulsed
 
byte maxIgnOutputs
 
byte maxInjOutputs
 
byte resetControl
 resetControl needs to be here (as global) because using the config page (4) directly can prevent burning the setting
 
volatile byte TIMER_mask
 
volatile byte LOOP_TIMER
 
byte pinInjector1
 Various pin numbering (Injectors, Ign outputs, CAS, Cam, Sensors. etc.) assignments.
 
byte pinInjector2
 Output pin injector 2.
 
byte pinInjector3
 Output pin injector 3.
 
byte pinInjector4
 Output pin injector 4.
 
byte pinInjector5
 Output pin injector 5.
 
byte pinInjector6
 Output pin injector 6.
 
byte pinInjector7
 Output pin injector 7.
 
byte pinInjector8
 Output pin injector 8.
 
byte injectorOutputControl
 
byte pinCoil1
 Pin for coil 1.
 
byte pinCoil2
 Pin for coil 2.
 
byte pinCoil3
 Pin for coil 3.
 
byte pinCoil4
 Pin for coil 4.
 
byte pinCoil5
 Pin for coil 5.
 
byte pinCoil6
 Pin for coil 6.
 
byte pinCoil7
 Pin for coil 7.
 
byte pinCoil8
 Pin for coil 8.
 
byte ignitionOutputControl
 
byte pinTrigger
 RPM1 (Typically CAS=crankshaft angle sensor) pin.
 
byte pinTrigger2
 RPM2 (Typically the Cam Sensor) pin.
 
byte pinTrigger3
 the 2nd cam sensor pin
 
byte pinTPS
 
byte pinMAP
 
byte pinEMAP
 
byte pinMAP2
 
byte pinIAT
 
byte pinCLT
 
byte pinO2
 
byte pinO2_2
 
byte pinBat
 
byte pinDisplayReset
 
byte pinTachOut
 
byte pinFuelPump
 
byte pinIdle1
 
byte pinIdle2
 
byte pinIdleUp
 
byte pinIdleUpOutput
 
byte pinCTPS
 
byte pinFuel2Input
 
byte pinSpark2Input
 
byte pinSpareTemp1
 
byte pinSpareTemp2
 
byte pinSpareOut1
 
byte pinSpareOut2
 
byte pinSpareOut3
 
byte pinSpareOut4
 
byte pinSpareOut5
 
byte pinSpareOut6
 
byte pinSpareHOut1
 
byte pinSpareHOut2
 
byte pinSpareLOut1
 
byte pinSpareLOut2
 
byte pinSpareLOut3
 
byte pinSpareLOut4
 
byte pinSpareLOut5
 
byte pinBoost
 
byte pinVVT_1
 vvt (variable valve timing) output 1
 
byte pinVVT_2
 vvt (variable valve timing) output 2
 
byte pinFan
 Cooling fan output (on/off? See: auxiliaries.ino)
 
byte pinStepperDir
 
byte pinStepperStep
 
byte pinStepperEnable
 
byte pinLaunch
 
byte pinIgnBypass
 
byte pinFlex
 
byte pinVSS
 
byte pinBaro
 
byte pinResetControl
 
byte pinFuelPressure
 
byte pinOilPressure
 
byte pinWMIEmpty
 
byte pinWMIIndicator
 
byte pinWMIEnabled
 
byte pinMC33810_1_CS
 
byte pinMC33810_2_CS
 
byte pinSDEnable
 
byte pinAirConComp
 
byte pinAirConFan
 
byte pinAirConRequest
 
struct statuses currentStatus
 
struct config2 configPage2
 
struct config4 configPage4
 
struct config6 configPage6
 
struct config9 configPage9
 
struct config10 configPage10
 
struct config13 configPage13
 
struct config15 configPage15
 
uint16_t cltCalibration_bins [32]
 
uint16_t cltCalibration_values [32]
 
uint16_t iatCalibration_bins [32]
 
uint16_t iatCalibration_values [32]
 
uint16_t o2Calibration_bins [32]
 
uint8_t o2Calibration_values [32]
 
struct table2D cltCalibrationTable
 
struct table2D iatCalibrationTable
 
struct table2D o2CalibrationTable
 

Detailed Description

Global defines, macros, struct definitions (statuses, config2, config4, config*), extern-definitions (for globally accessible vars).

Note on configuration struct layouts

Once the struct members have been assigned to certain "role" (in certain SW version), they should not be "moved around" as the structs are stored onto EEPROM as-is and the offset and size of member needs to remain constant. Also removing existing struct members would disturb layouts. Because of this a certain amount unused old members will be left into the structs. For the storage related reasons also the bit fields are defined in byte-size (or multiple of ...) chunks.

Config Structs and 2D, 3D Tables

The config* structures contain information coming from tuning SW (e.g. TS) for 2D and 3D tables, where looked up value is not a result of direct array lookup, but from interpolation algorithm. Because of standard, reusable interpolation routines associated with structs table2D and table3D, the values from config are copied from config* structs to table2D (table3D destined configurations are not stored in config* structures).

Board choice

There's a C-preprocessor based "#if defined" logic present in this header file based on the Arduino IDE compiler set CPU (+board?) type, e.g. __AVR_ATmega2560__. This respectively drives (withi it's "#if defined ..." block):

Macro Definition Documentation

◆ AE_MODE_ADDER

#define AE_MODE_ADDER   1

◆ AE_MODE_MAP

#define AE_MODE_MAP   1

◆ AE_MODE_MULTIPLIER

#define AE_MODE_MULTIPLIER   0

◆ AE_MODE_TPS

#define AE_MODE_TPS   0

◆ BATTV_COR_MODE_OPENTIME

#define BATTV_COR_MODE_OPENTIME   1

◆ BATTV_COR_MODE_WHOLE

#define BATTV_COR_MODE_WHOLE   0

◆ BIT_AIRCON_CLT_LOCKOUT

#define BIT_AIRCON_CLT_LOCKOUT   5

◆ BIT_AIRCON_COMPRESSOR

#define BIT_AIRCON_COMPRESSOR   1

◆ BIT_AIRCON_FAN

#define BIT_AIRCON_FAN   6

◆ BIT_AIRCON_REQUEST

#define BIT_AIRCON_REQUEST   0

◆ BIT_AIRCON_RPM_LOCKOUT

#define BIT_AIRCON_RPM_LOCKOUT   2

◆ BIT_AIRCON_TPS_LOCKOUT

#define BIT_AIRCON_TPS_LOCKOUT   3

◆ BIT_AIRCON_TURNING_ON

#define BIT_AIRCON_TURNING_ON   4

◆ BIT_AIRCON_UNUSED8

#define BIT_AIRCON_UNUSED8   7

◆ BIT_CHECK

#define BIT_CHECK (   var,
  pos 
)    !!((var) & (1U<<(pos)))

◆ BIT_CLEAR

#define BIT_CLEAR (   a,
  b 
)    ((a) &= ~(1U<<(b)))

◆ BIT_ENGINE_ACC

#define BIT_ENGINE_ACC   4

◆ BIT_ENGINE_ASE

#define BIT_ENGINE_ASE   2

◆ BIT_ENGINE_CRANK

#define BIT_ENGINE_CRANK   1

◆ BIT_ENGINE_DCC

#define BIT_ENGINE_DCC   5

◆ BIT_ENGINE_MAPACC

#define BIT_ENGINE_MAPACC   6

◆ BIT_ENGINE_MAPDCC

#define BIT_ENGINE_MAPDCC   7

◆ BIT_ENGINE_RUN

#define BIT_ENGINE_RUN   0

◆ BIT_ENGINE_WARMUP

#define BIT_ENGINE_WARMUP   3

◆ BIT_SET

#define BIT_SET (   a,
  b 
)    ((a) |= (1U<<(b)))

◆ BIT_STATUS1_BOOSTCUT

#define BIT_STATUS1_BOOSTCUT   5

◆ BIT_STATUS1_DFCO

#define BIT_STATUS1_DFCO   4

◆ BIT_STATUS1_INJ1

#define BIT_STATUS1_INJ1   0

◆ BIT_STATUS1_INJ2

#define BIT_STATUS1_INJ2   1

◆ BIT_STATUS1_INJ3

#define BIT_STATUS1_INJ3   2

◆ BIT_STATUS1_INJ4

#define BIT_STATUS1_INJ4   3

◆ BIT_STATUS1_TOOTHLOG1READY

#define BIT_STATUS1_TOOTHLOG1READY   6

◆ BIT_STATUS1_TOOTHLOG2READY

#define BIT_STATUS1_TOOTHLOG2READY   7

◆ BIT_STATUS2_BOOSTCUT

#define BIT_STATUS2_BOOSTCUT   4

◆ BIT_STATUS2_ERROR

#define BIT_STATUS2_ERROR   5

◆ BIT_STATUS2_HLAUNCH

#define BIT_STATUS2_HLAUNCH   0

◆ BIT_STATUS2_HRDLIM

#define BIT_STATUS2_HRDLIM   2

◆ BIT_STATUS2_IDLE

#define BIT_STATUS2_IDLE   6

◆ BIT_STATUS2_SFTLIM

#define BIT_STATUS2_SFTLIM   3

◆ BIT_STATUS2_SLAUNCH

#define BIT_STATUS2_SLAUNCH   1

◆ BIT_STATUS2_SYNC

#define BIT_STATUS2_SYNC   7

◆ BIT_STATUS3_FUEL2_ACTIVE

#define BIT_STATUS3_FUEL2_ACTIVE   2

◆ BIT_STATUS3_HALFSYNC

#define BIT_STATUS3_HALFSYNC   4

◆ BIT_STATUS3_NITROUS

#define BIT_STATUS3_NITROUS   1

◆ BIT_STATUS3_NSQUIRTS1

#define BIT_STATUS3_NSQUIRTS1   5

◆ BIT_STATUS3_NSQUIRTS2

#define BIT_STATUS3_NSQUIRTS2   6

◆ BIT_STATUS3_NSQUIRTS3

#define BIT_STATUS3_NSQUIRTS3   7

◆ BIT_STATUS3_RESET_PREVENT

#define BIT_STATUS3_RESET_PREVENT   0

◆ BIT_STATUS3_VSS_REFRESH

#define BIT_STATUS3_VSS_REFRESH   3

◆ BIT_STATUS4_ALLOW_LEGACY_COMMS

#define BIT_STATUS4_ALLOW_LEGACY_COMMS   7

◆ BIT_STATUS4_BURNPENDING

#define BIT_STATUS4_BURNPENDING   4

◆ BIT_STATUS4_COMMS_COMPAT

#define BIT_STATUS4_COMMS_COMPAT   6

◆ BIT_STATUS4_FAN

#define BIT_STATUS4_FAN   3

◆ BIT_STATUS4_STAGING_ACTIVE

#define BIT_STATUS4_STAGING_ACTIVE   5

◆ BIT_STATUS4_VVT1_ERROR

#define BIT_STATUS4_VVT1_ERROR   1

◆ BIT_STATUS4_VVT2_ERROR

#define BIT_STATUS4_VVT2_ERROR   2

◆ BIT_STATUS4_WMI_EMPTY

#define BIT_STATUS4_WMI_EMPTY   0

◆ BIT_STATUS5_FLATSH

#define BIT_STATUS5_FLATSH   0

◆ BIT_STATUS5_FLATSS

#define BIT_STATUS5_FLATSS   1

◆ BIT_STATUS5_KNOCK_ACTIVE

#define BIT_STATUS5_KNOCK_ACTIVE   3

◆ BIT_STATUS5_KNOCK_PULSE

#define BIT_STATUS5_KNOCK_PULSE   4

◆ BIT_STATUS5_SPARK2_ACTIVE

#define BIT_STATUS5_SPARK2_ACTIVE   2

◆ BIT_STATUS5_UNUSED6

#define BIT_STATUS5_UNUSED6   5

◆ BIT_STATUS5_UNUSED7

#define BIT_STATUS5_UNUSED7   6

◆ BIT_STATUS5_UNUSED8

#define BIT_STATUS5_UNUSED8   7

◆ BIT_TIMER_10HZ

#define BIT_TIMER_10HZ   2

◆ BIT_TIMER_15HZ

#define BIT_TIMER_15HZ   3

◆ BIT_TIMER_1HZ

#define BIT_TIMER_1HZ   0

◆ BIT_TIMER_1KHZ

#define BIT_TIMER_1KHZ   7

◆ BIT_TIMER_200HZ

#define BIT_TIMER_200HZ   6

◆ BIT_TIMER_30HZ

#define BIT_TIMER_30HZ   4

◆ BIT_TIMER_4HZ

#define BIT_TIMER_4HZ   1

◆ BIT_TIMER_50HZ

#define BIT_TIMER_50HZ   5

◆ BIT_TOGGLE

#define BIT_TOGGLE (   var,
  pos 
)    ((var)^= 1UL << (pos))

◆ BIT_WRITE

#define BIT_WRITE (   var,
  pos,
  bitvalue 
)    ((bitvalue) ? BIT_SET((var), (pos)) : bitClear((var), (pos)))

◆ BOOST_MODE_FULL

#define BOOST_MODE_FULL   1

◆ BOOST_MODE_SIMPLE

#define BOOST_MODE_SIMPLE   0

◆ CALIBRATION_TABLE_SIZE

#define CALIBRATION_TABLE_SIZE   512

Calibration table size for CLT, IAT, O2.

◆ CALIBRATION_TEMPERATURE_OFFSET

#define CALIBRATION_TEMPERATURE_OFFSET   40

All temperature measurements are stored offset by 40 degrees. This is so we can use an unsigned byte (0-255) to represent temperature ranges from -40 to 215

◆ CLOSED_LOOP_BOOST

#define CLOSED_LOOP_BOOST   1

◆ CLT_CALIBRATION_PAGE

#define CLT_CALIBRATION_PAGE   0U

◆ COMPOSITE_ENGINE_CYCLE

#define COMPOSITE_ENGINE_CYCLE   5

◆ COMPOSITE_LOG_PRI

#define COMPOSITE_LOG_PRI   0

◆ COMPOSITE_LOG_SEC

#define COMPOSITE_LOG_SEC   1

◆ COMPOSITE_LOG_SYNC

#define COMPOSITE_LOG_SYNC   4

◆ COMPOSITE_LOG_THIRD

#define COMPOSITE_LOG_THIRD   2

◆ COMPOSITE_LOG_TRIG

#define COMPOSITE_LOG_TRIG   3

◆ CRANK_ANGLE_MAX

◆ EGO_ALGORITHM_INVALID1

#define EGO_ALGORITHM_INVALID1   1U

◆ EGO_ALGORITHM_NONE

#define EGO_ALGORITHM_NONE   3U

◆ EGO_ALGORITHM_PID

#define EGO_ALGORITHM_PID   2U

◆ EGO_ALGORITHM_SIMPLE

#define EGO_ALGORITHM_SIMPLE   0U

◆ EGO_TYPE_NARROW

#define EGO_TYPE_NARROW   1

◆ EGO_TYPE_OFF

#define EGO_TYPE_OFF   0

◆ EGO_TYPE_WIDE

#define EGO_TYPE_WIDE   2

◆ EN_BOOST_CONTROL_BARO

#define EN_BOOST_CONTROL_BARO   0

◆ EN_BOOST_CONTROL_FIXED

#define EN_BOOST_CONTROL_FIXED   1

◆ ENGINE_PROTECT_BIT_AFR

#define ENGINE_PROTECT_BIT_AFR   3

◆ ENGINE_PROTECT_BIT_COOLANT

#define ENGINE_PROTECT_BIT_COOLANT   4

◆ ENGINE_PROTECT_BIT_MAP

#define ENGINE_PROTECT_BIT_MAP   1

◆ ENGINE_PROTECT_BIT_OIL

#define ENGINE_PROTECT_BIT_OIL   2

◆ ENGINE_PROTECT_BIT_RPM

#define ENGINE_PROTECT_BIT_RPM   0

◆ EVEN_FIRE

#define EVEN_FIRE   0

◆ FOUR_STROKE

#define FOUR_STROKE   0U

◆ FUEL2_CONDITION_ETH

#define FUEL2_CONDITION_ETH   3

◆ FUEL2_CONDITION_MAP

#define FUEL2_CONDITION_MAP   1

◆ FUEL2_CONDITION_RPM

#define FUEL2_CONDITION_RPM   0

◆ FUEL2_CONDITION_TPS

#define FUEL2_CONDITION_TPS   2

◆ FUEL2_MODE_ADD

#define FUEL2_MODE_ADD   2

◆ FUEL2_MODE_CONDITIONAL_SWITCH

#define FUEL2_MODE_CONDITIONAL_SWITCH   3

◆ FUEL2_MODE_INPUT_SWITCH

#define FUEL2_MODE_INPUT_SWITCH   4

◆ FUEL2_MODE_MULTIPLY

#define FUEL2_MODE_MULTIPLY   1

◆ FUEL2_MODE_OFF

#define FUEL2_MODE_OFF   0

◆ GOING_HIGH

#define GOING_HIGH   1

◆ GOING_LOW

#define GOING_LOW   0

◆ HARD_CUT_FULL

#define HARD_CUT_FULL   0

◆ HARD_CUT_ROLLING

#define HARD_CUT_ROLLING   1

◆ IAT_CALIBRATION_PAGE

#define IAT_CALIBRATION_PAGE   1U

◆ IDLEADVANCE_ALGO_CTPS

#define IDLEADVANCE_ALGO_CTPS   1U

◆ IDLEADVANCE_ALGO_TPS

#define IDLEADVANCE_ALGO_TPS   0U

◆ IDLEADVANCE_MODE_ADDED

#define IDLEADVANCE_MODE_ADDED   1U

◆ IDLEADVANCE_MODE_OFF

#define IDLEADVANCE_MODE_OFF   0U

◆ IDLEADVANCE_MODE_SWITCHED

#define IDLEADVANCE_MODE_SWITCHED   2U

◆ IGN1_CMD_BIT

#define IGN1_CMD_BIT   0

◆ IGN2_CMD_BIT

#define IGN2_CMD_BIT   1

◆ IGN3_CMD_BIT

#define IGN3_CMD_BIT   2

◆ IGN4_CMD_BIT

#define IGN4_CMD_BIT   3

◆ IGN5_CMD_BIT

#define IGN5_CMD_BIT   4

◆ IGN6_CMD_BIT

#define IGN6_CMD_BIT   5

◆ IGN7_CMD_BIT

#define IGN7_CMD_BIT   6

◆ IGN8_CMD_BIT

#define IGN8_CMD_BIT   7

◆ IGN_MODE_ROTARY

#define IGN_MODE_ROTARY   4U

◆ IGN_MODE_SEQUENTIAL

#define IGN_MODE_SEQUENTIAL   3U

◆ IGN_MODE_SINGLE

#define IGN_MODE_SINGLE   1U

◆ IGN_MODE_WASTED

#define IGN_MODE_WASTED   0U

◆ IGN_MODE_WASTEDCOP

#define IGN_MODE_WASTEDCOP   2U

◆ INJ1_CMD_BIT

#define INJ1_CMD_BIT   0

◆ INJ2_CMD_BIT

#define INJ2_CMD_BIT   1

◆ INJ3_CMD_BIT

#define INJ3_CMD_BIT   2

◆ INJ4_CMD_BIT

#define INJ4_CMD_BIT   3

◆ INJ5_CMD_BIT

#define INJ5_CMD_BIT   4

◆ INJ6_CMD_BIT

#define INJ6_CMD_BIT   5

◆ INJ7_CMD_BIT

#define INJ7_CMD_BIT   6

◆ INJ8_CMD_BIT

#define INJ8_CMD_BIT   7

◆ INJ_BANKED

#define INJ_BANKED   2

◆ INJ_PAIR_13_24

#define INJ_PAIR_13_24   0

◆ INJ_PAIR_14_23

#define INJ_PAIR_14_23   1

◆ INJ_PAIRED

#define INJ_PAIRED   0

◆ INJ_SEMISEQUENTIAL

#define INJ_SEMISEQUENTIAL   1

◆ INJ_SEQUENTIAL

#define INJ_SEQUENTIAL   3

◆ INJ_TYPE_PORT

#define INJ_TYPE_PORT   0

◆ INJ_TYPE_TBODY

#define INJ_TYPE_TBODY   1

◆ interruptSafe

#define interruptSafe (   c)    (noInterrupts(); {c} interrupts();)

◆ KNOCK_MODE_ANALOG

#define KNOCK_MODE_ANALOG   2U

◆ KNOCK_MODE_DIGITAL

#define KNOCK_MODE_DIGITAL   1U

◆ KNOCK_MODE_OFF

#define KNOCK_MODE_OFF   0U

◆ KNOCK_TRIGGER_HIGH

#define KNOCK_TRIGGER_HIGH   0

◆ KNOCK_TRIGGER_LOW

#define KNOCK_TRIGGER_LOW   1

◆ LOAD_SOURCE_IMAPEMAP

#define LOAD_SOURCE_IMAPEMAP   2

◆ LOAD_SOURCE_MAP

#define LOAD_SOURCE_MAP   0

◆ LOAD_SOURCE_TPS

#define LOAD_SOURCE_TPS   1

◆ LOGGER_BINARY

#define LOGGER_BINARY   2

◆ LOGGER_CSV

#define LOGGER_CSV   1

◆ LOGGER_CSV_SEPARATOR_COMMA

#define LOGGER_CSV_SEPARATOR_COMMA   1

◆ LOGGER_CSV_SEPARATOR_SEMICOLON

#define LOGGER_CSV_SEPARATOR_SEMICOLON   0

◆ LOGGER_CSV_SEPARATOR_SPACE

#define LOGGER_CSV_SEPARATOR_SPACE   3

◆ LOGGER_CSV_SEPARATOR_TAB

#define LOGGER_CSV_SEPARATOR_TAB   2

◆ LOGGER_DISABLED

#define LOGGER_DISABLED   0

◆ LOGGER_FILENAMING_DATETIME

#define LOGGER_FILENAMING_DATETIME   1

◆ LOGGER_FILENAMING_OVERWRITE

#define LOGGER_FILENAMING_OVERWRITE   0

◆ LOGGER_FILENAMING_SEQENTIAL

#define LOGGER_FILENAMING_SEQENTIAL   2

◆ LOGGER_RATE_10HZ

#define LOGGER_RATE_10HZ   2

◆ LOGGER_RATE_1HZ

#define LOGGER_RATE_1HZ   0

◆ LOGGER_RATE_30HZ

#define LOGGER_RATE_30HZ   3

◆ LOGGER_RATE_4HZ

#define LOGGER_RATE_4HZ   1

◆ MICROS_PER_HOUR

#define MICROS_PER_HOUR   INT32_C(MICROS_PER_MIN*60U)

◆ MICROS_PER_MIN

#define MICROS_PER_MIN   INT32_C(MICROS_PER_SEC*60U)

◆ MICROS_PER_SEC

#define MICROS_PER_SEC   INT32_C(1000000)

◆ MULTIPLY_MAP_MODE_100

#define MULTIPLY_MAP_MODE_100   2

◆ MULTIPLY_MAP_MODE_BARO

#define MULTIPLY_MAP_MODE_BARO   1

◆ MULTIPLY_MAP_MODE_OFF

#define MULTIPLY_MAP_MODE_OFF   0

◆ NITROUS_BOTH

#define NITROUS_BOTH   3

◆ NITROUS_OFF

#define NITROUS_OFF   0

◆ NITROUS_STAGE1

#define NITROUS_STAGE1   1

◆ NITROUS_STAGE2

#define NITROUS_STAGE2   2

◆ O2_CALIBRATION_PAGE

#define O2_CALIBRATION_PAGE   2U

◆ ODD_FIRE

#define ODD_FIRE   1

◆ OFFSET_FUELTRIM

#define OFFSET_FUELTRIM   127U

The fuel trim tables are offset by 128 to allow for -128 to +128 values.

◆ OFFSET_IGNITION

#define OFFSET_IGNITION   40

Ignition values from the main spark table are offset 40 degrees downwards to allow for negative spark timing.

◆ OPEN_LOOP_BOOST

#define OPEN_LOOP_BOOST   0

◆ OUTPUT_CONTROL_DIRECT

#define OUTPUT_CONTROL_DIRECT   0

◆ OUTPUT_CONTROL_MC33810

#define OUTPUT_CONTROL_MC33810   10

◆ pinIsIgnition

#define pinIsIgnition (   pin)    ( ((pin) == pinCoil1) || ((pin) == pinCoil2) || ((pin) == pinCoil3) || ((pin) == pinCoil4) || ((pin) == pinCoil5) || ((pin) == pinCoil6) || ((pin) == pinCoil7) || ((pin) == pinCoil8) )

◆ pinIsInjector

#define pinIsInjector (   pin)    ( ((pin) == pinInjector1) || ((pin) == pinInjector2) || ((pin) == pinInjector3) || ((pin) == pinInjector4) || ((pin) == pinInjector5) || ((pin) == pinInjector6) || ((pin) == pinInjector7) || ((pin) == pinInjector8) )

◆ pinIsSensor

#define pinIsSensor (   pin)    ( ((pin) == pinCLT) || ((pin) == pinIAT) || ((pin) == pinMAP) || ((pin) == pinTPS) || ((pin) == pinO2) || ((pin) == pinBat) || (((pin) == pinFlex) && (configPage2.flexEnabled != 0)) )

◆ PROTECT_CUT_BOTH

#define PROTECT_CUT_BOTH   3

◆ PROTECT_CUT_FUEL

#define PROTECT_CUT_FUEL   2

◆ PROTECT_CUT_IGN

#define PROTECT_CUT_IGN   1

◆ PROTECT_CUT_OFF

#define PROTECT_CUT_OFF   0

◆ PROTECT_IO_ERROR

#define PROTECT_IO_ERROR   7

◆ RESET_CONTROL_DISABLED

#define RESET_CONTROL_DISABLED   0U

◆ RESET_CONTROL_PREVENT_ALWAYS

#define RESET_CONTROL_PREVENT_ALWAYS   2U

◆ RESET_CONTROL_PREVENT_WHEN_RUNNING

#define RESET_CONTROL_PREVENT_WHEN_RUNNING   1U

◆ RESET_CONTROL_SERIAL_COMMAND

#define RESET_CONTROL_SERIAL_COMMAND   3U

◆ ROTARY_IGN_FC

#define ROTARY_IGN_FC   0

◆ ROTARY_IGN_FD

#define ROTARY_IGN_FD   1

◆ ROTARY_IGN_RX8

#define ROTARY_IGN_RX8   2

◆ SEC_TRIGGER_4_1

#define SEC_TRIGGER_4_1   1

◆ SEC_TRIGGER_5_3_2

#define SEC_TRIGGER_5_3_2   3

◆ SEC_TRIGGER_POLL

#define SEC_TRIGGER_POLL   2

◆ SEC_TRIGGER_SINGLE

#define SEC_TRIGGER_SINGLE   0

◆ SEC_TRIGGER_TOYOTA_3

#define SEC_TRIGGER_TOYOTA_3   4

◆ SERIAL_BUFFER_THRESHOLD

#define SERIAL_BUFFER_THRESHOLD   32

When the serial buffer is filled to greater than this threshold value, the serial processing operations will be performed more urgently in order to avoid it overflowing. Serial buffer is 64 bytes long, so the threshold is set at half this as a reasonable figure.

◆ SERIAL_PORT_PRIMARY

#define SERIAL_PORT_PRIMARY   0

◆ SERIAL_PORT_SECONDARY

#define SERIAL_PORT_SECONDARY   3

◆ SOFT_LIMIT_FIXED

#define SOFT_LIMIT_FIXED   0

◆ SOFT_LIMIT_RELATIVE

#define SOFT_LIMIT_RELATIVE   1

◆ SPARK2_CONDITION_ETH

#define SPARK2_CONDITION_ETH   3

◆ SPARK2_CONDITION_MAP

#define SPARK2_CONDITION_MAP   1

◆ SPARK2_CONDITION_RPM

#define SPARK2_CONDITION_RPM   0

◆ SPARK2_CONDITION_TPS

#define SPARK2_CONDITION_TPS   2

◆ SPARK2_MODE_ADD

#define SPARK2_MODE_ADD   2

◆ SPARK2_MODE_CONDITIONAL_SWITCH

#define SPARK2_MODE_CONDITIONAL_SWITCH   3

◆ SPARK2_MODE_INPUT_SWITCH

#define SPARK2_MODE_INPUT_SWITCH   4

◆ SPARK2_MODE_MULTIPLY

#define SPARK2_MODE_MULTIPLY   1

◆ SPARK2_MODE_OFF

#define SPARK2_MODE_OFF   0

◆ STAGING_MODE_AUTO

#define STAGING_MODE_AUTO   1

◆ STAGING_MODE_TABLE

#define STAGING_MODE_TABLE   0

◆ TOOTH_LOG_SIZE

#define TOOTH_LOG_SIZE   127U

◆ TWO_STROKE

#define TWO_STROKE   1U

◆ VVT_LOAD_MAP

#define VVT_LOAD_MAP   0

◆ VVT_LOAD_TPS

#define VVT_LOAD_TPS   1

◆ VVT_MODE_CLOSED_LOOP

#define VVT_MODE_CLOSED_LOOP   2

◆ VVT_MODE_ONOFF

#define VVT_MODE_ONOFF   0

◆ VVT_MODE_OPEN_LOOP

#define VVT_MODE_OPEN_LOOP   1

◆ WMI_MODE_CLOSEDLOOP

#define WMI_MODE_CLOSEDLOOP   3

◆ WMI_MODE_OPENLOOP

#define WMI_MODE_OPENLOOP   2

◆ WMI_MODE_PROPORTIONAL

#define WMI_MODE_PROPORTIONAL   1

◆ WMI_MODE_SIMPLE

#define WMI_MODE_SIMPLE   0

Typedef Documentation

◆ trimTable3d

Enumeration Type Documentation

◆ MAPSamplingMethod

Enumerator
MAPSamplingInstantaneous 
MAPSamplingCycleAverage 
MAPSamplingCycleMinimum 
MAPSamplingIgnitionEventAverage 

Function Documentation

◆ HasAnySync()

static bool HasAnySync ( const statuses status)
inlinestatic
Here is the call graph for this function:
Here is the caller graph for this function:

◆ HasAnySyncUnsafe()

static bool HasAnySyncUnsafe ( const statuses status)
inlinestatic

Non-atomic version of HasAnySync. **Should only be called in an ATOMIC() block***.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ pinIsOutput()

bool pinIsOutput ( byte  pin)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ pinIsUsed()

bool pinIsUsed ( byte  pin)
Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ afrTable

struct table3d16RpmLoad afrTable
extern

16x16 afr target map

◆ ASECountTable

struct table2D ASECountTable
extern

4 bin After Start duration map (2D)

◆ ASETable

struct table2D ASETable
extern

4 bin After Start Enrichment map (2D)

◆ baroFuelTable

struct table2D baroFuelTable
extern

8 bin baro correction curve (2D)

◆ boostTable

struct table3d8RpmLoad boostTable
extern

8x8 boost map

◆ boostTableLookupDuty

struct table3d8RpmLoad boostTableLookupDuty
extern

8x8 boost map lookup table

◆ CLTAdvanceTable

struct table2D CLTAdvanceTable
extern

6 bin ignition adjustment based on coolant temperature (2D)

◆ cltCalibration_bins

uint16_t cltCalibration_bins[32]
extern

◆ cltCalibration_values

uint16_t cltCalibration_values[32]
extern

◆ cltCalibrationTable

struct table2D cltCalibrationTable
extern

A 32 bin array containing the coolant temperature sensor calibration values

◆ compositeLogHistory

volatile uint8_t compositeLogHistory[TOOTH_LOG_SIZE]
extern

◆ configPage10

struct config10 configPage10
extern

◆ configPage13

struct config13 configPage13
extern

◆ configPage15

struct config15 configPage15
extern

◆ configPage2

struct config2 configPage2
extern

◆ configPage4

struct config4 configPage4
extern

◆ configPage6

struct config6 configPage6
extern

◆ configPage9

struct config9 configPage9
extern

◆ coolantProtectTable

struct table2D coolantProtectTable
extern

◆ CRANK_ANGLE_MAX_IGN

int CRANK_ANGLE_MAX_IGN
extern

◆ CRANK_ANGLE_MAX_INJ

int CRANK_ANGLE_MAX_INJ
extern

The number of crank degrees that the system track over. 360 for wasted / timed batch and 720 for sequential.

The number of crank degrees that the system track over. 360 for wasted / timed batch and 720 for sequential.

◆ crankingEnrichTable

struct table2D crankingEnrichTable
extern

4 bin cranking Enrichment map (2D)

◆ currentLoopTime

unsigned long currentLoopTime
extern

The time (in uS) that the current mainloop started

◆ currentStatus

struct statuses currentStatus
extern

The master global "live" status struct. Contains all values that are updated frequently and used across modules

◆ data_structure_version

const byte data_structure_version
extern

◆ dwellTable

struct table3d4RpmLoad dwellTable
extern

4x4 Dwell map

◆ dwellVCorrectionTable

struct table2D dwellVCorrectionTable
extern

6 bin dwell voltage correction (2D)

◆ fanPWMTable

struct table2D fanPWMTable
extern

◆ fixedCrankingOverride

uint16_t fixedCrankingOverride
extern

◆ flex_pin_mask

volatile PINMASK_TYPE flex_pin_mask
extern

◆ flex_pin_port

volatile PORT_TYPE* flex_pin_port
extern

◆ flexAdvTable

struct table2D flexAdvTable
extern

6 bin flex fuel correction table for timing advance (2D)

◆ flexBoostTable

struct table2D flexBoostTable
extern

6 bin flex fuel correction table for boost adjustments (2D)

◆ flexFuelTable

struct table2D flexFuelTable
extern

6 bin flex fuel correction table for fuel adjustments (2D)

◆ fpPrimeTime

byte fpPrimeTime
extern

The time (in seconds, based on statuses::secl) that the fuel pump started priming.

◆ fuelTable

struct table3d16RpmLoad fuelTable
extern

16x16 fuel map

◆ fuelTable2

struct table3d16RpmLoad fuelTable2
extern

16x16 fuel map

◆ fuelTempTable

struct table2D fuelTempTable
extern

6 bin flex fuel correction table for fuel adjustments (2D)

◆ HWTest_IGN

volatile byte HWTest_IGN
extern

Each bit in this variable represents one of the ignition channels and it's HW test status

◆ HWTest_IGN_Pulsed

volatile byte HWTest_IGN_Pulsed
extern

Each bit in this variable represents one of the ignition channels and it's 50% HW test status

◆ HWTest_INJ

volatile byte HWTest_INJ
extern

Each bit in this variable represents one of the injector channels and it's HW test status

◆ HWTest_INJ_Pulsed

volatile byte HWTest_INJ_Pulsed
extern

Each bit in this variable represents one of the injector channels and it's 50% HW test status

Each bit in this variable represents one of the injector channels and it's pulsed HW test status

◆ iatCalibration_bins

uint16_t iatCalibration_bins[32]
extern

◆ iatCalibration_values

uint16_t iatCalibration_values[32]
extern

◆ iatCalibrationTable

struct table2D iatCalibrationTable
extern

A 32 bin array containing the inlet air temperature sensor calibration values

◆ IATDensityCorrectionTable

struct table2D IATDensityCorrectionTable
extern

9 bin inlet air temperature density correction (2D)

◆ IATRetardTable

struct table2D IATRetardTable
extern

6 bin ignition adjustment based on inlet air temperature (2D)

◆ idleAdvanceTable

struct table2D idleAdvanceTable
extern

6 bin idle advance adjustment table based on RPM difference (2D)

◆ idleTargetTable

struct table2D idleTargetTable
extern

10 bin idle target table for idle timing (2D)

◆ ign1_pin_mask

volatile PINMASK_TYPE ign1_pin_mask
extern

◆ ign1_pin_port

volatile PORT_TYPE* ign1_pin_port
extern

◆ ign2_pin_mask

volatile PINMASK_TYPE ign2_pin_mask
extern

◆ ign2_pin_port

volatile PORT_TYPE* ign2_pin_port
extern

◆ ign3_pin_mask

volatile PINMASK_TYPE ign3_pin_mask
extern

◆ ign3_pin_port

volatile PORT_TYPE* ign3_pin_port
extern

◆ ign4_pin_mask

volatile PINMASK_TYPE ign4_pin_mask
extern

◆ ign4_pin_port

volatile PORT_TYPE* ign4_pin_port
extern

◆ ign5_pin_mask

volatile PINMASK_TYPE ign5_pin_mask
extern

◆ ign5_pin_port

volatile PORT_TYPE* ign5_pin_port
extern

◆ ign6_pin_mask

volatile PINMASK_TYPE ign6_pin_mask
extern

◆ ign6_pin_port

volatile PORT_TYPE* ign6_pin_port
extern

◆ ign7_pin_mask

volatile PINMASK_TYPE ign7_pin_mask
extern

◆ ign7_pin_port

volatile PORT_TYPE* ign7_pin_port
extern

◆ ign8_pin_mask

volatile PINMASK_TYPE ign8_pin_mask
extern

◆ ign8_pin_port

volatile PORT_TYPE* ign8_pin_port
extern

◆ ignitionCount

volatile uint16_t ignitionCount
extern

The count of ignition events that have taken place since the engine started

◆ ignitionOutputControl

byte ignitionOutputControl
extern

Specifies whether the coils are controlled directly (Via an IO pin) or using something like the MC33810. 0 = Direct (OUTPUT_CONTROL_DIRECT), 10 = MC33810 (OUTPUT_CONTROL_MC33810)

◆ ignitionTable

struct table3d16RpmLoad ignitionTable
extern

16x16 ignition map

◆ ignitionTable2

struct table3d16RpmLoad ignitionTable2
extern

16x16 ignition map

◆ inj1_pin_mask

volatile PINMASK_TYPE inj1_pin_mask
extern

◆ inj1_pin_port

volatile PORT_TYPE* inj1_pin_port
extern

volatile inj*_pin_port and inj*_pin_mask vars are for the direct port manipulation of the injectors, coils and aux outputs.

◆ inj2_pin_mask

volatile PINMASK_TYPE inj2_pin_mask
extern

◆ inj2_pin_port

volatile PORT_TYPE* inj2_pin_port
extern

◆ inj3_pin_mask

volatile PINMASK_TYPE inj3_pin_mask
extern

◆ inj3_pin_port

volatile PORT_TYPE* inj3_pin_port
extern

◆ inj4_pin_mask

volatile PINMASK_TYPE inj4_pin_mask
extern

◆ inj4_pin_port

volatile PORT_TYPE* inj4_pin_port
extern

◆ inj5_pin_mask

volatile PINMASK_TYPE inj5_pin_mask
extern

◆ inj5_pin_port

volatile PORT_TYPE* inj5_pin_port
extern

◆ inj6_pin_mask

volatile PINMASK_TYPE inj6_pin_mask
extern

◆ inj6_pin_port

volatile PORT_TYPE* inj6_pin_port
extern

◆ inj7_pin_mask

volatile PINMASK_TYPE inj7_pin_mask
extern

◆ inj7_pin_port

volatile PORT_TYPE* inj7_pin_port
extern

◆ inj8_pin_mask

volatile PINMASK_TYPE inj8_pin_mask
extern

◆ inj8_pin_port

volatile PORT_TYPE* inj8_pin_port
extern

◆ injectorAngleTable

struct table2D injectorAngleTable
extern

4 bin injector angle curve (2D)

◆ injectorOutputControl

byte injectorOutputControl
extern

Specifies whether the injectors are controlled directly (Via an IO pin) or using something like the MC33810. 0 = Direct (OUTPUT_CONTROL_DIRECT), 10 = MC33810 (OUTPUT_CONTROL_MC33810)

◆ injectorVCorrectionTable

struct table2D injectorVCorrectionTable
extern

6 bin injector voltage correction (2D)

◆ knockWindowDurationTable

struct table2D knockWindowDurationTable
extern

◆ knockWindowStartTable

struct table2D knockWindowStartTable
extern

◆ LOOP_TIMER

volatile byte LOOP_TIMER
extern

◆ maeTable

struct table2D maeTable
extern

◆ mainLoopCount

volatile uint16_t mainLoopCount
extern

◆ maxIgnOutputs

byte maxIgnOutputs
extern

Number of ignition outputs being used by the current tune configuration

◆ maxInjOutputs

byte maxInjOutputs
extern

Number of injection outputs being used by the current tune configuration

◆ ms_counter

volatile unsigned long ms_counter
extern

◆ o2Calibration_bins

uint16_t o2Calibration_bins[32]
extern

◆ o2Calibration_values

uint8_t o2Calibration_values[32]
extern

◆ o2CalibrationTable

struct table2D o2CalibrationTable
extern

A 32 bin array containing the O2 sensor calibration values

◆ oilPressureProtectTable

struct table2D oilPressureProtectTable
extern

◆ pinAirConComp

byte pinAirConComp
extern

◆ pinAirConFan

byte pinAirConFan
extern

◆ pinAirConRequest

byte pinAirConRequest
extern

◆ pinBaro

byte pinBaro
extern

◆ pinBat

byte pinBat
extern

◆ pinBoost

byte pinBoost
extern

◆ pinCLT

byte pinCLT
extern

◆ pinCoil1

byte pinCoil1
extern

Pin for coil 1.

◆ pinCoil2

byte pinCoil2
extern

Pin for coil 2.

◆ pinCoil3

byte pinCoil3
extern

Pin for coil 3.

◆ pinCoil4

byte pinCoil4
extern

Pin for coil 4.

◆ pinCoil5

byte pinCoil5
extern

Pin for coil 5.

◆ pinCoil6

byte pinCoil6
extern

Pin for coil 6.

◆ pinCoil7

byte pinCoil7
extern

Pin for coil 7.

◆ pinCoil8

byte pinCoil8
extern

Pin for coil 8.

◆ pinCTPS

byte pinCTPS
extern

◆ pinDisplayReset

byte pinDisplayReset
extern

◆ pinEMAP

byte pinEMAP
extern

◆ pinFan

byte pinFan
extern

Cooling fan output (on/off? See: auxiliaries.ino)

◆ pinFlex

byte pinFlex
extern

◆ pinFuel2Input

byte pinFuel2Input
extern

◆ pinFuelPressure

byte pinFuelPressure
extern

◆ pinFuelPump

byte pinFuelPump
extern

◆ pinIAT

byte pinIAT
extern

◆ pinIdle1

byte pinIdle1
extern

◆ pinIdle2

byte pinIdle2
extern

◆ pinIdleUp

byte pinIdleUp
extern

◆ pinIdleUpOutput

byte pinIdleUpOutput
extern

◆ pinIgnBypass

byte pinIgnBypass
extern

◆ pinInjector1

byte pinInjector1
extern

Various pin numbering (Injectors, Ign outputs, CAS, Cam, Sensors. etc.) assignments.

Output pin injector 1

◆ pinInjector2

byte pinInjector2
extern

Output pin injector 2.

◆ pinInjector3

byte pinInjector3
extern

Output pin injector 3.

◆ pinInjector4

byte pinInjector4
extern

Output pin injector 4.

◆ pinInjector5

byte pinInjector5
extern

Output pin injector 5.

◆ pinInjector6

byte pinInjector6
extern

Output pin injector 6.

◆ pinInjector7

byte pinInjector7
extern

Output pin injector 7.

◆ pinInjector8

byte pinInjector8
extern

Output pin injector 8.

◆ pinLaunch

byte pinLaunch
extern

◆ pinMAP

byte pinMAP
extern

◆ pinMAP2

byte pinMAP2
extern

◆ pinMC33810_1_CS

byte pinMC33810_1_CS
extern

◆ pinMC33810_2_CS

byte pinMC33810_2_CS
extern

◆ pinO2

byte pinO2
extern

◆ pinO2_2

byte pinO2_2
extern

◆ pinOilPressure

byte pinOilPressure
extern

◆ pinResetControl

byte pinResetControl
extern

◆ pinSDEnable

byte pinSDEnable
extern

◆ pinSpareHOut1

byte pinSpareHOut1
extern

◆ pinSpareHOut2

byte pinSpareHOut2
extern

◆ pinSpareLOut1

byte pinSpareLOut1
extern

◆ pinSpareLOut2

byte pinSpareLOut2
extern

◆ pinSpareLOut3

byte pinSpareLOut3
extern

◆ pinSpareLOut4

byte pinSpareLOut4
extern

◆ pinSpareLOut5

byte pinSpareLOut5
extern

◆ pinSpareOut1

byte pinSpareOut1
extern

◆ pinSpareOut2

byte pinSpareOut2
extern

◆ pinSpareOut3

byte pinSpareOut3
extern

◆ pinSpareOut4

byte pinSpareOut4
extern

◆ pinSpareOut5

byte pinSpareOut5
extern

◆ pinSpareOut6

byte pinSpareOut6
extern

◆ pinSpareTemp1

byte pinSpareTemp1
extern

◆ pinSpareTemp2

byte pinSpareTemp2
extern

◆ pinSpark2Input

byte pinSpark2Input
extern

◆ pinStepperDir

byte pinStepperDir
extern

◆ pinStepperEnable

byte pinStepperEnable
extern

◆ pinStepperStep

byte pinStepperStep
extern

◆ pinTachOut

byte pinTachOut
extern

◆ pinTPS

byte pinTPS
extern

◆ pinTrigger

byte pinTrigger
extern

RPM1 (Typically CAS=crankshaft angle sensor) pin.

◆ pinTrigger2

byte pinTrigger2
extern

RPM2 (Typically the Cam Sensor) pin.

◆ pinTrigger3

byte pinTrigger3
extern

the 2nd cam sensor pin

◆ pinVSS

byte pinVSS
extern

◆ pinVVT_1

byte pinVVT_1
extern

vvt (variable valve timing) output 1

◆ pinVVT_2

byte pinVVT_2
extern

vvt (variable valve timing) output 2

◆ pinWMIEmpty

byte pinWMIEmpty
extern

◆ pinWMIEnabled

byte pinWMIEnabled
extern

◆ pinWMIIndicator

byte pinWMIIndicator
extern

◆ primaryTriggerEdge

byte primaryTriggerEdge
extern

◆ PrimingPulseTable

struct table2D PrimingPulseTable
extern

4 bin Priming pulsewidth map (2D)

◆ pump_pin_mask

volatile PINMASK_TYPE pump_pin_mask
extern

◆ pump_pin_port

volatile PORT_TYPE* pump_pin_port
extern

◆ resetControl

byte resetControl
extern

resetControl needs to be here (as global) because using the config page (4) directly can prevent burning the setting

◆ revolutionTime

uint32_t revolutionTime
extern

◆ rollingCutTable

struct table2D rollingCutTable
extern

◆ rotarySplitTable

struct table2D rotarySplitTable
extern

8 bin ignition split curve for rotary leading/trailing (2D)

◆ runSecsX10

volatile uint32_t runSecsX10
extern

Counter of seconds since cranking commenced (similar to runSecs) but in increments of 0.1 seconds

◆ seclx10

volatile uint32_t seclx10
extern

Counter of seconds since powered commenced (similar to secl) but in increments of 0.1 seconds

◆ secondaryTriggerEdge

byte secondaryTriggerEdge
extern

◆ softLimitTime

uint8_t softLimitTime
extern

◆ stagingTable

struct table3d8RpmLoad stagingTable
extern

8x8 fuel staging table

◆ tach_pin_mask

volatile PINMASK_TYPE tach_pin_mask
extern

◆ tach_pin_port

volatile PORT_TYPE* tach_pin_port
extern

◆ taeTable

struct table2D taeTable
extern

4 bin TPS Acceleration Enrichment map (2D)

◆ tertiaryTriggerEdge

byte tertiaryTriggerEdge
extern

◆ timer5_overflow_count

volatile unsigned long timer5_overflow_count
extern

◆ TIMER_mask

volatile byte TIMER_mask
extern

◆ toothHistory

volatile uint32_t toothHistory[TOOTH_LOG_SIZE]
extern

Tooth trigger history - delta time (in uS) from last tooth (Indexed by toothHistoryIndex)

◆ toothHistoryIndex

volatile unsigned int toothHistoryIndex
extern

Current index to toothHistory array.

◆ triggerInterrupt

byte triggerInterrupt
extern

◆ triggerInterrupt2

byte triggerInterrupt2
extern

◆ triggerInterrupt3

byte triggerInterrupt3
extern

◆ triggerPri_pin_mask

volatile PINMASK_TYPE triggerPri_pin_mask
extern

◆ triggerPri_pin_port

volatile PORT_TYPE* triggerPri_pin_port
extern

◆ triggerSec_pin_mask

volatile PINMASK_TYPE triggerSec_pin_mask
extern

◆ triggerSec_pin_port

volatile PORT_TYPE* triggerSec_pin_port
extern

◆ triggerThird_pin_mask

volatile PINMASK_TYPE triggerThird_pin_mask
extern

◆ triggerThird_pin_port

volatile PORT_TYPE* triggerThird_pin_port
extern

◆ trim1Table

trimTable3d trim1Table
extern

6x6 Fuel trim 1 map

◆ trim2Table

trimTable3d trim2Table
extern

6x6 Fuel trim 2 map

◆ trim3Table

trimTable3d trim3Table
extern

6x6 Fuel trim 3 map

◆ trim4Table

trimTable3d trim4Table
extern

6x6 Fuel trim 4 map

◆ trim5Table

trimTable3d trim5Table
extern

6x6 Fuel trim 5 map

◆ trim6Table

trimTable3d trim6Table
extern

6x6 Fuel trim 6 map

◆ trim7Table

trimTable3d trim7Table
extern

6x6 Fuel trim 7 map

◆ trim8Table

trimTable3d trim8Table
extern

6x6 Fuel trim 8 map

◆ TSfirmwareVersion

const char TSfirmwareVersion[]
extern

◆ vvt2Table

struct table3d8RpmLoad vvt2Table
extern

8x8 vvt2 map

◆ vvtTable

struct table3d8RpmLoad vvtTable
extern

8x8 vvt map

◆ wmiAdvTable

struct table2D wmiAdvTable
extern

◆ wmiTable

struct table3d8RpmLoad wmiTable
extern

8x8 wmi map

◆ WUETable

struct table2D WUETable
extern

10 bin Warm Up Enrichment map (2D)