Speeduino
|
#include <Arduino.h>
#include <SimplyAtomic.h>
#include "table2d.h"
#include "table3d.h"
#include "statuses.h"
#include "config_pages.h"
#include <BOARD_H>
Go to the source code of this file.
Typedefs | |
using | trimTable3d = table3d6RpmLoad |
Functions | |
bool | pinIsOutput (byte pin) |
bool | pinIsUsed (byte pin) |
Global defines, macros, struct definitions (statuses, config2, config4, config*), extern-definitions (for globally accessible vars).
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.
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).
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):
#define BIT_TIMER_10HZ 2 |
#define BIT_TIMER_15HZ 3 |
#define BIT_TIMER_1HZ 0 |
#define BIT_TIMER_1KHZ 7 |
#define BIT_TIMER_200HZ 6 |
#define BIT_TIMER_30HZ 4 |
#define BIT_TIMER_4HZ 1 |
#define BIT_TIMER_50HZ 5 |
#define CALIBRATION_TABLE_SIZE 512 |
Calibration table size for CLT, IAT, O2.
#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
#define CLT_CALIBRATION_PAGE 0U |
#define COMPOSITE_ENGINE_CYCLE 5 |
#define COMPOSITE_LOG_PRI 0 |
#define COMPOSITE_LOG_SEC 1 |
#define COMPOSITE_LOG_SYNC 4 |
#define COMPOSITE_LOG_THIRD 2 |
#define COMPOSITE_LOG_TRIG 3 |
#define CRANK_ANGLE_MAX (max(CRANK_ANGLE_MAX_IGN, CRANK_ANGLE_MAX_INJ)) |
#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 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 interruptSafe | ( | c | ) | (noInterrupts(); {c} interrupts();) |
#define LOGGER_BINARY 2 |
#define LOGGER_CSV 1 |
#define LOGGER_CSV_SEPARATOR_COMMA 1 |
#define LOGGER_CSV_SEPARATOR_SEMICOLON 0 |
#define LOGGER_CSV_SEPARATOR_SPACE 3 |
#define LOGGER_CSV_SEPARATOR_TAB 2 |
#define LOGGER_DISABLED 0 |
#define LOGGER_FILENAMING_DATETIME 1 |
#define LOGGER_FILENAMING_OVERWRITE 0 |
#define LOGGER_FILENAMING_SEQENTIAL 2 |
#define LOGGER_RATE_10HZ 2 |
#define LOGGER_RATE_1HZ 0 |
#define LOGGER_RATE_30HZ 3 |
#define LOGGER_RATE_4HZ 1 |
#define MICROS_PER_HOUR INT32_C(MICROS_PER_MIN*60U) |
#define MICROS_PER_MIN INT32_C(MICROS_PER_SEC*60U) |
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 OUTPUT_CONTROL_DIRECT 0 |
#define OUTPUT_CONTROL_MC33810 10 |
#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 SERIAL_PORT_PRIMARY 0 |
#define SERIAL_PORT_SECONDARY 3 |
|
extern |
16x16 afr target map
|
extern |
8x8 boost map
|
extern |
8x8 boost map lookup table
|
extern |
|
extern |
A 32 bin array containing the coolant temperature sensor calibration values
|
extern |
|
extern |
|
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.
The master global "live" status struct. Contains all values that are updated frequently and used across modules
|
extern |
4x4 Dwell map
|
extern |
|
extern |
|
extern |
The time (in seconds, based on statuses::secl) that the fuel pump started priming.
|
extern |
16x16 fuel map
|
extern |
16x16 fuel map
Each bit in this variable represents one of the ignition channels and it's HW test status
Each bit in this variable represents one of the ignition channels and it's 50% HW test status
Each bit in this variable represents one of the injector channels and it's HW test status
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
|
extern |
|
extern |
A 32 bin array containing the inlet air temperature sensor calibration values
6 bin idle advance adjustment table based on RPM difference (2D)
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
The count of ignition events that have taken place since the engine started
|
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)
|
extern |
16x16 ignition map
|
extern |
16x16 ignition map
|
extern |
volatile inj*_pin_port and inj*_pin_mask vars are for the direct port manipulation of the injectors, coils and aux outputs.
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
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)
|
extern |
Number of ignition outputs being used by the current tune configuration
|
extern |
Number of injection outputs being used by the current tune configuration
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
Pin for coil 1.
|
extern |
Pin for coil 2.
|
extern |
Pin for coil 3.
|
extern |
Pin for coil 4.
|
extern |
Pin for coil 5.
|
extern |
Pin for coil 6.
|
extern |
Pin for coil 7.
|
extern |
Pin for coil 8.
|
extern |
|
extern |
|
extern |
|
extern |
Cooling fan output (on/off? See: auxiliaries.ino)
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
Various pin numbering (Injectors, Ign outputs, CAS, Cam, Sensors. etc.) assignments.
Output pin injector 1
|
extern |
Output pin injector 2.
|
extern |
Output pin injector 3.
|
extern |
Output pin injector 4.
|
extern |
Output pin injector 5.
|
extern |
Output pin injector 6.
|
extern |
Output pin injector 7.
|
extern |
Output pin injector 8.
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
RPM1 (Typically CAS=crankshaft angle sensor) pin.
|
extern |
RPM2 (Typically the Cam Sensor) pin.
|
extern |
the 2nd cam sensor pin
|
extern |
|
extern |
vvt (variable valve timing) output 1
|
extern |
vvt (variable valve timing) output 2
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
resetControl needs to be here (as global) because using the config page (4) directly can prevent burning the setting
|
extern |
Counter of seconds since cranking commenced (similar to runSecs) but in increments of 0.1 seconds
Counter of seconds since powered commenced (similar to secl) but in increments of 0.1 seconds
|
extern |
|
extern |
|
extern |
8x8 fuel staging table
|
extern |
|
extern |
|
extern |
Tooth trigger history - delta time (in uS) from last tooth (Indexed by toothHistoryIndex)
Current index to toothHistory array.
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
6x6 Fuel trim 1 map
|
extern |
6x6 Fuel trim 2 map
|
extern |
6x6 Fuel trim 3 map
|
extern |
6x6 Fuel trim 4 map
|
extern |
6x6 Fuel trim 5 map
|
extern |
6x6 Fuel trim 6 map
|
extern |
6x6 Fuel trim 7 map
|
extern |
6x6 Fuel trim 8 map
|
extern |
8x8 vvt2 map
|
extern |
8x8 vvt map
|
extern |
8x8 wmi map