auto-sync

This commit is contained in:
rusEfi 2015-01-23 15:05:07 -06:00
parent 15da9f7f44
commit bd9df35c73
3 changed files with 246 additions and 49 deletions

View File

@ -94,84 +94,185 @@ typedef enum {
#define HW_MAX_ADC_INDEX 16
// WARNING: by default, our small enums are ONE BYTE. this one is made 4-byte with the 'ENUM_32_BITS' hack
typedef struct {
// WARNING: by default, our small enums are ONE BYTE. this one is made 4-byte with the 'ENUM_32_BITS' hack
/**
* offset 0
*/
brain_pin_e idleValvePin;
/**
* offset 4
*/
pin_output_mode_e idleValvePinMode;
/**
* offset 8
*/
brain_pin_e fuelPumpPin;
/**
* offset 12
*/
pin_output_mode_e fuelPumpPinMode;
/**
* offset 16
*/
brain_pin_e injectionPins[INJECTION_PIN_COUNT];
/**
* offset 64
*/
pin_output_mode_e injectionPinMode;
/**
* offset 68
*/
brain_pin_e ignitionPins[IGNITION_PIN_COUNT];
/**
* offset 116
*/
pin_output_mode_e ignitionPinMode;
/**
* offset 120
*/
brain_pin_e malfunctionIndicatorPin;
/**
* offset 124
*/
pin_output_mode_e malfunctionIndicatorPinMode;
/**
* offset 128
*/
brain_pin_e fanPin;
/**
* offset 132
*/
pin_output_mode_e fanPinMode;
/**
* offset 136
*/
brain_pin_e electronicThrottlePin1;
/**
* offset 140
*/
pin_output_mode_e electronicThrottlePin1Mode;
/**
* some cars have a switch to indicate that clutch pedal is all the way down
*/
* offset 144
*/
brain_pin_e clutchDownPin;
/**
* some cars have a switch to indicate that clutch pedal is all the way down
*/
* offset 148
*/
pin_input_mode_e clutchDownPinMode;
/**
* offset 152
*/
brain_pin_e alternatorControlPin;
/**
* offset 156
*/
pin_output_mode_e alternatorControlPinMode;
/**
* offset 160
*/
brain_pin_e HD44780_rs;
/**
* offset 164
*/
brain_pin_e HD44780_e;
/**
* offset 168
*/
brain_pin_e HD44780_db4;
/**
* offset 172
*/
brain_pin_e HD44780_db5;
/**
* offset 176
*/
brain_pin_e HD44780_db6;
/**
* offset 180
*/
brain_pin_e HD44780_db7;
/**
* offset 184
*/
brain_pin_e gps_rx_pin;
/**
* offset 188
*/
brain_pin_e gps_tx_pin;
/**
* offset 192
*/
int idleSolenoidFrequency;
/**
* offset 196
*/
int triggerSimulatorFrequency;
/**
* Digital Potentiometer is used by stock ECU stimulation code
*/
* offset 200
*/
spi_device_e digitalPotentiometerSpiDevice;
/**
* offset 204
*/
brain_pin_e digitalPotentiometerChipSelect[DIGIPOT_COUNT];
/**
* offset 220
*/
adc_channel_mode_e adcHwChannelEnabled[HW_MAX_ADC_INDEX];
// offset 5760
/**
* offset 284
*/
brain_pin_e triggerInputPins[3];
// offset 5772
/**
* offset 296
*/
brain_pin_e mainRelayPin;
/**
* offset 300
*/
int idleThreadPeriod;
/**
* offset 304
*/
int consoleLoopPeriod;
/**
* offset 308
*/
int lcdThreadPeriod;
/**
* offset 312
*/
int tunerStudioThreadPeriod;
/**
* offset 316
*/
int generalPeriodicThreadPeriod;
// offset 5796
/**
* offset 320
*/
uint32_t tunerStudioSerialSpeed;
/**
* offset 324
*/
brain_pin_e boardTestModeJumperPin;
/**
* offset 328
*/
can_device_mode_e canDeviceMode;
/**
* offset 332
*/
brain_pin_e canTxPin;
/**
* offset 336
*/
brain_pin_e canRxPin;
brain_pin_e triggerSimulatorPins[TRIGGER_SIMULATOR_PIN_COUNT];
pin_output_mode_e triggerSimulatorPinModes[TRIGGER_SIMULATOR_PIN_COUNT];
@ -601,13 +702,22 @@ typedef struct {
* offset 1316
*/
float afrRpmBins[FUEL_RPM_COUNT];
// the large tables are always in the end - that's related to TunerStudio paging implementation
fuel_table_t fuelTable; // size 1024
ignition_table_t ignitionTable; // size 1024
fuel_table_t veTable; // size 1024
fuel_table_t afrTable; // size 1024
/**
* offset 1380
*/
fuel_table_t fuelTable;
/**
* offset 2404
*/
ignition_table_t ignitionTable;
/**
* offset 3428
*/
fuel_table_t veTable;
/**
* offset 4452
*/
fuel_table_t afrTable;
board_configuration_s bc;

View File

@ -20,8 +20,8 @@ float baseFuel;;"ms", 1, 0, 0, 200, 1
int16_t rpm;This value controls what RPM values we consider 'cranking' (any RPM below 'crankingRpm')\nAnything above 'crankingRpm' would be 'running';"RPM", 1, 0, 0, 3000, 0
end_struct
bits air_pressure_sensor_type_e U32 [0:1] "Custom", "DENSO183", "MPX4250", "INVALID"
bits adc_channel_e U32 [0:3] "PA0", "PA1", "PA2", "PA3", "PA4", "PA5", "PA6", "PA7", "PB0", "PB1", "PC0", "PC1", "PC2", "PC3", "PC4", "PC5"
custom air_pressure_sensor_type_e 4 bits, U32, @OFFSET@, [0:1] "Custom", "DENSO183", "MPX4250", "INVALID"
custom adc_channel_e 4 bits, U32, @OFFSET@, [0:3] "PA0", "PA1", "PA2", "PA3", "PA4", "PA5", "PA6", "PA7", "PB0", "PB1", "PC0", "PC1", "PC2", "PC3", "PC4", "PC5"
struct air_pressure_sensor_config_s
float valueAt0;kPa value at zero volts;"kpa", 1, 0, 0, 450, 2
@ -63,7 +63,7 @@ end_struct
bits engine_type_e S32 [0:2], "AUDI_AAN", "DODGE_NEON_1995", "FORD_ASPIRE_1996", "FORD_FIESTA", "NISSAN_PRIMERA", "HONDA_ACCORD", "FORD_INLINE_6_1995", "GY6_139QMB"
custom engine_type_e 4 bits, S32, @OFFSET@, [0:2], "AUDI_AAN", "DODGE_NEON_1995", "FORD_ASPIRE_1996", "FORD_FIESTA", "NISSAN_PRIMERA", "HONDA_ACCORD", "FORD_INLINE_6_1995", "GY6_139QMB"
engine_type_e engineType;http://rusefi.com/wiki/index.php?title=Manual:Engine_Type
int headerMagicValue;this magic number is used to make sure that what we read from Flash is in fact some configuration
@ -124,7 +124,7 @@ float ignitionBaseAngle;this value could be used to offset the whole ignition ti
float crankingChargeAngle;While cranking (which causes battery voltage to drop) we can calculate dwell time in shaft\ndegrees, not in absolute time as in running mode.;"deg", 1, 0, 0, 3000.0, 0
bits timing_mode_e U32 [0:0], "dynamic", "fixed"
custom timing_mode_e 4 bits, U32, @OFFSET@ [0:0], "dynamic", "fixed"
timing_mode_e timingMode;
@ -145,7 +145,7 @@ injection_mode_e crankingInjectionMode;
float globalTriggerAngleOffset;This field is the angle between Top Dead Center (TDC) and the first trigger event.\nKnowing this angle allows us to control timing and other angles in reference to TDC.;"deg", 1, 0, 0, 720, 0
float analogInputDividerCoefficient;This parameter holds the coefficient of input voltage dividers;"coef", 1, 0, 0.01, 10.0, 2
bits engine_load_mode_e U32 [0:1], "MAF", "Alpha-N", "MAP", "SPEED DENSITY"
custom engine_load_mode_e 4 bits, U32, @OFFSET@, [0:1], "MAF", "Alpha-N", "MAP", "SPEED DENSITY"
engine_load_mode_e algorithm;This setting controls which algorithm is used for ENGINE LOAD
float vbattDividerCoeff;;"coef", 1, 0, 0.01, 20.0, 2
float fanOnTemperature;Cooling fan turn-on temperature threshold, in Celsuis;"*C", 1, 0, 0, 1000.0, 2
@ -154,7 +154,7 @@ float fanOffTemperature;Cooling fan turn-off temperature threshold, in Celsuis;"
brain_pin_e vehicleSpeedSensorInputPin;
float vehicleSpeedCoef;This coefficient translates vehicle speed input frequency (in Hz) into vehicle speed, km/h
bits canNbcType U32 [0:1], "BMW", "FIAT", "VAG" , "INVALID"
custom canNbcType 4 bits, U32, @OFFSET@, [0:1], "BMW", "FIAT", "VAG" , "INVALID"
can_nbc_e canNbcType;
int canSleepPeriod;;"RPM", 1, 0, 0, 1000.0, 2
@ -188,7 +188,7 @@ end_struct
trigger_config_s trigger;
!bits spi_device_e
!custom spi_device_e
spi_device_e hip9011SpiDevice;
adc_channel_e vbattAdcChannel;
@ -220,9 +220,96 @@ float[FUEL_LOAD_COUNT] veLoadBins;
float[FUEL_RPM_COUNT] veRpmBins;
float[FUEL_LOAD_COUNT] afrLoadBins;
float[FUEL_RPM_COUNT] afrRpmBins;
custom fuel_table_t 1024 TODO
custom ignition_table_t 1024 TODO
fuel_table_t fuelTable;
ignition_table_t ignitionTable;
!bits analog_chart_e S32 [0:1], "none", "trigger", "MAP", "INVALID"
fuel_table_t veTable;
fuel_table_t afrTable;
#define INJECTION_PIN_COUNT 12
#define IGNITION_PIN_COUNT 12
#define MAX31855_CS_COUNT 8
#define JOYSTICK_PIN_COUNT 5
struct board_configuration_s
brain_pin_e idleValvePin;
pin_output_mode_e idleValvePinMode;
brain_pin_e fuelPumpPin;
pin_output_mode_e fuelPumpPinMode;
brain_pin_e[INJECTION_PIN_COUNT] injectionPins;
pin_output_mode_e injectionPinMode;
brain_pin_e[IGNITION_PIN_COUNT] ignitionPins;
pin_output_mode_e ignitionPinMode;
brain_pin_e malfunctionIndicatorPin;
pin_output_mode_e malfunctionIndicatorPinMode;
brain_pin_e fanPin;
pin_output_mode_e fanPinMode;
brain_pin_e electronicThrottlePin1;
pin_output_mode_e electronicThrottlePin1Mode;
brain_pin_e clutchDownPin;some cars have a switch to indicate that clutch pedal is all the way down
pin_input_mode_e clutchDownPinMode;
brain_pin_e alternatorControlPin;
pin_output_mode_e alternatorControlPinMode;
brain_pin_e HD44780_rs;
brain_pin_e HD44780_e;
brain_pin_e HD44780_db4;
brain_pin_e HD44780_db5;
brain_pin_e HD44780_db6;
brain_pin_e HD44780_db7;
brain_pin_e gps_rx_pin;
brain_pin_e gps_tx_pin;
int idleSolenoidFrequency;
int triggerSimulatorFrequency;
spi_device_e digitalPotentiometerSpiDevice;Digital Potentiometer is used by stock ECU stimulation code
#define DIGIPOT_COUNT 4
brain_pin_e[DIGIPOT_COUNT] digitalPotentiometerChipSelect;
#define HW_MAX_ADC_INDEX 16
adc_channel_mode_e[HW_MAX_ADC_INDEX] adcHwChannelEnabled;
brain_pin_e[3] triggerInputPins;
brain_pin_e mainRelayPin;
int idleThreadPeriod;
int consoleLoopPeriod;
int lcdThreadPeriod;
int tunerStudioThreadPeriod;
int generalPeriodicThreadPeriod;
uint32_t tunerStudioSerialSpeed;
brain_pin_e boardTestModeJumperPin;
can_device_mode_e canDeviceMode;
brain_pin_e canTxPin;
brain_pin_e canRxPin;
end_struct
!custom analog_chart_e 4 bits, S32, @OFFSET@, [0:1], "none", "trigger", "MAP", "INVALID"
!analog_chart_e analogChartMode;
end_struct

View File

@ -38,7 +38,7 @@ enable2ndByteCanID = false
; name = array, type, offset, shape, units, scale, translate, lo, hi, digits
; name = scalar, type, offset, units, scale, translate, lo, hi, digits
;AUTO_GENERATED_SECTION_START
engineType = bits, S32, 0, [0:2], "AUDI_AAN", "DODGE_NEON_1995", "FORD_ASPIRE_1996", "FORD_FIESTA", "NISSAN_PRIMERA", "HONDA_ACCORD", "FORD_INLINE_6_1995", "GY6_139QMB"
engineType = bits, S32, 0, [0:2], "AUDI_AAN", "DODGE_NEON_1995", "FORD_ASPIRE_1996", "FORD_FIESTA", "NISSAN_PRIMERA", "HONDA_ACCORD", "FORD_INLINE_6_1995", "GY6_139QMB"
;skipping headerMagicValue offset 4
battInjectorLagCorrBins = array, F32, 8, [8], "V", 1, 0, 0.0, 20.0, 2
battInjectorLagCorr = array, F32, 40, [8], "ms/V", 1, 0, 0.0, 50.0, 2
@ -63,8 +63,8 @@ enable2ndByteCanID = false
map_samplingWindow = array, F32, 452, [8], "deg", 1, 0, 0.0, 90, 2
map_sensor_valueAt0 = scalar, F32, 484, "kpa", 1, 0, 0, 450, 2
map_sensor_valueAt5 = scalar, F32, 488, "kpa", 1, 0, 0, 450, 2
map_sensor_type = bits, U32, 492, [0:1] "Custom", "DENSO183", "MPX4250", "INVALID"
map_sensor_hwChannel = bits, U32, 496, [0:3] "PA0", "PA1", "PA2", "PA3", "PA4", "PA5", "PA6", "PA7", "PB0", "PB1", "PC0", "PC1", "PC2", "PC3", "PC4", "PC5"
map_sensor_type = bits, U32, 492, [0:1] "Custom", "DENSO183", "MPX4250", "INVALID"
map_sensor_hwChannel = bits, U32, 496, [0:3] "PA0", "PA1", "PA2", "PA3", "PA4", "PA5", "PA6", "PA7", "PB0", "PB1", "PC0", "PC1", "PC2", "PC3", "PC4", "PC5"
clt_tempC_1 = scalar, F32, 500, "*C", 1, 0, -40, 200, 1
clt_tempC_2 = scalar, F32, 504, "*C", 1, 0, -40, 200, 1
clt_tempC_3 = scalar, F32, 508, "*C", 1, 0, -40, 200, 1
@ -91,7 +91,7 @@ enable2ndByteCanID = false
ignitionRpmBins = array, F32, 708, [16], "RPM", 1, 0.0, 0, 18000.0, 2
ignitionBaseAngle = scalar, F32, 772, "RPM", 1, 0, 0, 3000.0, 0
crankingChargeAngle = scalar, F32, 776, "deg", 1, 0, 0, 3000.0, 0
timingMode = bits, U32, 780, [0:0], "dynamic", "fixed"
timingMode = bits, U32, 780 [0:0], "dynamic", "fixed"
fixedModeTiming = scalar, F32, 784, "RPM", 1, 0, 0, 3000.0, 0
injectorLag = scalar, F32, 788, "msec", 1, 0, -10, 25.50, 2
fuelLoadBins = array, F32, 792, [16], "V", 1, 0, 0.0, 300.0, 2
@ -101,8 +101,8 @@ enable2ndByteCanID = false
;skipping crankingInjectionMode offset 928
;skipping injectionMode offset 932
globalTriggerAngleOffset = scalar, F32, 936, "deg", 1, 0, 0, 720, 0
analogInputDividerCoefficient = scalar, F32, 940, "coef", 1, 0, 0.01, 10.0, 2
algorithm = bits, U32, 944, [0:1], "MAF", "Alpha-N", "MAP", "SPEED DENSITY"
analogInputDividerCoefficient = scalar, F32, 940, "coef", 1, 0, 0.01, 10.0, 2
algorithm = bits, U32, 944, [0:1], "MAF", "Alpha-N", "MAP", "SPEED DENSITY"
vbattDividerCoeff = scalar, F32, 948, "coef", 1, 0, 0.01, 20.0, 2
fanOnTemperature = scalar, F32, 952, "*C", 1, 0, 0, 1000.0, 2
fanOffTemperature = scalar, F32, 956, "*C", 1, 0, 0, 1000.0, 2