getting rid of boardConfiguration / binary compatible change

This commit is contained in:
rusefi 2019-12-11 17:48:55 -05:00
parent 37473bd26e
commit af4f20551b
118 changed files with 2689 additions and 2736 deletions

View File

@ -26,8 +26,8 @@ void setBoardConfigurationOverrides(void) {
engineConfiguration->trigger.type = TT_TOOTHED_WHEEL_60_2; engineConfiguration->trigger.type = TT_TOOTHED_WHEEL_60_2;
engineConfiguration->useOnlyRisingEdgeForTrigger = true; engineConfiguration->useOnlyRisingEdgeForTrigger = true;
boardConfiguration->isFasterEngineSpinUpEnabled = true; engineConfiguration->isFasterEngineSpinUpEnabled = true;
boardConfiguration->useNoiselessTriggerDecoder = true; engineConfiguration->useNoiselessTriggerDecoder = true;
setAlgorithm(LM_SPEED_DENSITY PASS_CONFIG_PARAMETER_SUFFIX); setAlgorithm(LM_SPEED_DENSITY PASS_CONFIG_PARAMETER_SUFFIX);
@ -72,7 +72,7 @@ void setBoardConfigurationOverrides(void) {
engineConfiguration->tpsErrorDetectionTooLow = -10; // -10% open engineConfiguration->tpsErrorDetectionTooLow = -10; // -10% open
engineConfiguration->tpsErrorDetectionTooHigh = 110; // 110% open engineConfiguration->tpsErrorDetectionTooHigh = 110; // 110% open
boardConfiguration->mapMinBufferLength = 4; engineConfiguration->mapMinBufferLength = 4;
// todo: // todo:
engineConfiguration->map.sensor.hwChannel = EFI_ADC_NONE; engineConfiguration->map.sensor.hwChannel = EFI_ADC_NONE;
@ -90,9 +90,9 @@ void setBoardConfigurationOverrides(void) {
engineConfiguration->clt.adcChannel = EFI_ADC_14; engineConfiguration->clt.adcChannel = EFI_ADC_14;
boardConfiguration->triggerInputPins[0] = GPIOE_7; engineConfiguration->triggerInputPins[0] = GPIOE_7;
boardConfiguration->triggerInputPins[1] = GPIO_UNASSIGNED; engineConfiguration->triggerInputPins[1] = GPIO_UNASSIGNED;
boardConfiguration->triggerInputPins[2] = GPIO_UNASSIGNED; engineConfiguration->triggerInputPins[2] = GPIO_UNASSIGNED;
engineConfiguration->tle6240spiDevice = SPI_DEVICE_1; engineConfiguration->tle6240spiDevice = SPI_DEVICE_1;
engineConfiguration->tle6240_cs = GPIOB_0; engineConfiguration->tle6240_cs = GPIOB_0;
@ -100,14 +100,14 @@ void setBoardConfigurationOverrides(void) {
// todo: // todo:
int i; int i;
for (i = 0; i < INJECTION_PIN_COUNT; i++) for (i = 0; i < INJECTION_PIN_COUNT; i++)
boardConfiguration->injectionPins[i] = GPIO_UNASSIGNED; engineConfiguration->injectionPins[i] = GPIO_UNASSIGNED;
for (i = 0; i < IGNITION_PIN_COUNT; i++) for (i = 0; i < IGNITION_PIN_COUNT; i++)
boardConfiguration->ignitionPins[i] = GPIO_UNASSIGNED; engineConfiguration->ignitionPins[i] = GPIO_UNASSIGNED;
engineConfiguration->adcVcc = 5.0f; engineConfiguration->adcVcc = 5.0f;
engineConfiguration->analogInputDividerCoefficient = 1; engineConfiguration->analogInputDividerCoefficient = 1;
//boardConfiguration->isFastAdcEnabled = false; //engineConfiguration->isFastAdcEnabled = false;
// we call it here because setDefaultBoardConfiguration() is not called for DEFAULT_ENGINE_TYPE=MINIMAL_PINS // we call it here because setDefaultBoardConfiguration() is not called for DEFAULT_ENGINE_TYPE=MINIMAL_PINS
setSerialConfigurationOverrides(); setSerialConfigurationOverrides();
@ -117,12 +117,12 @@ void setPinConfigurationOverrides(void) {
} }
void setSerialConfigurationOverrides(void) { void setSerialConfigurationOverrides(void) {
boardConfiguration->useSerialPort = true; engineConfiguration->useSerialPort = true;
engineConfiguration->binarySerialTxPin = GPIOC_7; engineConfiguration->binarySerialTxPin = GPIOC_7;
engineConfiguration->binarySerialRxPin = GPIOC_6; engineConfiguration->binarySerialRxPin = GPIOC_6;
engineConfiguration->consoleSerialTxPin = GPIOA_10; engineConfiguration->consoleSerialTxPin = GPIOA_10;
engineConfiguration->consoleSerialRxPin = GPIOA_11; engineConfiguration->consoleSerialRxPin = GPIOA_11;
boardConfiguration->tunerStudioSerialSpeed = SERIAL_SPEED; engineConfiguration->tunerStudioSerialSpeed = SERIAL_SPEED;
engineConfiguration->uartConsoleSerialSpeed = SERIAL_SPEED; engineConfiguration->uartConsoleSerialSpeed = SERIAL_SPEED;
} }

View File

@ -246,8 +246,6 @@
#define baroSensor_offset_hex 248 #define baroSensor_offset_hex 248
#define baroSensor_type_offset 592 #define baroSensor_type_offset 592
#define baroSensor_type_offset_hex 250 #define baroSensor_type_offset_hex 250
#define bc_offset 600
#define bc_offset_hex 258
#define binarySerialRxPin_offset 1815 #define binarySerialRxPin_offset 1815
#define binarySerialRxPin_offset_hex 717 #define binarySerialRxPin_offset_hex 717
#define binarySerialTxPin_offset 1814 #define binarySerialTxPin_offset 1814

View File

@ -19,7 +19,7 @@ EXTERN_ENGINE
static void vag_18_Turbo(DECLARE_ENGINE_PARAMETER_SIGNATURE) { static void vag_18_Turbo(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
} }
void setSerialConfigurationOverrides(void) { void setSerialConfigurationOverrides(void) {
boardConfiguration->useSerialPort = true; engineConfiguration->useSerialPort = true;
//UART //UART
@ -36,11 +36,11 @@ void setPinConfigurationOverrides(void) {
engineConfiguration->baroSensor.hwChannel = EFI_ADC_NONE; engineConfiguration->baroSensor.hwChannel = EFI_ADC_NONE;
engineConfiguration->afr.hwChannel = EFI_ADC_NONE; engineConfiguration->afr.hwChannel = EFI_ADC_NONE;
boardConfiguration->ignitionPins[8] = GPIO_UNASSIGNED; engineConfiguration->ignitionPins[8] = GPIO_UNASSIGNED;
boardConfiguration->ignitionPins[9] = GPIO_UNASSIGNED; engineConfiguration->ignitionPins[9] = GPIO_UNASSIGNED;
boardConfiguration->mainRelayPin = GPIO_UNASSIGNED; engineConfiguration->mainRelayPin = GPIO_UNASSIGNED;
boardConfiguration->idle.solenoidPin = GPIO_UNASSIGNED; engineConfiguration->idle.solenoidPin = GPIO_UNASSIGNED;
boardConfiguration->fanPin = GPIO_UNASSIGNED; engineConfiguration->fanPin = GPIO_UNASSIGNED;
} }
void setBoardConfigurationOverrides(void) { void setBoardConfigurationOverrides(void) {
@ -49,33 +49,33 @@ void setBoardConfigurationOverrides(void) {
engineConfiguration->dizzySparkOutputPin = GPIO_UNASSIGNED; engineConfiguration->dizzySparkOutputPin = GPIO_UNASSIGNED;
engineConfiguration->externalKnockSenseAdc = EFI_ADC_NONE; engineConfiguration->externalKnockSenseAdc = EFI_ADC_NONE;
engineConfiguration->displayMode = DM_NONE; engineConfiguration->displayMode = DM_NONE;
boardConfiguration->HD44780_rs = GPIO_UNASSIGNED; engineConfiguration->HD44780_rs = GPIO_UNASSIGNED;
boardConfiguration->HD44780_e = GPIO_UNASSIGNED; engineConfiguration->HD44780_e = GPIO_UNASSIGNED;
boardConfiguration->HD44780_db4 = GPIO_UNASSIGNED; engineConfiguration->HD44780_db4 = GPIO_UNASSIGNED;
boardConfiguration->HD44780_db5 = GPIO_UNASSIGNED; engineConfiguration->HD44780_db5 = GPIO_UNASSIGNED;
boardConfiguration->HD44780_db6 = GPIO_UNASSIGNED; engineConfiguration->HD44780_db6 = GPIO_UNASSIGNED;
boardConfiguration->HD44780_db7 = GPIO_UNASSIGNED; engineConfiguration->HD44780_db7 = GPIO_UNASSIGNED;
for (int i = 0; i < DIGIPOT_COUNT; i++) { for (int i = 0; i < DIGIPOT_COUNT; i++) {
boardConfiguration->digitalPotentiometerChipSelect[i] = GPIO_UNASSIGNED; engineConfiguration->digitalPotentiometerChipSelect[i] = GPIO_UNASSIGNED;
} }
boardConfiguration->triggerSimulatorPins[1] = GPIO_UNASSIGNED; engineConfiguration->triggerSimulatorPins[1] = GPIO_UNASSIGNED;
boardConfiguration->triggerSimulatorPins[2] = GPIO_UNASSIGNED; engineConfiguration->triggerSimulatorPins[2] = GPIO_UNASSIGNED;
boardConfiguration->triggerSimulatorPinModes[1] = OM_DEFAULT; engineConfiguration->triggerSimulatorPinModes[1] = OM_DEFAULT;
boardConfiguration->triggerSimulatorPinModes[2] = OM_DEFAULT; engineConfiguration->triggerSimulatorPinModes[2] = OM_DEFAULT;
boardConfiguration->digitalPotentiometerSpiDevice = SPI_NONE; engineConfiguration->digitalPotentiometerSpiDevice = SPI_NONE;
boardConfiguration->max31855spiDevice = SPI_NONE; engineConfiguration->max31855spiDevice = SPI_NONE;
engineConfiguration->warningLedPin = GPIO_UNASSIGNED; engineConfiguration->warningLedPin = GPIO_UNASSIGNED;
engineConfiguration->runningLedPin = GPIO_UNASSIGNED; engineConfiguration->runningLedPin = GPIO_UNASSIGNED;
boardConfiguration->useStepperIdle = false; engineConfiguration->useStepperIdle = false;
boardConfiguration->idle.stepperDirectionPin = GPIO_UNASSIGNED; engineConfiguration->idle.stepperDirectionPin = GPIO_UNASSIGNED;
boardConfiguration->idle.stepperStepPin = GPIO_UNASSIGNED; engineConfiguration->idle.stepperStepPin = GPIO_UNASSIGNED;
engineConfiguration->stepperEnablePin = GPIO_UNASSIGNED; engineConfiguration->stepperEnablePin = GPIO_UNASSIGNED;
engineConfiguration->stepperEnablePinMode = OM_DEFAULT; engineConfiguration->stepperEnablePinMode = OM_DEFAULT;
boardConfiguration->injectionPins[8] = GPIO_UNASSIGNED; engineConfiguration->injectionPins[8] = GPIO_UNASSIGNED;
boardConfiguration->injectionPins[9] = GPIO_UNASSIGNED; engineConfiguration->injectionPins[9] = GPIO_UNASSIGNED;
boardConfiguration->injectionPins[10] = GPIO_UNASSIGNED; engineConfiguration->injectionPins[10] = GPIO_UNASSIGNED;
boardConfiguration->injectionPins[11] = GPIO_UNASSIGNED; engineConfiguration->injectionPins[11] = GPIO_UNASSIGNED;
boardConfiguration->isHip9011Enabled = false; engineConfiguration->isHip9011Enabled = false;
} }

View File

@ -19,32 +19,32 @@
EXTERN_ENGINE; EXTERN_ENGINE;
static void setInjectorPins() { static void setInjectorPins() {
boardConfiguration->injectionPins[0] = GPIOE_14; engineConfiguration->injectionPins[0] = GPIOE_14;
boardConfiguration->injectionPins[1] = GPIOE_13; engineConfiguration->injectionPins[1] = GPIOE_13;
boardConfiguration->injectionPins[2] = GPIOE_12; engineConfiguration->injectionPins[2] = GPIOE_12;
boardConfiguration->injectionPins[3] = GPIOE_11; engineConfiguration->injectionPins[3] = GPIOE_11;
// Disable remainder // Disable remainder
for (int i = 4; i < INJECTION_PIN_COUNT;i++) { for (int i = 4; i < INJECTION_PIN_COUNT;i++) {
boardConfiguration->injectionPins[i] = GPIO_UNASSIGNED; engineConfiguration->injectionPins[i] = GPIO_UNASSIGNED;
} }
boardConfiguration->injectionPinMode = OM_DEFAULT; engineConfiguration->injectionPinMode = OM_DEFAULT;
} }
static void setIgnitionPins() { static void setIgnitionPins() {
// todo: I wonder if these are not right in light of the network rename and the +12 VP issue? // todo: I wonder if these are not right in light of the network rename and the +12 VP issue?
boardConfiguration->ignitionPins[0] = GPIOD_4; engineConfiguration->ignitionPins[0] = GPIOD_4;
boardConfiguration->ignitionPins[1] = GPIOD_3; engineConfiguration->ignitionPins[1] = GPIOD_3;
boardConfiguration->ignitionPins[2] = GPIOD_2; engineConfiguration->ignitionPins[2] = GPIOD_2;
boardConfiguration->ignitionPins[3] = GPIOD_1; engineConfiguration->ignitionPins[3] = GPIOD_1;
// disable remainder // disable remainder
for (int i = 4; i < IGNITION_PIN_COUNT; i++) { for (int i = 4; i < IGNITION_PIN_COUNT; i++) {
boardConfiguration->ignitionPins[i] = GPIO_UNASSIGNED; engineConfiguration->ignitionPins[i] = GPIO_UNASSIGNED;
} }
boardConfiguration->ignitionPinMode = OM_DEFAULT; engineConfiguration->ignitionPinMode = OM_DEFAULT;
} }
static void setLedPins() { static void setLedPins() {
@ -55,7 +55,7 @@ static void setLedPins() {
engineConfiguration->communicationLedPin = GPIOE_2; // d23 = blue engineConfiguration->communicationLedPin = GPIOE_2; // d23 = blue
#endif /* EFI_COMMUNICATION_PIN */ #endif /* EFI_COMMUNICATION_PIN */
engineConfiguration->runningLedPin = GPIOE_4; // d22 = green engineConfiguration->runningLedPin = GPIOE_4; // d22 = green
boardConfiguration->triggerErrorPin = GPIOE_1; // d27 = orange engineConfiguration->triggerErrorPin = GPIOE_1; // d27 = orange
} }
static void setupVbatt() { static void setupVbatt() {
@ -71,12 +71,12 @@ static void setupVbatt() {
static void setupTle8888() { static void setupTle8888() {
// Enable spi3 // Enable spi3
boardConfiguration->is_enabled_spi_3 = true; engineConfiguration->is_enabled_spi_3 = true;
// Wire up spi3 // Wire up spi3
boardConfiguration->spi3mosiPin = GPIOB_5; engineConfiguration->spi3mosiPin = GPIOB_5;
boardConfiguration->spi3misoPin = GPIOB_4; engineConfiguration->spi3misoPin = GPIOB_4;
boardConfiguration->spi3sckPin = GPIOB_3; engineConfiguration->spi3sckPin = GPIOB_3;
// Chip select // Chip select
engineConfiguration->tle8888_cs = GPIOD_5; engineConfiguration->tle8888_cs = GPIOD_5;
@ -124,9 +124,9 @@ static void setupEtb() {
static void setupDefaultSensorInputs() { static void setupDefaultSensorInputs() {
// trigger inputs // trigger inputs
// tle8888 VR conditioner // tle8888 VR conditioner
boardConfiguration->triggerInputPins[0] = GPIOC_6; engineConfiguration->triggerInputPins[0] = GPIOC_6;
boardConfiguration->triggerInputPins[1] = GPIO_UNASSIGNED; engineConfiguration->triggerInputPins[1] = GPIO_UNASSIGNED;
boardConfiguration->triggerInputPins[2] = GPIO_UNASSIGNED; engineConfiguration->triggerInputPins[2] = GPIO_UNASSIGNED;
// Direct hall-only cam input // Direct hall-only cam input
engineConfiguration->camInputs[0] = GPIOA_5; engineConfiguration->camInputs[0] = GPIOA_5;
@ -157,7 +157,7 @@ void setPinConfigurationOverrides(void) {
} }
void setSerialConfigurationOverrides(void) { void setSerialConfigurationOverrides(void) {
boardConfiguration->useSerialPort = false; engineConfiguration->useSerialPort = false;
engineConfiguration->binarySerialTxPin = GPIO_UNASSIGNED; engineConfiguration->binarySerialTxPin = GPIO_UNASSIGNED;
engineConfiguration->binarySerialRxPin = GPIO_UNASSIGNED; engineConfiguration->binarySerialRxPin = GPIO_UNASSIGNED;
engineConfiguration->consoleSerialTxPin = GPIO_UNASSIGNED; engineConfiguration->consoleSerialTxPin = GPIO_UNASSIGNED;
@ -185,16 +185,16 @@ void setBoardConfigurationOverrides(void) {
// todo: maybe even set EFI_MAIN_RELAY_CONTROL to FALSE for MRE configuration // todo: maybe even set EFI_MAIN_RELAY_CONTROL to FALSE for MRE configuration
// TLE8888 half bridges (pushpull, lowside, or high-low) TLE8888_IN11 / TLE8888_OUT21 // TLE8888 half bridges (pushpull, lowside, or high-low) TLE8888_IN11 / TLE8888_OUT21
// GPIOE_8: "35 - GP Out 1" // GPIOE_8: "35 - GP Out 1"
boardConfiguration->fuelPumpPin = GPIOE_8; engineConfiguration->fuelPumpPin = GPIOE_8;
// TLE8888 high current low side: VVT2 IN9 / OUT5 // TLE8888 high current low side: VVT2 IN9 / OUT5
// GPIOE_10: "3 - Lowside 2" // GPIOE_10: "3 - Lowside 2"
boardConfiguration->idle.solenoidPin = GPIOE_10; engineConfiguration->idle.solenoidPin = GPIOE_10;
// TLE8888_PIN_22: "34 - GP Out 2" // TLE8888_PIN_22: "34 - GP Out 2"
boardConfiguration->fanPin = TLE8888_PIN_22; engineConfiguration->fanPin = TLE8888_PIN_22;
// "required" hardware is done - set some reasonable defaults // "required" hardware is done - set some reasonable defaults
setupDefaultSensorInputs(); setupDefaultSensorInputs();

View File

@ -24,12 +24,12 @@ void setPinConfigurationOverrides(void) {
} }
void setSerialConfigurationOverrides(void) { void setSerialConfigurationOverrides(void) {
boardConfiguration->useSerialPort = true; engineConfiguration->useSerialPort = true;
engineConfiguration->binarySerialTxPin = GPIOD_8; engineConfiguration->binarySerialTxPin = GPIOD_8;
engineConfiguration->binarySerialRxPin = GPIOD_9; engineConfiguration->binarySerialRxPin = GPIOD_9;
engineConfiguration->consoleSerialTxPin = GPIOD_8; engineConfiguration->consoleSerialTxPin = GPIOD_8;
engineConfiguration->consoleSerialRxPin = GPIOD_9; engineConfiguration->consoleSerialRxPin = GPIOD_9;
boardConfiguration->tunerStudioSerialSpeed = SERIAL_SPEED; engineConfiguration->tunerStudioSerialSpeed = SERIAL_SPEED;
engineConfiguration->uartConsoleSerialSpeed = SERIAL_SPEED; engineConfiguration->uartConsoleSerialSpeed = SERIAL_SPEED;
} }
@ -56,28 +56,28 @@ void setBoardConfigurationOverrides(void) {
engineConfiguration->dizzySparkOutputPin = GPIO_UNASSIGNED; engineConfiguration->dizzySparkOutputPin = GPIO_UNASSIGNED;
engineConfiguration->externalKnockSenseAdc = EFI_ADC_NONE; engineConfiguration->externalKnockSenseAdc = EFI_ADC_NONE;
engineConfiguration->displayMode = DM_NONE; engineConfiguration->displayMode = DM_NONE;
boardConfiguration->HD44780_rs = GPIO_UNASSIGNED; engineConfiguration->HD44780_rs = GPIO_UNASSIGNED;
boardConfiguration->HD44780_e = GPIO_UNASSIGNED; engineConfiguration->HD44780_e = GPIO_UNASSIGNED;
boardConfiguration->HD44780_db4 = GPIO_UNASSIGNED; engineConfiguration->HD44780_db4 = GPIO_UNASSIGNED;
boardConfiguration->HD44780_db5 = GPIO_UNASSIGNED; engineConfiguration->HD44780_db5 = GPIO_UNASSIGNED;
boardConfiguration->HD44780_db6 = GPIO_UNASSIGNED; engineConfiguration->HD44780_db6 = GPIO_UNASSIGNED;
boardConfiguration->HD44780_db7 = GPIO_UNASSIGNED; engineConfiguration->HD44780_db7 = GPIO_UNASSIGNED;
for (int i = 0; i < DIGIPOT_COUNT ; i++) { for (int i = 0; i < DIGIPOT_COUNT ; i++) {
boardConfiguration->digitalPotentiometerChipSelect[i] = GPIO_UNASSIGNED; engineConfiguration->digitalPotentiometerChipSelect[i] = GPIO_UNASSIGNED;
} }
boardConfiguration->triggerSimulatorPins[1] = GPIO_UNASSIGNED; engineConfiguration->triggerSimulatorPins[1] = GPIO_UNASSIGNED;
boardConfiguration->triggerSimulatorPins[2] = GPIO_UNASSIGNED; engineConfiguration->triggerSimulatorPins[2] = GPIO_UNASSIGNED;
boardConfiguration->triggerSimulatorPinModes[1] = OM_DEFAULT; engineConfiguration->triggerSimulatorPinModes[1] = OM_DEFAULT;
boardConfiguration->triggerSimulatorPinModes[2] = OM_DEFAULT; engineConfiguration->triggerSimulatorPinModes[2] = OM_DEFAULT;
engineConfiguration->vehicleSpeedSensorInputPin = GPIO_UNASSIGNED; engineConfiguration->vehicleSpeedSensorInputPin = GPIO_UNASSIGNED;
boardConfiguration->digitalPotentiometerSpiDevice = SPI_NONE; engineConfiguration->digitalPotentiometerSpiDevice = SPI_NONE;
boardConfiguration->max31855spiDevice = SPI_NONE; engineConfiguration->max31855spiDevice = SPI_NONE;
///////////////////////////////////////////////////////// /////////////////////////////////////////////////////////
boardConfiguration->is_enabled_spi_1 = false; engineConfiguration->is_enabled_spi_1 = false;
boardConfiguration->is_enabled_spi_2 = false; engineConfiguration->is_enabled_spi_2 = false;
boardConfiguration->is_enabled_spi_3 = false; engineConfiguration->is_enabled_spi_3 = false;
} }
void setAdcChannelOverrides(void) { void setAdcChannelOverrides(void) {

View File

@ -63,22 +63,22 @@ static void setPrometheusDefaults(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
engineConfiguration->tpsErrorDetectionTooLow = -10; // -10% open engineConfiguration->tpsErrorDetectionTooLow = -10; // -10% open
engineConfiguration->tpsErrorDetectionTooHigh = 110; // 110% open engineConfiguration->tpsErrorDetectionTooHigh = 110; // 110% open
boardConfiguration->mapMinBufferLength = 4; engineConfiguration->mapMinBufferLength = 4;
} }
void setPinConfigurationOverrides(void) { void setPinConfigurationOverrides(void) {
#if 0 #if 0
boardConfiguration->injectionPins[0] = is469 ? GPIOD_9 : GPIOB_14; // #1 engineConfiguration->injectionPins[0] = is469 ? GPIOD_9 : GPIOB_14; // #1
boardConfiguration->injectionPins[1] = is469 ? GPIOD_15 : GPIOC_7; // #2 engineConfiguration->injectionPins[1] = is469 ? GPIOD_15 : GPIOC_7; // #2
boardConfiguration->injectionPins[2] = is469 ? GPIOD_10 : GPIOB_15; // #3 engineConfiguration->injectionPins[2] = is469 ? GPIOD_10 : GPIOB_15; // #3
boardConfiguration->injectionPins[3] = is469 ? GPIOD_14 : GPIOC_6; // #4 engineConfiguration->injectionPins[3] = is469 ? GPIOD_14 : GPIOC_6; // #4
boardConfiguration->ignitionPins[0] = GPIOA_10; engineConfiguration->ignitionPins[0] = GPIOA_10;
boardConfiguration->ignitionPins[1] = GPIOA_9; engineConfiguration->ignitionPins[1] = GPIOA_9;
boardConfiguration->ignitionPins[2] = GPIOA_8; engineConfiguration->ignitionPins[2] = GPIOA_8;
boardConfiguration->ignitionPins[3] = GPIOA_11; engineConfiguration->ignitionPins[3] = GPIOA_11;
boardConfiguration->ignitionPinMode = OM_INVERTED; engineConfiguration->ignitionPinMode = OM_INVERTED;
enginePins.startInjectionPins(); enginePins.startInjectionPins();
enginePins.startIgnitionPins(); enginePins.startIgnitionPins();
@ -109,20 +109,20 @@ void setPinConfigurationOverrides(void) {
} }
void setSerialConfigurationOverrides(void) { void setSerialConfigurationOverrides(void) {
boardConfiguration->useSerialPort = true; engineConfiguration->useSerialPort = true;
engineConfiguration->binarySerialTxPin = GPIOA_0; engineConfiguration->binarySerialTxPin = GPIOA_0;
engineConfiguration->binarySerialRxPin = GPIOA_1; engineConfiguration->binarySerialRxPin = GPIOA_1;
engineConfiguration->consoleSerialTxPin = GPIOA_0; engineConfiguration->consoleSerialTxPin = GPIOA_0;
engineConfiguration->consoleSerialRxPin = GPIOA_1; engineConfiguration->consoleSerialRxPin = GPIOA_1;
boardConfiguration->tunerStudioSerialSpeed = SERIAL_SPEED; engineConfiguration->tunerStudioSerialSpeed = SERIAL_SPEED;
engineConfiguration->uartConsoleSerialSpeed = SERIAL_SPEED; engineConfiguration->uartConsoleSerialSpeed = SERIAL_SPEED;
} }
void setSdCardConfigurationOverrides(void) { void setSdCardConfigurationOverrides(void) {
boardConfiguration->is_enabled_spi_1 = true; engineConfiguration->is_enabled_spi_1 = true;
engineConfiguration->sdCardSpiDevice = SPI_DEVICE_1; engineConfiguration->sdCardSpiDevice = SPI_DEVICE_1;
boardConfiguration->sdCardCsPin = GPIOA_2; engineConfiguration->sdCardCsPin = GPIOA_2;
boardConfiguration->isSdCardEnabled = true; engineConfiguration->isSdCardEnabled = true;
} }
/** /**
@ -148,24 +148,24 @@ void setBoardConfigurationOverrides(void) {
engineConfiguration->baroSensor.hwChannel = EFI_ADC_NONE; engineConfiguration->baroSensor.hwChannel = EFI_ADC_NONE;
engineConfiguration->throttlePedalPositionAdcChannel = EFI_ADC_NONE; engineConfiguration->throttlePedalPositionAdcChannel = EFI_ADC_NONE;
boardConfiguration->injectionPins[0] = is469 ? GPIOD_9 : GPIOB_14; // #1 engineConfiguration->injectionPins[0] = is469 ? GPIOD_9 : GPIOB_14; // #1
boardConfiguration->injectionPins[1] = is469 ? GPIOD_15 : GPIOC_7; // #2 engineConfiguration->injectionPins[1] = is469 ? GPIOD_15 : GPIOC_7; // #2
boardConfiguration->injectionPins[2] = is469 ? GPIOD_10 : GPIOB_15; // #3 engineConfiguration->injectionPins[2] = is469 ? GPIOD_10 : GPIOB_15; // #3
boardConfiguration->injectionPins[3] = is469 ? GPIOD_14 : GPIOC_6; // #4 engineConfiguration->injectionPins[3] = is469 ? GPIOD_14 : GPIOC_6; // #4
boardConfiguration->ignitionPins[0] = GPIOA_10; engineConfiguration->ignitionPins[0] = GPIOA_10;
boardConfiguration->ignitionPins[1] = GPIOA_9; engineConfiguration->ignitionPins[1] = GPIOA_9;
boardConfiguration->ignitionPins[2] = GPIOA_8; engineConfiguration->ignitionPins[2] = GPIOA_8;
boardConfiguration->ignitionPins[3] = GPIOA_11; engineConfiguration->ignitionPins[3] = GPIOA_11;
boardConfiguration->ignitionPinMode = OM_INVERTED; engineConfiguration->ignitionPinMode = OM_INVERTED;
engineConfiguration->vbattDividerCoeff = ((float) (2 + 10)) / 2; engineConfiguration->vbattDividerCoeff = ((float) (2 + 10)) / 2;
engineConfiguration->clt.config.bias_resistor = 2700; engineConfiguration->clt.config.bias_resistor = 2700;
engineConfiguration->iat.config.bias_resistor = 2700; engineConfiguration->iat.config.bias_resistor = 2700;
boardConfiguration->useStepperIdle = true; engineConfiguration->useStepperIdle = true;
boardConfiguration->idle.stepperDirectionPin = is469 ? GPIOB_14 : GPIOB_12; engineConfiguration->idle.stepperDirectionPin = is469 ? GPIOB_14 : GPIOB_12;
boardConfiguration->idle.stepperStepPin = is469 ? GPIOB_15 : GPIOB_13; engineConfiguration->idle.stepperStepPin = is469 ? GPIOB_15 : GPIOB_13;
engineConfiguration->stepperEnablePin = GPIO_UNASSIGNED; engineConfiguration->stepperEnablePin = GPIO_UNASSIGNED;
engineConfiguration->stepperEnablePinMode = OM_DEFAULT; engineConfiguration->stepperEnablePinMode = OM_DEFAULT;
@ -174,93 +174,93 @@ void setBoardConfigurationOverrides(void) {
//engineConfiguration->fatalErrorPin = GPIOA_13; //engineConfiguration->fatalErrorPin = GPIOA_13;
engineConfiguration->warningLedPin = GPIO_UNASSIGNED; engineConfiguration->warningLedPin = GPIO_UNASSIGNED;
boardConfiguration->triggerInputPins[0] = GPIOA_5; engineConfiguration->triggerInputPins[0] = GPIOA_5;
boardConfiguration->triggerInputPins[1] = GPIO_UNASSIGNED; engineConfiguration->triggerInputPins[1] = GPIO_UNASSIGNED;
boardConfiguration->triggerInputPins[2] = GPIO_UNASSIGNED; engineConfiguration->triggerInputPins[2] = GPIO_UNASSIGNED;
engineConfiguration->camInputs[0] = is469 ? GPIOE_9 : GPIOA_6; engineConfiguration->camInputs[0] = is469 ? GPIOE_9 : GPIOA_6;
boardConfiguration->tachOutputPin = GPIOC_8; engineConfiguration->tachOutputPin = GPIOC_8;
boardConfiguration->tachOutputPinMode = OM_DEFAULT; engineConfiguration->tachOutputPinMode = OM_DEFAULT;
boardConfiguration->fuelPumpPin = is469 ? GPIOD_6 : GPIOB_7; engineConfiguration->fuelPumpPin = is469 ? GPIOD_6 : GPIOB_7;
boardConfiguration->fuelPumpPinMode = OM_DEFAULT; engineConfiguration->fuelPumpPinMode = OM_DEFAULT;
boardConfiguration->mainRelayPin = is469 ? GPIOB_11 : GPIOB_2; engineConfiguration->mainRelayPin = is469 ? GPIOB_11 : GPIOB_2;
boardConfiguration->mainRelayPinMode = OM_DEFAULT; engineConfiguration->mainRelayPinMode = OM_DEFAULT;
boardConfiguration->fanPin = GPIOC_9; engineConfiguration->fanPin = GPIOC_9;
boardConfiguration->fanPinMode = OM_DEFAULT; engineConfiguration->fanPinMode = OM_DEFAULT;
boardConfiguration->malfunctionIndicatorPin = GPIOC_1; engineConfiguration->malfunctionIndicatorPin = GPIOC_1;
boardConfiguration->malfunctionIndicatorPinMode = OM_DEFAULT; engineConfiguration->malfunctionIndicatorPinMode = OM_DEFAULT;
// starter block // starter block
setFsio(0, (is469 ? GPIOB_10 : GPIOB_1), STARTER_RELAY_LOGIC PASS_CONFIG_PARAMETER_SUFFIX); setFsio(0, (is469 ? GPIOB_10 : GPIOB_1), STARTER_RELAY_LOGIC PASS_CONFIG_PARAMETER_SUFFIX);
// debug pad // debug pad
boardConfiguration->triggerSimulatorPins[0] = GPIOD_8; engineConfiguration->triggerSimulatorPins[0] = GPIOD_8;
boardConfiguration->triggerSimulatorPinModes[0] = OM_DEFAULT; engineConfiguration->triggerSimulatorPinModes[0] = OM_DEFAULT;
// not used // not used
engineConfiguration->dizzySparkOutputPin = GPIO_UNASSIGNED; engineConfiguration->dizzySparkOutputPin = GPIO_UNASSIGNED;
engineConfiguration->externalKnockSenseAdc = EFI_ADC_NONE; engineConfiguration->externalKnockSenseAdc = EFI_ADC_NONE;
engineConfiguration->displayMode = DM_NONE; engineConfiguration->displayMode = DM_NONE;
boardConfiguration->HD44780_rs = GPIO_UNASSIGNED; engineConfiguration->HD44780_rs = GPIO_UNASSIGNED;
boardConfiguration->HD44780_e = GPIO_UNASSIGNED; engineConfiguration->HD44780_e = GPIO_UNASSIGNED;
boardConfiguration->HD44780_db4 = GPIO_UNASSIGNED; engineConfiguration->HD44780_db4 = GPIO_UNASSIGNED;
boardConfiguration->HD44780_db5 = GPIO_UNASSIGNED; engineConfiguration->HD44780_db5 = GPIO_UNASSIGNED;
boardConfiguration->HD44780_db6 = GPIO_UNASSIGNED; engineConfiguration->HD44780_db6 = GPIO_UNASSIGNED;
boardConfiguration->HD44780_db7 = GPIO_UNASSIGNED; engineConfiguration->HD44780_db7 = GPIO_UNASSIGNED;
for (int i = 0; i < DIGIPOT_COUNT ; i++) { for (int i = 0; i < DIGIPOT_COUNT ; i++) {
boardConfiguration->digitalPotentiometerChipSelect[i] = GPIO_UNASSIGNED; engineConfiguration->digitalPotentiometerChipSelect[i] = GPIO_UNASSIGNED;
} }
boardConfiguration->triggerSimulatorPins[1] = GPIO_UNASSIGNED; engineConfiguration->triggerSimulatorPins[1] = GPIO_UNASSIGNED;
boardConfiguration->triggerSimulatorPins[2] = GPIO_UNASSIGNED; engineConfiguration->triggerSimulatorPins[2] = GPIO_UNASSIGNED;
boardConfiguration->triggerSimulatorPinModes[1] = OM_DEFAULT; engineConfiguration->triggerSimulatorPinModes[1] = OM_DEFAULT;
boardConfiguration->triggerSimulatorPinModes[2] = OM_DEFAULT; engineConfiguration->triggerSimulatorPinModes[2] = OM_DEFAULT;
engineConfiguration->vehicleSpeedSensorInputPin = GPIO_UNASSIGNED; engineConfiguration->vehicleSpeedSensorInputPin = GPIO_UNASSIGNED;
boardConfiguration->digitalPotentiometerSpiDevice = SPI_NONE; engineConfiguration->digitalPotentiometerSpiDevice = SPI_NONE;
boardConfiguration->max31855spiDevice = SPI_NONE; engineConfiguration->max31855spiDevice = SPI_NONE;
///////////////////////////////////////////////////////// /////////////////////////////////////////////////////////
boardConfiguration->is_enabled_spi_1 = true; engineConfiguration->is_enabled_spi_1 = true;
boardConfiguration->is_enabled_spi_2 = false; engineConfiguration->is_enabled_spi_2 = false;
boardConfiguration->is_enabled_spi_3 = true; engineConfiguration->is_enabled_spi_3 = true;
boardConfiguration->spi1mosiPin = GPIOB_5; engineConfiguration->spi1mosiPin = GPIOB_5;
engineConfiguration->spi1MosiMode = PO_DEFAULT; // PAL_STM32_OTYPE_PUSHPULL engineConfiguration->spi1MosiMode = PO_DEFAULT; // PAL_STM32_OTYPE_PUSHPULL
boardConfiguration->spi1misoPin = GPIOB_4; engineConfiguration->spi1misoPin = GPIOB_4;
engineConfiguration->spi1MisoMode = PO_DEFAULT; // PAL_STM32_OTYPE_PUSHPULL engineConfiguration->spi1MisoMode = PO_DEFAULT; // PAL_STM32_OTYPE_PUSHPULL
boardConfiguration->spi1sckPin = GPIOB_3; engineConfiguration->spi1sckPin = GPIOB_3;
engineConfiguration->spi1SckMode = PO_DEFAULT; // PAL_STM32_OTYPE_PUSHPULL engineConfiguration->spi1SckMode = PO_DEFAULT; // PAL_STM32_OTYPE_PUSHPULL
boardConfiguration->spi3mosiPin = GPIOC_12; engineConfiguration->spi3mosiPin = GPIOC_12;
engineConfiguration->spi3MosiMode = PO_OPENDRAIN; // 4 engineConfiguration->spi3MosiMode = PO_OPENDRAIN; // 4
boardConfiguration->spi3misoPin = GPIOC_11; engineConfiguration->spi3misoPin = GPIOC_11;
engineConfiguration->spi3MisoMode = PO_PULLUP; // 32 engineConfiguration->spi3MisoMode = PO_PULLUP; // 32
boardConfiguration->spi3sckPin = GPIOC_10; engineConfiguration->spi3sckPin = GPIOC_10;
engineConfiguration->spi3SckMode = PO_OPENDRAIN; // 4 engineConfiguration->spi3SckMode = PO_OPENDRAIN; // 4
engineConfiguration->hip9011SpiDevice = SPI_DEVICE_3; engineConfiguration->hip9011SpiDevice = SPI_DEVICE_3;
boardConfiguration->hip9011CsPin = is469 ? GPIOD_1 : GPIOD_2; engineConfiguration->hip9011CsPin = is469 ? GPIOD_1 : GPIOD_2;
boardConfiguration->hip9011CsPinMode = OM_OPENDRAIN; engineConfiguration->hip9011CsPinMode = OM_OPENDRAIN;
boardConfiguration->hip9011IntHoldPin = GPIOC_14; engineConfiguration->hip9011IntHoldPin = GPIOC_14;
boardConfiguration->hip9011IntHoldPinMode = OM_OPENDRAIN; engineConfiguration->hip9011IntHoldPinMode = OM_OPENDRAIN;
engineConfiguration->hipOutputChannel = EFI_ADC_10; // PC0 engineConfiguration->hipOutputChannel = EFI_ADC_10; // PC0
boardConfiguration->isHip9011Enabled = true; engineConfiguration->isHip9011Enabled = true;
engineConfiguration->cj125SpiDevice = SPI_DEVICE_3; engineConfiguration->cj125SpiDevice = SPI_DEVICE_3;
engineConfiguration->cj125ua = is469 ? EFI_ADC_9 : EFI_ADC_8; engineConfiguration->cj125ua = is469 ? EFI_ADC_9 : EFI_ADC_8;
engineConfiguration->cj125ur = EFI_ADC_12; engineConfiguration->cj125ur = EFI_ADC_12;
boardConfiguration->cj125CsPin = GPIOA_15; engineConfiguration->cj125CsPin = GPIOA_15;
engineConfiguration->cj125CsPinMode = OM_OPENDRAIN; engineConfiguration->cj125CsPinMode = OM_OPENDRAIN;
boardConfiguration->wboHeaterPin = GPIOC_13; engineConfiguration->wboHeaterPin = GPIOC_13;
boardConfiguration->o2heaterPin = GPIOC_13; engineConfiguration->o2heaterPin = GPIOC_13;
//boardConfiguration->isCJ125Enabled = true; //engineConfiguration->isCJ125Enabled = true;
boardConfiguration->isCJ125Enabled = false; engineConfiguration->isCJ125Enabled = false;
boardConfiguration->canDeviceMode = CD_USE_CAN1; engineConfiguration->canDeviceMode = CD_USE_CAN1;
boardConfiguration->canTxPin = GPIOB_9; engineConfiguration->canTxPin = GPIOB_9;
boardConfiguration->canRxPin = GPIOB_8; engineConfiguration->canRxPin = GPIOB_8;
//!!!!!!!!!!!!!!! //!!!!!!!!!!!!!!!
#if 1 #if 1

View File

@ -46,19 +46,19 @@ static const brain_pin_e ignPins[] = {
}; };
static void setInjectorPins() { static void setInjectorPins() {
copyArray(boardConfiguration->injectionPins, injPins); copyArray(engineConfiguration->injectionPins, injPins);
boardConfiguration->injectionPinMode = OM_DEFAULT; engineConfiguration->injectionPinMode = OM_DEFAULT;
} }
static void setIgnitionPins() { static void setIgnitionPins() {
copyArray(boardConfiguration->ignitionPins, ignPins); copyArray(engineConfiguration->ignitionPins, ignPins);
boardConfiguration->ignitionPinMode = OM_DEFAULT; engineConfiguration->ignitionPinMode = OM_DEFAULT;
} }
static void setLedPins() { static void setLedPins() {
engineConfiguration->communicationLedPin = GPIOE_4; engineConfiguration->communicationLedPin = GPIOE_4;
engineConfiguration->runningLedPin = GPIOE_5; engineConfiguration->runningLedPin = GPIOE_5;
boardConfiguration->triggerErrorPin = GPIOE_6; engineConfiguration->triggerErrorPin = GPIOE_6;
} }
static void setupVbatt() { static void setupVbatt() {
@ -109,9 +109,9 @@ static void setupEtb() {
static void setupDefaultSensorInputs() { static void setupDefaultSensorInputs() {
// trigger inputs // trigger inputs
// VR channel 1 as default - others not set // VR channel 1 as default - others not set
boardConfiguration->triggerInputPins[0] = GPIOC_6; engineConfiguration->triggerInputPins[0] = GPIOC_6;
boardConfiguration->triggerInputPins[1] = GPIO_UNASSIGNED; engineConfiguration->triggerInputPins[1] = GPIO_UNASSIGNED;
boardConfiguration->triggerInputPins[2] = GPIO_UNASSIGNED; engineConfiguration->triggerInputPins[2] = GPIO_UNASSIGNED;
engineConfiguration->camInputs[0] = GPIO_UNASSIGNED; engineConfiguration->camInputs[0] = GPIO_UNASSIGNED;
// clt = Analog Temp 1 = PC4 // clt = Analog Temp 1 = PC4
@ -129,7 +129,7 @@ void setPinConfigurationOverrides(void) {
} }
void setSerialConfigurationOverrides(void) { void setSerialConfigurationOverrides(void) {
boardConfiguration->useSerialPort = false; engineConfiguration->useSerialPort = false;
engineConfiguration->binarySerialTxPin = GPIO_UNASSIGNED; engineConfiguration->binarySerialTxPin = GPIO_UNASSIGNED;
engineConfiguration->binarySerialRxPin = GPIO_UNASSIGNED; engineConfiguration->binarySerialRxPin = GPIO_UNASSIGNED;
engineConfiguration->consoleSerialTxPin = GPIO_UNASSIGNED; engineConfiguration->consoleSerialTxPin = GPIO_UNASSIGNED;

View File

@ -42,10 +42,10 @@ EXTERN_ENGINE;
// This shows a SPI connected TLE8888. // This shows a SPI connected TLE8888.
static void setupTle8888() { static void setupTle8888() {
// Enable the SPI channel and set up the SPI pins // Enable the SPI channel and set up the SPI pins
boardConfiguration->is_enabled_spi_3 = true; engineConfiguration->is_enabled_spi_3 = true;
boardConfiguration->spi3mosiPin = GPIOB_5; engineConfiguration->spi3mosiPin = GPIOB_5;
boardConfiguration->spi3misoPin = GPIOB_4; engineConfiguration->spi3misoPin = GPIOB_4;
boardConfiguration->spi3sckPin = GPIOB_3; engineConfiguration->spi3sckPin = GPIOB_3;
// SPI chip select is often independent of the SPI pin limitations // SPI chip select is often independent of the SPI pin limitations
engineConfiguration->tle8888_cs = GPIOD_5; engineConfiguration->tle8888_cs = GPIOD_5;
@ -81,8 +81,8 @@ static void setupDefaultSensorInputs() {
// Engine rotation position sensors // Engine rotation position sensors
// Trigger is our primary timing signal, and usually comes from the crank. // Trigger is our primary timing signal, and usually comes from the crank.
// trigger inputs up TRIGGER_SUPPORTED_CHANNELS (2) // trigger inputs up TRIGGER_SUPPORTED_CHANNELS (2)
boardConfiguration->triggerInputPins[0] = GPIOC_6; engineConfiguration->triggerInputPins[0] = GPIOC_6;
boardConfiguration->triggerInputPins[1] = GPIO_UNASSIGNED; engineConfiguration->triggerInputPins[1] = GPIO_UNASSIGNED;
// A secondary Cam signal up to CAM_INPUTS_COUNT (4) // A secondary Cam signal up to CAM_INPUTS_COUNT (4)
engineConfiguration->camInputs[0] = GPIOA_5; engineConfiguration->camInputs[0] = GPIOA_5;
@ -121,7 +121,7 @@ void setPinConfigurationOverrides(void) {
// Future: configure USART3 for LIN bus and UART4 for console // Future: configure USART3 for LIN bus and UART4 for console
void setSerialConfigurationOverrides(void) { void setSerialConfigurationOverrides(void) {
boardConfiguration->useSerialPort = false; engineConfiguration->useSerialPort = false;
engineConfiguration->binarySerialTxPin = GPIO_UNASSIGNED; engineConfiguration->binarySerialTxPin = GPIO_UNASSIGNED;
engineConfiguration->binarySerialRxPin = GPIO_UNASSIGNED; engineConfiguration->binarySerialRxPin = GPIO_UNASSIGNED;
engineConfiguration->consoleSerialTxPin = GPIO_UNASSIGNED; engineConfiguration->consoleSerialTxPin = GPIO_UNASSIGNED;
@ -140,7 +140,7 @@ void setBoardConfigurationOverrides(void) {
// Set indicator LED pins. // Set indicator LED pins.
// This is often redundant with efifeatures.h or the run-time config // This is often redundant with efifeatures.h or the run-time config
boardConfiguration->triggerErrorPin = GPIOE_1; engineConfiguration->triggerErrorPin = GPIOE_1;
engineConfiguration->communicationLedPin = GPIOE_2; engineConfiguration->communicationLedPin = GPIOE_2;
engineConfiguration->FatalErrorPin = GPIOE_3; engineConfiguration->FatalErrorPin = GPIOE_3;
engineConfiguration->runningLedPin = GPIOE_4; engineConfiguration->runningLedPin = GPIOE_4;
@ -149,25 +149,25 @@ void setBoardConfigurationOverrides(void) {
engineConfiguration->errorLedPin = GPIOE_7; engineConfiguration->errorLedPin = GPIOE_7;
// Set injector pins and the pin output mode // Set injector pins and the pin output mode
boardConfiguration->injectionPinMode = OM_DEFAULT; engineConfiguration->injectionPinMode = OM_DEFAULT;
boardConfiguration->injectionPins[0] = GPIOE_14; engineConfiguration->injectionPins[0] = GPIOE_14;
boardConfiguration->injectionPins[1] = GPIOE_13; engineConfiguration->injectionPins[1] = GPIOE_13;
boardConfiguration->injectionPins[2] = GPIOE_12; engineConfiguration->injectionPins[2] = GPIOE_12;
boardConfiguration->injectionPins[3] = GPIOE_11; engineConfiguration->injectionPins[3] = GPIOE_11;
// Disable the remainder only when they may never be assigned // Disable the remainder only when they may never be assigned
for (int i = 4; i < INJECTION_PIN_COUNT;i++) { for (int i = 4; i < INJECTION_PIN_COUNT;i++) {
boardConfiguration->injectionPins[i] = GPIO_UNASSIGNED; engineConfiguration->injectionPins[i] = GPIO_UNASSIGNED;
} }
// Do the same for ignition outputs // Do the same for ignition outputs
boardConfiguration->ignitionPinMode = OM_DEFAULT; engineConfiguration->ignitionPinMode = OM_DEFAULT;
boardConfiguration->ignitionPins[0] = GPIOD_4; engineConfiguration->ignitionPins[0] = GPIOD_4;
boardConfiguration->ignitionPins[1] = GPIOD_3; engineConfiguration->ignitionPins[1] = GPIOD_3;
boardConfiguration->ignitionPins[2] = GPIOD_2; engineConfiguration->ignitionPins[2] = GPIOD_2;
boardConfiguration->ignitionPins[3] = GPIOD_1; engineConfiguration->ignitionPins[3] = GPIOD_1;
// Disable remainder // Disable remainder
for (int i = 4; i < IGNITION_PIN_COUNT; i++) { for (int i = 4; i < IGNITION_PIN_COUNT; i++) {
boardConfiguration->ignitionPins[i] = GPIO_UNASSIGNED; engineConfiguration->ignitionPins[i] = GPIO_UNASSIGNED;
} }
// Board-specific scaling values to convert ADC fraction to Volts. // Board-specific scaling values to convert ADC fraction to Volts.
@ -199,16 +199,16 @@ void setBoardConfigurationOverrides(void) {
// Configure the TLE8888 half bridges (pushpull, lowside, or high-low) // Configure the TLE8888 half bridges (pushpull, lowside, or high-low)
// TLE8888_IN11 -> TLE8888_OUT21 // TLE8888_IN11 -> TLE8888_OUT21
// GPIOE_8: "35 - GP Out 1" // GPIOE_8: "35 - GP Out 1"
boardConfiguration->fuelPumpPin = GPIOE_8; engineConfiguration->fuelPumpPin = GPIOE_8;
// TLE8888 high current low side: VVT2 IN9 / OUT5 // TLE8888 high current low side: VVT2 IN9 / OUT5
// GPIOE_10: "3 - Lowside 2" // GPIOE_10: "3 - Lowside 2"
boardConfiguration->idle.solenoidPin = GPIOE_10; engineConfiguration->idle.solenoidPin = GPIOE_10;
// TLE8888_PIN_22: "34 - GP Out 2" // TLE8888_PIN_22: "34 - GP Out 2"
boardConfiguration->fanPin = TLE8888_PIN_22; engineConfiguration->fanPin = TLE8888_PIN_22;
// The "required" hardware is done - set some reasonable input defaults // The "required" hardware is done - set some reasonable input defaults
setupDefaultSensorInputs(); setupDefaultSensorInputs();

View File

@ -57,7 +57,7 @@ static void setSubaruEJ20GDefaults(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
engineConfiguration->tpsErrorDetectionTooLow = -10; // -10% open engineConfiguration->tpsErrorDetectionTooLow = -10; // -10% open
engineConfiguration->tpsErrorDetectionTooHigh = 110; // 110% open engineConfiguration->tpsErrorDetectionTooHigh = 110; // 110% open
boardConfiguration->mapMinBufferLength = 4; engineConfiguration->mapMinBufferLength = 4;
} }
void setPinConfigurationOverrides(void) { void setPinConfigurationOverrides(void) {
@ -65,20 +65,20 @@ void setPinConfigurationOverrides(void) {
} }
void setSerialConfigurationOverrides(void) { void setSerialConfigurationOverrides(void) {
boardConfiguration->useSerialPort = false; engineConfiguration->useSerialPort = false;
engineConfiguration->binarySerialTxPin = GPIOE_1; engineConfiguration->binarySerialTxPin = GPIOE_1;
engineConfiguration->binarySerialRxPin = GPIOE_0; engineConfiguration->binarySerialRxPin = GPIOE_0;
engineConfiguration->consoleSerialTxPin = GPIOA_9; engineConfiguration->consoleSerialTxPin = GPIOA_9;
engineConfiguration->consoleSerialRxPin = GPIOA_10; engineConfiguration->consoleSerialRxPin = GPIOA_10;
boardConfiguration->tunerStudioSerialSpeed = SERIAL_SPEED; engineConfiguration->tunerStudioSerialSpeed = SERIAL_SPEED;
engineConfiguration->uartConsoleSerialSpeed = SERIAL_SPEED; engineConfiguration->uartConsoleSerialSpeed = SERIAL_SPEED;
} }
void setSdCardConfigurationOverrides(void) { void setSdCardConfigurationOverrides(void) {
boardConfiguration->is_enabled_spi_1 = false; engineConfiguration->is_enabled_spi_1 = false;
engineConfiguration->sdCardSpiDevice = SPI_DEVICE_1; engineConfiguration->sdCardSpiDevice = SPI_DEVICE_1;
boardConfiguration->sdCardCsPin = GPIOA_2; engineConfiguration->sdCardCsPin = GPIOA_2;
boardConfiguration->isSdCardEnabled = false; engineConfiguration->isSdCardEnabled = false;
} }
/** /**
@ -103,19 +103,19 @@ void setBoardConfigurationOverrides(void) {
engineConfiguration->throttlePedalPositionAdcChannel = EFI_ADC_NONE; engineConfiguration->throttlePedalPositionAdcChannel = EFI_ADC_NONE;
/* Injectors */ /* Injectors */
boardConfiguration->injectionPins[0] = GPIOB_11; engineConfiguration->injectionPins[0] = GPIOB_11;
boardConfiguration->injectionPins[1] = GPIOA_0; engineConfiguration->injectionPins[1] = GPIOA_0;
boardConfiguration->injectionPins[2] = GPIOA_1; engineConfiguration->injectionPins[2] = GPIOA_1;
boardConfiguration->injectionPins[3] = GPIOB_10; engineConfiguration->injectionPins[3] = GPIOB_10;
/* 5th injector */ /* 5th injector */
//boardConfiguration->injectionPins[4] = GPIOD_15; //engineConfiguration->injectionPins[4] = GPIOD_15;
/* Ignition */ /* Ignition */
boardConfiguration->ignitionPins[0] = GPIOB_8; engineConfiguration->ignitionPins[0] = GPIOB_8;
boardConfiguration->ignitionPins[1] = GPIOB_9; engineConfiguration->ignitionPins[1] = GPIOB_9;
boardConfiguration->ignitionPins[2] = GPIOF_8; engineConfiguration->ignitionPins[2] = GPIOF_8;
boardConfiguration->ignitionPins[3] = GPIOF_9; engineConfiguration->ignitionPins[3] = GPIOF_9;
//boardConfiguration->ignitionPinMode = OM_INVERTED; //engineConfiguration->ignitionPinMode = OM_INVERTED;
//? //?
//engineConfiguration->vbattDividerCoeff = ((float) (2 + 10)) / 2; //engineConfiguration->vbattDividerCoeff = ((float) (2 + 10)) / 2;
@ -123,9 +123,9 @@ void setBoardConfigurationOverrides(void) {
//sengineConfiguration->iat.config.bias_resistor = 2700; //sengineConfiguration->iat.config.bias_resistor = 2700;
//? //?
//boardConfiguration->useStepperIdle = true; //engineConfiguration->useStepperIdle = true;
//boardConfiguration->idle.stepperDirectionPin = GPIOB_12; //engineConfiguration->idle.stepperDirectionPin = GPIOB_12;
//boardConfiguration->idle.stepperStepPin = GPIOB_13; //engineConfiguration->idle.stepperStepPin = GPIOB_13;
//engineConfiguration->stepperEnablePin = GPIO_UNASSIGNED; //engineConfiguration->stepperEnablePin = GPIO_UNASSIGNED;
//engineConfiguration->stepperEnablePinMode = OM_DEFAULT; //engineConfiguration->stepperEnablePinMode = OM_DEFAULT;
@ -136,27 +136,27 @@ void setBoardConfigurationOverrides(void) {
/* IF you have BOTH camshaft position sensor and crankshaft position sensor /* IF you have BOTH camshaft position sensor and crankshaft position sensor
* camshaft is always trigger#1 input and then crankshaft is trigger#2. */ * camshaft is always trigger#1 input and then crankshaft is trigger#2. */
boardConfiguration->triggerInputPins[0] = GPIOC_8; engineConfiguration->triggerInputPins[0] = GPIOC_8;
boardConfiguration->triggerInputPins[1] = GPIOC_9; engineConfiguration->triggerInputPins[1] = GPIOC_9;
boardConfiguration->triggerInputPins[2] = GPIO_UNASSIGNED; engineConfiguration->triggerInputPins[2] = GPIO_UNASSIGNED;
engineConfiguration->camInputs[0] = GPIO_UNASSIGNED; engineConfiguration->camInputs[0] = GPIO_UNASSIGNED;
/* spi driven - TLE6240 - OUT8, also direct driven by GPIOG_2 */ /* spi driven - TLE6240 - OUT8, also direct driven by GPIOG_2 */
boardConfiguration->tachOutputPin = TLE6240_PIN(0); engineConfiguration->tachOutputPin = TLE6240_PIN(0);
boardConfiguration->tachOutputPinMode = OM_DEFAULT; engineConfiguration->tachOutputPinMode = OM_DEFAULT;
/* spi driven - TLE6240 - OUT5 */ /* spi driven - TLE6240 - OUT5 */
boardConfiguration->fuelPumpPin = TLE6240_PIN(5); engineConfiguration->fuelPumpPin = TLE6240_PIN(5);
boardConfiguration->fuelPumpPinMode = OM_DEFAULT; engineConfiguration->fuelPumpPinMode = OM_DEFAULT;
/* self shutdownd? */ /* self shutdownd? */
boardConfiguration->mainRelayPin = GPIOG_4; engineConfiguration->mainRelayPin = GPIOG_4;
boardConfiguration->mainRelayPinMode = OM_DEFAULT; engineConfiguration->mainRelayPinMode = OM_DEFAULT;
/* spi driven - TLE6240 - OUT3, OUT4 /* spi driven - TLE6240 - OUT3, OUT4
* TODO: second fan */ * TODO: second fan */
boardConfiguration->fanPin = TLE6240_PIN(2); engineConfiguration->fanPin = TLE6240_PIN(2);
boardConfiguration->fanPinMode = OM_DEFAULT; engineConfiguration->fanPinMode = OM_DEFAULT;
/* spi driven - TLE6240 - OUT8 */ /* spi driven - TLE6240 - OUT8 */
boardConfiguration->malfunctionIndicatorPin = TLE6240_PIN(7); engineConfiguration->malfunctionIndicatorPin = TLE6240_PIN(7);
boardConfiguration->malfunctionIndicatorPinMode = OM_DEFAULT; engineConfiguration->malfunctionIndicatorPinMode = OM_DEFAULT;
// starter block // starter block
/* Starter signal connected through MC33972 - SG11 */ /* Starter signal connected through MC33972 - SG11 */
@ -167,84 +167,84 @@ void setBoardConfigurationOverrides(void) {
engineConfiguration->dizzySparkOutputPin = GPIO_UNASSIGNED; engineConfiguration->dizzySparkOutputPin = GPIO_UNASSIGNED;
engineConfiguration->externalKnockSenseAdc = EFI_ADC_NONE; engineConfiguration->externalKnockSenseAdc = EFI_ADC_NONE;
engineConfiguration->displayMode = DM_NONE; engineConfiguration->displayMode = DM_NONE;
boardConfiguration->HD44780_rs = GPIO_UNASSIGNED; engineConfiguration->HD44780_rs = GPIO_UNASSIGNED;
boardConfiguration->HD44780_e = GPIO_UNASSIGNED; engineConfiguration->HD44780_e = GPIO_UNASSIGNED;
boardConfiguration->HD44780_db4 = GPIO_UNASSIGNED; engineConfiguration->HD44780_db4 = GPIO_UNASSIGNED;
boardConfiguration->HD44780_db5 = GPIO_UNASSIGNED; engineConfiguration->HD44780_db5 = GPIO_UNASSIGNED;
boardConfiguration->HD44780_db6 = GPIO_UNASSIGNED; engineConfiguration->HD44780_db6 = GPIO_UNASSIGNED;
boardConfiguration->HD44780_db7 = GPIO_UNASSIGNED; engineConfiguration->HD44780_db7 = GPIO_UNASSIGNED;
boardConfiguration->digitalPotentiometerChipSelect[0] = GPIO_UNASSIGNED; engineConfiguration->digitalPotentiometerChipSelect[0] = GPIO_UNASSIGNED;
boardConfiguration->digitalPotentiometerChipSelect[1] = GPIO_UNASSIGNED; engineConfiguration->digitalPotentiometerChipSelect[1] = GPIO_UNASSIGNED;
boardConfiguration->digitalPotentiometerChipSelect[2] = GPIO_UNASSIGNED; engineConfiguration->digitalPotentiometerChipSelect[2] = GPIO_UNASSIGNED;
boardConfiguration->digitalPotentiometerChipSelect[3] = GPIO_UNASSIGNED; engineConfiguration->digitalPotentiometerChipSelect[3] = GPIO_UNASSIGNED;
engineConfiguration->vehicleSpeedSensorInputPin = GPIO_UNASSIGNED; engineConfiguration->vehicleSpeedSensorInputPin = GPIO_UNASSIGNED;
boardConfiguration->digitalPotentiometerSpiDevice = SPI_NONE; engineConfiguration->digitalPotentiometerSpiDevice = SPI_NONE;
boardConfiguration->max31855spiDevice = SPI_NONE; engineConfiguration->max31855spiDevice = SPI_NONE;
///////////////////////////////////////////////////////// /////////////////////////////////////////////////////////
boardConfiguration->is_enabled_spi_1 = true; engineConfiguration->is_enabled_spi_1 = true;
boardConfiguration->is_enabled_spi_2 = false; engineConfiguration->is_enabled_spi_2 = false;
boardConfiguration->is_enabled_spi_3 = true; engineConfiguration->is_enabled_spi_3 = true;
boardConfiguration->spi1mosiPin = GPIO_UNASSIGNED; engineConfiguration->spi1mosiPin = GPIO_UNASSIGNED;
engineConfiguration->spi1MosiMode = PO_DEFAULT; engineConfiguration->spi1MosiMode = PO_DEFAULT;
boardConfiguration->spi1misoPin = GPIO_UNASSIGNED; engineConfiguration->spi1misoPin = GPIO_UNASSIGNED;
engineConfiguration->spi1MisoMode = PO_DEFAULT; engineConfiguration->spi1MisoMode = PO_DEFAULT;
boardConfiguration->spi1sckPin = GPIO_UNASSIGNED; engineConfiguration->spi1sckPin = GPIO_UNASSIGNED;
engineConfiguration->spi1SckMode = PO_DEFAULT; engineConfiguration->spi1SckMode = PO_DEFAULT;
boardConfiguration->spi3mosiPin = GPIOC_12; engineConfiguration->spi3mosiPin = GPIOC_12;
engineConfiguration->spi3MosiMode = PO_DEFAULT; engineConfiguration->spi3MosiMode = PO_DEFAULT;
boardConfiguration->spi3misoPin = GPIOC_11; engineConfiguration->spi3misoPin = GPIOC_11;
engineConfiguration->spi3MisoMode = PO_DEFAULT; engineConfiguration->spi3MisoMode = PO_DEFAULT;
boardConfiguration->spi3sckPin = GPIOC_10; engineConfiguration->spi3sckPin = GPIOC_10;
engineConfiguration->spi3SckMode = PO_DEFAULT; engineConfiguration->spi3SckMode = PO_DEFAULT;
engineConfiguration->hip9011SpiDevice = SPI_DEVICE_4; engineConfiguration->hip9011SpiDevice = SPI_DEVICE_4;
boardConfiguration->hip9011CsPin = GPIOF_1; engineConfiguration->hip9011CsPin = GPIOF_1;
boardConfiguration->hip9011CsPinMode = OM_OPENDRAIN; engineConfiguration->hip9011CsPinMode = OM_OPENDRAIN;
boardConfiguration->hip9011IntHoldPin = GPIOC_15; engineConfiguration->hip9011IntHoldPin = GPIOC_15;
boardConfiguration->hip9011IntHoldPinMode = OM_OPENDRAIN; engineConfiguration->hip9011IntHoldPinMode = OM_OPENDRAIN;
engineConfiguration->hipOutputChannel = EFI_ADC_7; // PA7 engineConfiguration->hipOutputChannel = EFI_ADC_7; // PA7
boardConfiguration->isHip9011Enabled = true; engineConfiguration->isHip9011Enabled = true;
#if 0 #if 0
engineConfiguration->cj125SpiDevice = SPI_DEVICE_3; engineConfiguration->cj125SpiDevice = SPI_DEVICE_3;
engineConfiguration->cj125ua = EFI_ADC_9; engineConfiguration->cj125ua = EFI_ADC_9;
engineConfiguration->cj125ur = EFI_ADC_12; engineConfiguration->cj125ur = EFI_ADC_12;
boardConfiguration->cj125CsPin = GPIOA_15; engineConfiguration->cj125CsPin = GPIOA_15;
engineConfiguration->cj125CsPinMode = OM_OPENDRAIN; engineConfiguration->cj125CsPinMode = OM_OPENDRAIN;
boardConfiguration->wboHeaterPin = GPIOC_13; engineConfiguration->wboHeaterPin = GPIOC_13;
boardConfiguration->o2heaterPin = GPIOC_13; engineConfiguration->o2heaterPin = GPIOC_13;
#endif #endif
boardConfiguration->isCJ125Enabled = false; engineConfiguration->isCJ125Enabled = false;
boardConfiguration->canDeviceMode = CD_USE_CAN1; engineConfiguration->canDeviceMode = CD_USE_CAN1;
boardConfiguration->canTxPin = GPIOD_0; engineConfiguration->canTxPin = GPIOD_0;
boardConfiguration->canRxPin = GPIOD_1; engineConfiguration->canRxPin = GPIOD_1;
//!!!!!!!!!!!!!!! //!!!!!!!!!!!!!!!
#if 1 #if 1
setSubaruEJ20GDefaults(PASS_ENGINE_PARAMETER_SIGNATURE); setSubaruEJ20GDefaults(PASS_ENGINE_PARAMETER_SIGNATURE);
#endif #endif
/* actually i2c extension connector */ /* actually i2c extension connector */
boardConfiguration->triggerSimulatorPins[0] = GPIOF_14; engineConfiguration->triggerSimulatorPins[0] = GPIOF_14;
boardConfiguration->triggerSimulatorPins[1] = GPIOF_15; engineConfiguration->triggerSimulatorPins[1] = GPIOF_15;
boardConfiguration->triggerSimulatorPins[2] = GPIO_UNASSIGNED; engineConfiguration->triggerSimulatorPins[2] = GPIO_UNASSIGNED;
boardConfiguration->triggerSimulatorPinModes[0] = OM_DEFAULT; engineConfiguration->triggerSimulatorPinModes[0] = OM_DEFAULT;
boardConfiguration->triggerSimulatorPinModes[1] = OM_DEFAULT; engineConfiguration->triggerSimulatorPinModes[1] = OM_DEFAULT;
boardConfiguration->triggerSimulatorPinModes[2] = OM_DEFAULT; engineConfiguration->triggerSimulatorPinModes[2] = OM_DEFAULT;
boardConfiguration->logicAnalyzerPins[0] = GPIO_UNASSIGNED; engineConfiguration->logicAnalyzerPins[0] = GPIO_UNASSIGNED;
boardConfiguration->logicAnalyzerPins[1] = GPIO_UNASSIGNED; engineConfiguration->logicAnalyzerPins[1] = GPIO_UNASSIGNED;
boardConfiguration->logicAnalyzerPins[2] = GPIO_UNASSIGNED; engineConfiguration->logicAnalyzerPins[2] = GPIO_UNASSIGNED;
boardConfiguration->logicAnalyzerPins[3] = GPIO_UNASSIGNED; engineConfiguration->logicAnalyzerPins[3] = GPIO_UNASSIGNED;
boardConfiguration->logicAnalyzerMode[0] = OM_DEFAULT; engineConfiguration->logicAnalyzerMode[0] = OM_DEFAULT;
boardConfiguration->logicAnalyzerMode[1] = OM_DEFAULT; engineConfiguration->logicAnalyzerMode[1] = OM_DEFAULT;
boardConfiguration->logicAnalyzerMode[2] = OM_DEFAULT; engineConfiguration->logicAnalyzerMode[2] = OM_DEFAULT;
boardConfiguration->logicAnalyzerMode[3] = OM_DEFAULT; engineConfiguration->logicAnalyzerMode[3] = OM_DEFAULT;
//!!!!!!!!!!!!!!!!!!! //!!!!!!!!!!!!!!!!!!!
//engineConfiguration->silentTriggerError = true; //engineConfiguration->silentTriggerError = true;

View File

@ -89,7 +89,7 @@ void setGy6139qmbDefaultEngineConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE)
engineConfiguration->analogInputDividerCoefficient = 1; engineConfiguration->analogInputDividerCoefficient = 1;
engineConfiguration->fuelAlgorithm = LM_MAP; engineConfiguration->fuelAlgorithm = LM_MAP;
engineConfiguration->globalTriggerAngleOffset = 45; engineConfiguration->globalTriggerAngleOffset = 45;
boardConfiguration->sensorChartMode = SC_MAP; engineConfiguration->sensorChartMode = SC_MAP;
engineConfiguration->specs.displacement = 0.072; // 72cc engineConfiguration->specs.displacement = 0.072; // 72cc
engineConfiguration->specs.cylindersCount = 1; engineConfiguration->specs.cylindersCount = 1;
setOperationMode(engineConfiguration, FOUR_STROKE_CRANK_SENSOR); setOperationMode(engineConfiguration, FOUR_STROKE_CRANK_SENSOR);
@ -103,8 +103,8 @@ void setGy6139qmbDefaultEngineConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE)
engineConfiguration->trigger.customTotalToothCount = 8; engineConfiguration->trigger.customTotalToothCount = 8;
engineConfiguration->trigger.customSkippedToothCount = 1; engineConfiguration->trigger.customSkippedToothCount = 1;
boardConfiguration->injectionPins[0] = GPIOC_9; engineConfiguration->injectionPins[0] = GPIOC_9;
boardConfiguration->ignitionPins[0] = GPIOC_8; engineConfiguration->ignitionPins[0] = GPIOC_8;
// set injection_mode 1 // set injection_mode 1
engineConfiguration->injectionMode = IM_SEQUENTIAL; engineConfiguration->injectionMode = IM_SEQUENTIAL;

View File

@ -27,8 +27,8 @@ void setBmwE34(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
// setOperationMode(engineConfiguration, FOUR_STROKE_CAM_SENSOR); // setOperationMode(engineConfiguration, FOUR_STROKE_CAM_SENSOR);
// engineConfiguration->trigger.type = TT_ONE_PLUS_TOOTHED_WHEEL_60_2; // engineConfiguration->trigger.type = TT_ONE_PLUS_TOOTHED_WHEEL_60_2;
// engineConfiguration->injectionMode = IM_SEQUENTIAL; // engineConfiguration->injectionMode = IM_SEQUENTIAL;
// boardConfiguration->triggerInputPins[0] = GPIOC_6; // engineConfiguration->triggerInputPins[0] = GPIOC_6;
// boardConfiguration->triggerInputPins[1] = GPIOA_5; // engineConfiguration->triggerInputPins[1] = GPIOA_5;
//Base engine setting //Base engine setting
engineConfiguration->specs.cylindersCount = 6; engineConfiguration->specs.cylindersCount = 6;
@ -39,7 +39,7 @@ void setBmwE34(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
engineConfiguration->ignitionMode = IM_WASTED_SPARK; engineConfiguration->ignitionMode = IM_WASTED_SPARK;
engineConfiguration->useOnlyRisingEdgeForTrigger = true; engineConfiguration->useOnlyRisingEdgeForTrigger = true;
boardConfiguration->tachOutputPin = GPIOC_8; engineConfiguration->tachOutputPin = GPIOC_8;
// Trigger configuration // Trigger configuration
// engineConfiguration->trigger.type = TT_TOOTHED_WHEEL_60_2; // engineConfiguration->trigger.type = TT_TOOTHED_WHEEL_60_2;
@ -58,12 +58,12 @@ void setBmwE34(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
engineConfiguration->injector.flow = 750; engineConfiguration->injector.flow = 750;
// General settings // General settings
boardConfiguration->tunerStudioSerialSpeed = 57600; engineConfiguration->tunerStudioSerialSpeed = 57600;
engineConfiguration->rpmHardLimit = 7000; engineConfiguration->rpmHardLimit = 7000;
setAlgorithm(LM_SPEED_DENSITY PASS_CONFIG_PARAMETER_SUFFIX); setAlgorithm(LM_SPEED_DENSITY PASS_CONFIG_PARAMETER_SUFFIX);
// for best performance at high RPM, we need to turn off 'Engine Sniffer' and 'Sensor Sniffer' // for best performance at high RPM, we need to turn off 'Engine Sniffer' and 'Sensor Sniffer'
boardConfiguration->sensorChartMode = SC_OFF; engineConfiguration->sensorChartMode = SC_OFF;
engineConfiguration->isEngineChartEnabled = false; engineConfiguration->isEngineChartEnabled = false;
engineConfiguration->isCylinderCleanupEnabled = false; engineConfiguration->isCylinderCleanupEnabled = false;
@ -90,52 +90,52 @@ void setBmwE34(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
engineConfiguration->tps1_1AdcChannel = EFI_ADC_3; engineConfiguration->tps1_1AdcChannel = EFI_ADC_3;
boardConfiguration->triggerInputPins[0] = GPIOA_5; engineConfiguration->triggerInputPins[0] = GPIOA_5;
boardConfiguration->triggerInputPins[1] = GPIO_UNASSIGNED; engineConfiguration->triggerInputPins[1] = GPIO_UNASSIGNED;
setWholeTimingTable(25); setWholeTimingTable(25);
boardConfiguration->malfunctionIndicatorPin = GPIO_UNASSIGNED; engineConfiguration->malfunctionIndicatorPin = GPIO_UNASSIGNED;
// bc->isFastAdcEnabled = true; // bc->isFastAdcEnabled = true;
boardConfiguration->injectionPinMode = OM_INVERTED; engineConfiguration->injectionPinMode = OM_INVERTED;
boardConfiguration->injectionPins[0] = GPIOB_8; // #1 engineConfiguration->injectionPins[0] = GPIOB_8; // #1
boardConfiguration->injectionPins[1] = GPIOE_2; // #2 engineConfiguration->injectionPins[1] = GPIOE_2; // #2
boardConfiguration->injectionPins[2] = GPIOE_3; // #3 engineConfiguration->injectionPins[2] = GPIOE_3; // #3
boardConfiguration->injectionPins[3] = GPIOE_4; // #4 engineConfiguration->injectionPins[3] = GPIOE_4; // #4
boardConfiguration->injectionPins[4] = GPIOE_5; // #5 engineConfiguration->injectionPins[4] = GPIOE_5; // #5
boardConfiguration->injectionPins[5] = GPIOE_6; // #6 engineConfiguration->injectionPins[5] = GPIOE_6; // #6
boardConfiguration->ignitionPinMode = OM_INVERTED; engineConfiguration->ignitionPinMode = OM_INVERTED;
boardConfiguration->ignitionPins[0] = GPIOB_5; // #1 engineConfiguration->ignitionPins[0] = GPIOB_5; // #1
boardConfiguration->ignitionPins[2] = GPIOB_6; // #3 engineConfiguration->ignitionPins[2] = GPIOB_6; // #3
boardConfiguration->ignitionPins[4] = GPIOB_7; // #5 engineConfiguration->ignitionPins[4] = GPIOB_7; // #5
boardConfiguration->canRxPin = GPIO_UNASSIGNED; engineConfiguration->canRxPin = GPIO_UNASSIGNED;
boardConfiguration->canTxPin = GPIO_UNASSIGNED; engineConfiguration->canTxPin = GPIO_UNASSIGNED;
boardConfiguration->triggerErrorPin = GPIO_UNASSIGNED; engineConfiguration->triggerErrorPin = GPIO_UNASSIGNED;
// clutch up // clutch up
engineConfiguration->clutchUpPin = GPIOD_3; engineConfiguration->clutchUpPin = GPIOD_3;
engineConfiguration->clutchUpPinMode = PI_PULLUP; engineConfiguration->clutchUpPinMode = PI_PULLUP;
// fuel pump // fuel pump
boardConfiguration->fuelPumpPin = GPIOD_4; engineConfiguration->fuelPumpPin = GPIOD_4;
// idle // idle
boardConfiguration->idle.solenoidPin = GPIOC_14; engineConfiguration->idle.solenoidPin = GPIOC_14;
boardConfiguration->idle.solenoidPinMode = OM_INVERTED; engineConfiguration->idle.solenoidPinMode = OM_INVERTED;
boardConfiguration->idle.solenoidFrequency = 300; engineConfiguration->idle.solenoidFrequency = 300;
boardConfiguration->manIdlePosition = 50; // set_idle_pwm 50 engineConfiguration->manIdlePosition = 50; // set_idle_pwm 50
// disable sd_card // disable sd_card
boardConfiguration->sdCardCsPin = GPIO_UNASSIGNED; engineConfiguration->sdCardCsPin = GPIO_UNASSIGNED;
boardConfiguration->is_enabled_spi_2 = false; engineConfiguration->is_enabled_spi_2 = false;
boardConfiguration->is_enabled_spi_3 = false; engineConfiguration->is_enabled_spi_3 = false;
boardConfiguration->max31855spiDevice = SPI_NONE; engineConfiguration->max31855spiDevice = SPI_NONE;
// turbocharger boost control solenoid: TODO output: GPIOE_6 // turbocharger boost control solenoid: TODO output: GPIOE_6
// water injection #1 TODO GPIOD_7 // water injection #1 TODO GPIOD_7
@ -145,7 +145,7 @@ void setBmwE34(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
* emulating the 60-0 trigger takes some resources, let's keep it slow by default * emulating the 60-0 trigger takes some resources, let's keep it slow by default
* rpm 200 * rpm 200
*/ */
boardConfiguration->triggerSimulatorFrequency = 200; engineConfiguration->triggerSimulatorFrequency = 200;
// Configurating sensors: // Configurating sensors:
@ -163,7 +163,7 @@ void setBmwE34(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
// */ // */
// bc->triggerSimulatorPins[1] = GPIO_UNASSIGNED; // bc->triggerSimulatorPins[1] = GPIO_UNASSIGNED;
boardConfiguration->triggerSimulatorPins[0] = GPIOD_1; engineConfiguration->triggerSimulatorPins[0] = GPIOD_1;
boardConfiguration->triggerSimulatorPins[1] = GPIOD_2; engineConfiguration->triggerSimulatorPins[1] = GPIOD_2;
boardConfiguration->triggerSimulatorPins[2] = GPIO_UNASSIGNED; engineConfiguration->triggerSimulatorPins[2] = GPIO_UNASSIGNED;
} }

View File

@ -98,36 +98,36 @@ void setEngineBMW_M73_Frankenso(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
setFrankensoConfiguration(PASS_CONFIG_PARAMETER_SIGNATURE); setFrankensoConfiguration(PASS_CONFIG_PARAMETER_SIGNATURE);
m73engine(PASS_CONFIG_PARAMETER_SIGNATURE); m73engine(PASS_CONFIG_PARAMETER_SIGNATURE);
boardConfiguration->triggerInputPins[0] = GPIOA_5; engineConfiguration->triggerInputPins[0] = GPIOA_5;
boardConfiguration->triggerInputPins[1] = GPIO_UNASSIGNED; engineConfiguration->triggerInputPins[1] = GPIO_UNASSIGNED;
engineConfiguration->camInputs[0] = GPIOC_6; engineConfiguration->camInputs[0] = GPIOC_6;
CONFIGB(idle).solenoidPin = GPIO_UNASSIGNED; CONFIG(idle).solenoidPin = GPIO_UNASSIGNED;
CONFIGB(mainRelayPin) = GPIO_UNASSIGNED; CONFIG(mainRelayPin) = GPIO_UNASSIGNED;
CONFIGB(fanPin) = GPIO_UNASSIGNED; CONFIG(fanPin) = GPIO_UNASSIGNED;
CONFIGB(fuelPumpPin) = GPIO_UNASSIGNED; CONFIG(fuelPumpPin) = GPIO_UNASSIGNED;
boardConfiguration->ignitionPins[ID2INDEX(1)] = GPIOE_14; // Frankenso high side - pin 1G - GREEN wire engineConfiguration->ignitionPins[ID2INDEX(1)] = GPIOE_14; // Frankenso high side - pin 1G - GREEN wire
boardConfiguration->ignitionPins[ID2INDEX(2)] = GPIO_UNASSIGNED; engineConfiguration->ignitionPins[ID2INDEX(2)] = GPIO_UNASSIGNED;
boardConfiguration->ignitionPins[ID2INDEX(3)] = GPIO_UNASSIGNED; engineConfiguration->ignitionPins[ID2INDEX(3)] = GPIO_UNASSIGNED;
boardConfiguration->ignitionPins[ID2INDEX(4)] = GPIO_UNASSIGNED; engineConfiguration->ignitionPins[ID2INDEX(4)] = GPIO_UNASSIGNED;
boardConfiguration->ignitionPins[ID2INDEX(7)] = GPIOC_7; // Frankenso high side - pin 1H - ORANGE wire engineConfiguration->ignitionPins[ID2INDEX(7)] = GPIOC_7; // Frankenso high side - pin 1H - ORANGE wire
boardConfiguration->injectionPins[0] = GPIOB_8; // BLU engineConfiguration->injectionPins[0] = GPIOB_8; // BLU
boardConfiguration->injectionPins[1] = GPIOB_7; // BLK engineConfiguration->injectionPins[1] = GPIOB_7; // BLK
boardConfiguration->injectionPins[2] = GPIOB_9; // GRN engineConfiguration->injectionPins[2] = GPIOB_9; // GRN
boardConfiguration->injectionPins[3] = GPIOD_5; // WHT engineConfiguration->injectionPins[3] = GPIOD_5; // WHT
boardConfiguration->injectionPins[4] = GPIOD_3; // RED engineConfiguration->injectionPins[4] = GPIOD_3; // RED
boardConfiguration->injectionPins[5] = GPIOE_2; // ORG engineConfiguration->injectionPins[5] = GPIOE_2; // ORG
boardConfiguration->injectionPins[6] = GPIOE_3; // BLU engineConfiguration->injectionPins[6] = GPIOE_3; // BLU
boardConfiguration->injectionPins[7] = GPIOE_4; // BLK engineConfiguration->injectionPins[7] = GPIOE_4; // BLK
boardConfiguration->injectionPins[8] = GPIOE_5; // GRN engineConfiguration->injectionPins[8] = GPIOE_5; // GRN
boardConfiguration->injectionPins[9] = GPIOE_6; // WHT engineConfiguration->injectionPins[9] = GPIOE_6; // WHT
boardConfiguration->injectionPins[10] = GPIOC_13;//RED engineConfiguration->injectionPins[10] = GPIOC_13;//RED
boardConfiguration->injectionPins[11] = GPIOD_7;// ORG engineConfiguration->injectionPins[11] = GPIOD_7;// ORG
} }
// BMW_M73_M // BMW_M73_M
@ -155,10 +155,10 @@ GPIOA_6
*/ */
CONFIGB(fsioOutputPins)[7] = GPIO_UNASSIGNED; CONFIG(fsioOutputPins)[7] = GPIO_UNASSIGNED;
boardConfiguration->fuelPumpPin = GPIO_UNASSIGNED; engineConfiguration->fuelPumpPin = GPIO_UNASSIGNED;
boardConfiguration->idle.solenoidPin = GPIO_UNASSIGNED; engineConfiguration->idle.solenoidPin = GPIO_UNASSIGNED;
boardConfiguration->fanPin = GPIO_UNASSIGNED; engineConfiguration->fanPin = GPIO_UNASSIGNED;
/** /**
* Yellow op-amp board * Yellow op-amp board
@ -194,19 +194,19 @@ GPIOA_6
engineConfiguration->etbIo[1].directionPin2 = GPIOB_9; engineConfiguration->etbIo[1].directionPin2 = GPIOB_9;
boardConfiguration->injectionPins[0] = GPIO_UNASSIGNED; engineConfiguration->injectionPins[0] = GPIO_UNASSIGNED;
boardConfiguration->injectionPins[1] = GPIO_UNASSIGNED; engineConfiguration->injectionPins[1] = GPIO_UNASSIGNED;
boardConfiguration->injectionPins[2] = GPIO_UNASSIGNED; engineConfiguration->injectionPins[2] = GPIO_UNASSIGNED;
boardConfiguration->injectionPins[3] = GPIO_UNASSIGNED; engineConfiguration->injectionPins[3] = GPIO_UNASSIGNED;
boardConfiguration->injectionPins[4] = GPIO_UNASSIGNED; engineConfiguration->injectionPins[4] = GPIO_UNASSIGNED;
boardConfiguration->injectionPins[5] = GPIO_UNASSIGNED; engineConfiguration->injectionPins[5] = GPIO_UNASSIGNED;
boardConfiguration->injectionPins[6] = GPIO_UNASSIGNED; engineConfiguration->injectionPins[6] = GPIO_UNASSIGNED;
boardConfiguration->injectionPins[7] = GPIO_UNASSIGNED; engineConfiguration->injectionPins[7] = GPIO_UNASSIGNED;
boardConfiguration->injectionPins[8] = GPIO_UNASSIGNED; engineConfiguration->injectionPins[8] = GPIO_UNASSIGNED;
boardConfiguration->injectionPins[9] = GPIO_UNASSIGNED; engineConfiguration->injectionPins[9] = GPIO_UNASSIGNED;
boardConfiguration->injectionPins[10] = GPIO_UNASSIGNED; engineConfiguration->injectionPins[10] = GPIO_UNASSIGNED;
boardConfiguration->injectionPins[11] = GPIO_UNASSIGNED; engineConfiguration->injectionPins[11] = GPIO_UNASSIGNED;
} }

View File

@ -24,8 +24,8 @@ void setCamaro4(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
engineConfiguration->specs.cylindersCount = 8; engineConfiguration->specs.cylindersCount = 8;
engineConfiguration->specs.firingOrder = FO_1_8_7_2_6_5_4_3; engineConfiguration->specs.firingOrder = FO_1_8_7_2_6_5_4_3;
boardConfiguration->triggerInputPins[0] = GPIOA_5; engineConfiguration->triggerInputPins[0] = GPIOA_5;
boardConfiguration->triggerInputPins[1] = GPIOC_6; engineConfiguration->triggerInputPins[1] = GPIOC_6;
engineConfiguration->injectionMode = IM_BATCH; engineConfiguration->injectionMode = IM_BATCH;
engineConfiguration->twoWireBatchInjection = true; engineConfiguration->twoWireBatchInjection = true;
@ -56,31 +56,31 @@ void setCamaro4(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
engineConfiguration->afr.hwChannel = EFI_ADC_13; engineConfiguration->afr.hwChannel = EFI_ADC_13;
boardConfiguration->idle.solenoidPin = GPIO_UNASSIGNED; engineConfiguration->idle.solenoidPin = GPIO_UNASSIGNED;
boardConfiguration->fuelPumpPin = GPIO_UNASSIGNED; engineConfiguration->fuelPumpPin = GPIO_UNASSIGNED;
boardConfiguration->injectionPins[0] = GPIOE_6; engineConfiguration->injectionPins[0] = GPIOE_6;
boardConfiguration->injectionPins[1] = GPIOE_5; engineConfiguration->injectionPins[1] = GPIOE_5;
boardConfiguration->injectionPins[2] = GPIOD_7; engineConfiguration->injectionPins[2] = GPIOD_7;
boardConfiguration->injectionPins[3] = GPIOC_13; engineConfiguration->injectionPins[3] = GPIOC_13;
boardConfiguration->injectionPins[4] = GPIOE_3; engineConfiguration->injectionPins[4] = GPIOE_3;
boardConfiguration->injectionPins[5] = GPIOE_4; engineConfiguration->injectionPins[5] = GPIOE_4;
boardConfiguration->injectionPins[6] = GPIOD_3; engineConfiguration->injectionPins[6] = GPIOD_3;
boardConfiguration->injectionPins[7] = GPIOE_2; engineConfiguration->injectionPins[7] = GPIOE_2;
boardConfiguration->ignitionPins[0] = GPIOC_9; engineConfiguration->ignitionPins[0] = GPIOC_9;
boardConfiguration->ignitionPins[1] = GPIOC_7; engineConfiguration->ignitionPins[1] = GPIOC_7;
boardConfiguration->ignitionPins[2] = GPIOE_14; engineConfiguration->ignitionPins[2] = GPIOE_14;
boardConfiguration->ignitionPins[3] = GPIOE_12; engineConfiguration->ignitionPins[3] = GPIOE_12;
boardConfiguration->ignitionPins[4] = GPIOE_10; engineConfiguration->ignitionPins[4] = GPIOE_10;
boardConfiguration->ignitionPins[5] = GPIOE_8; engineConfiguration->ignitionPins[5] = GPIOE_8;
boardConfiguration->ignitionPins[6] = GPIOD_9; engineConfiguration->ignitionPins[6] = GPIOD_9;
boardConfiguration->ignitionPins[7] = GPIOD_8; engineConfiguration->ignitionPins[7] = GPIOD_8;
boardConfiguration->fuelPumpPin = GPIOB_8; engineConfiguration->fuelPumpPin = GPIOB_8;
boardConfiguration->fanPin = GPIO_UNASSIGNED; engineConfiguration->fanPin = GPIO_UNASSIGNED;
boardConfiguration->mainRelayPin = GPIOD_5; engineConfiguration->mainRelayPin = GPIOD_5;
} }

View File

@ -14,13 +14,13 @@
#include "citroenBerlingoTU3JP.h" #include "citroenBerlingoTU3JP.h"
#include "settings.h" #include "settings.h"
void setLCD(board_configuration_s *boardConfiguration) { void setLCD(engine_configuration_s *engineConfiguration) {
boardConfiguration->HD44780_rs = GPIOE_7; engineConfiguration->HD44780_rs = GPIOE_7;
boardConfiguration->HD44780_e = GPIOE_9; engineConfiguration->HD44780_e = GPIOE_9;
boardConfiguration->HD44780_db4 = GPIOE_11; engineConfiguration->HD44780_db4 = GPIOE_11;
boardConfiguration->HD44780_db5 = GPIOE_13; engineConfiguration->HD44780_db5 = GPIOE_13;
boardConfiguration->HD44780_db6 = GPIOE_15; engineConfiguration->HD44780_db6 = GPIOE_15;
boardConfiguration->HD44780_db7 = GPIOB_10; engineConfiguration->HD44780_db7 = GPIOB_10;
} }
#if DEFAULT_FUEL_LOAD_COUNT == FUEL_LOAD_COUNT #if DEFAULT_FUEL_LOAD_COUNT == FUEL_LOAD_COUNT
@ -117,35 +117,35 @@ void setCitroenBerlingoTU3JPConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
// Frankenstein lo-side output #11: PB8 Main relay // Frankenstein lo-side output #11: PB8 Main relay
// Frankenstein lo-side output #12: PB9 Fuel pump // Frankenstein lo-side output #12: PB9 Fuel pump
boardConfiguration->ignitionPins[0] = GPIOC_14; engineConfiguration->ignitionPins[0] = GPIOC_14;
boardConfiguration->ignitionPins[1] = GPIO_UNASSIGNED; engineConfiguration->ignitionPins[1] = GPIO_UNASSIGNED;
boardConfiguration->ignitionPins[2] = GPIOC_15; engineConfiguration->ignitionPins[2] = GPIOC_15;
boardConfiguration->ignitionPins[3] = GPIO_UNASSIGNED; engineConfiguration->ignitionPins[3] = GPIO_UNASSIGNED;
engineConfiguration->injector.flow = 137; //SIEMENS DEKA VAZ20734 engineConfiguration->injector.flow = 137; //SIEMENS DEKA VAZ20734
boardConfiguration->injectionPins[0] = GPIOE_6; engineConfiguration->injectionPins[0] = GPIOE_6;
boardConfiguration->injectionPins[1] = GPIOC_13; engineConfiguration->injectionPins[1] = GPIOC_13;
boardConfiguration->injectionPins[2] = GPIO_UNASSIGNED; engineConfiguration->injectionPins[2] = GPIO_UNASSIGNED;
boardConfiguration->injectionPins[3] = GPIO_UNASSIGNED; engineConfiguration->injectionPins[3] = GPIO_UNASSIGNED;
boardConfiguration->fanPin = GPIOE_0; engineConfiguration->fanPin = GPIOE_0;
boardConfiguration->fanPinMode = OM_DEFAULT; engineConfiguration->fanPinMode = OM_DEFAULT;
engineConfiguration->fanOffTemperature = 95; engineConfiguration->fanOffTemperature = 95;
engineConfiguration->fanOnTemperature = 99; engineConfiguration->fanOnTemperature = 99;
boardConfiguration->malfunctionIndicatorPin = GPIOE_1; engineConfiguration->malfunctionIndicatorPin = GPIOE_1;
boardConfiguration->malfunctionIndicatorPinMode = OM_DEFAULT; engineConfiguration->malfunctionIndicatorPinMode = OM_DEFAULT;
boardConfiguration->mainRelayPin = GPIOB_8; engineConfiguration->mainRelayPin = GPIOB_8;
boardConfiguration->fuelPumpPin = GPIOB_9; engineConfiguration->fuelPumpPin = GPIOB_9;
boardConfiguration->fuelPumpPinMode = OM_DEFAULT; engineConfiguration->fuelPumpPinMode = OM_DEFAULT;
setLCD(boardConfiguration); setLCD(engineConfiguration);
// boardConfiguration->o2heaterPin = GPIOC_13; // engineConfiguration->o2heaterPin = GPIOC_13;
// boardConfiguration->logicAnalyzerPins[1] = GPIO_UNASSIGNED; // engineConfiguration->logicAnalyzerPins[1] = GPIO_UNASSIGNED;
/** /**
* Inputs * Inputs

View File

@ -65,22 +65,22 @@ void runSchedulingPrecisionTestIfNeeded(void) {
} }
#endif /* EFI_PROD_CODE */ #endif /* EFI_PROD_CODE */
void setFrankenso_01_LCD(board_configuration_s *boardConfiguration) { void setFrankenso_01_LCD(engine_configuration_s *engineConfiguration) {
boardConfiguration->HD44780_rs = GPIOE_7; engineConfiguration->HD44780_rs = GPIOE_7;
boardConfiguration->HD44780_e = GPIOE_9; engineConfiguration->HD44780_e = GPIOE_9;
boardConfiguration->HD44780_db4 = GPIOE_11; engineConfiguration->HD44780_db4 = GPIOE_11;
boardConfiguration->HD44780_db5 = GPIOE_13; engineConfiguration->HD44780_db5 = GPIOE_13;
boardConfiguration->HD44780_db6 = GPIOE_15; engineConfiguration->HD44780_db6 = GPIOE_15;
boardConfiguration->HD44780_db7 = GPIOB_10; engineConfiguration->HD44780_db7 = GPIOB_10;
} }
void disableLCD(board_configuration_s *boardConfiguration) { void disableLCD(engine_configuration_s *engineConfiguration) {
boardConfiguration->HD44780_rs = GPIO_UNASSIGNED; engineConfiguration->HD44780_rs = GPIO_UNASSIGNED;
boardConfiguration->HD44780_e = GPIO_UNASSIGNED; engineConfiguration->HD44780_e = GPIO_UNASSIGNED;
boardConfiguration->HD44780_db4 = GPIO_UNASSIGNED; engineConfiguration->HD44780_db4 = GPIO_UNASSIGNED;
boardConfiguration->HD44780_db5 = GPIO_UNASSIGNED; engineConfiguration->HD44780_db5 = GPIO_UNASSIGNED;
boardConfiguration->HD44780_db6 = GPIO_UNASSIGNED; engineConfiguration->HD44780_db6 = GPIO_UNASSIGNED;
boardConfiguration->HD44780_db7 = GPIO_UNASSIGNED; engineConfiguration->HD44780_db7 = GPIO_UNASSIGNED;
} }
// todo: should this be part of more default configurations? // todo: should this be part of more default configurations?
@ -88,7 +88,7 @@ void setFrankensoConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
setDefaultFrankensoConfiguration(PASS_CONFIG_PARAMETER_SIGNATURE); setDefaultFrankensoConfiguration(PASS_CONFIG_PARAMETER_SIGNATURE);
engineConfiguration->trigger.type = TT_ONE_PLUS_ONE; engineConfiguration->trigger.type = TT_ONE_PLUS_ONE;
setFrankenso_01_LCD(boardConfiguration); setFrankenso_01_LCD(engineConfiguration);
engineConfiguration->displayMode = DM_HD44780; engineConfiguration->displayMode = DM_HD44780;
commonFrankensoAnalogInputs(engineConfiguration); commonFrankensoAnalogInputs(engineConfiguration);
setFrankenso0_1_joystick(engineConfiguration); setFrankenso0_1_joystick(engineConfiguration);
@ -135,32 +135,32 @@ void setFrankensoConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
// Frankenso low out #11: PB8 injector #3 // Frankenso low out #11: PB8 injector #3
// Frankenso low out #12: PB7 injector #4 // Frankenso low out #12: PB7 injector #4
boardConfiguration->fuelPumpPin = GPIOE_4; engineConfiguration->fuelPumpPin = GPIOE_4;
boardConfiguration->mainRelayPin = GPIOD_7; engineConfiguration->mainRelayPin = GPIOD_7;
boardConfiguration->idle.solenoidPin = GPIOC_13; engineConfiguration->idle.solenoidPin = GPIOC_13;
boardConfiguration->fanPin = GPIOE_5; engineConfiguration->fanPin = GPIOE_5;
boardConfiguration->injectionPins[0] = GPIOB_9; // #1 engineConfiguration->injectionPins[0] = GPIOB_9; // #1
boardConfiguration->injectionPins[1] = GPIOE_2; // #2 engineConfiguration->injectionPins[1] = GPIOE_2; // #2
boardConfiguration->injectionPins[2] = GPIOB_8; // #3 engineConfiguration->injectionPins[2] = GPIOB_8; // #3
#ifndef EFI_INJECTOR_PIN3 #ifndef EFI_INJECTOR_PIN3
boardConfiguration->injectionPins[3] = GPIOB_7; // #4 engineConfiguration->injectionPins[3] = GPIOB_7; // #4
#else /* EFI_INJECTOR_PIN3 */ #else /* EFI_INJECTOR_PIN3 */
boardConfiguration->injectionPins[3] = EFI_INJECTOR_PIN3; // #4 engineConfiguration->injectionPins[3] = EFI_INJECTOR_PIN3; // #4
#endif /* EFI_INJECTOR_PIN3 */ #endif /* EFI_INJECTOR_PIN3 */
setAlgorithm(LM_SPEED_DENSITY PASS_CONFIG_PARAMETER_SUFFIX); setAlgorithm(LM_SPEED_DENSITY PASS_CONFIG_PARAMETER_SUFFIX);
#if EFI_PWM_TESTER #if EFI_PWM_TESTER
boardConfiguration->injectionPins[4] = GPIOC_8; // #5 engineConfiguration->injectionPins[4] = GPIOC_8; // #5
boardConfiguration->injectionPins[5] = GPIOD_10; // #6 engineConfiguration->injectionPins[5] = GPIOD_10; // #6
boardConfiguration->injectionPins[6] = GPIOD_9; engineConfiguration->injectionPins[6] = GPIOD_9;
boardConfiguration->injectionPins[7] = GPIOD_11; engineConfiguration->injectionPins[7] = GPIOD_11;
boardConfiguration->injectionPins[8] = GPIOD_0; engineConfiguration->injectionPins[8] = GPIOD_0;
boardConfiguration->injectionPins[9] = GPIOB_11; engineConfiguration->injectionPins[9] = GPIOB_11;
boardConfiguration->injectionPins[10] = GPIOC_7; engineConfiguration->injectionPins[10] = GPIOC_7;
boardConfiguration->injectionPins[11] = GPIOE_4; engineConfiguration->injectionPins[11] = GPIOE_4;
/** /**
* We want to initialize all outputs for test * We want to initialize all outputs for test
@ -169,20 +169,20 @@ void setFrankensoConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
engineConfiguration->displayMode = DM_NONE; engineConfiguration->displayMode = DM_NONE;
#else /* EFI_PWM_TESTER */ #else /* EFI_PWM_TESTER */
boardConfiguration->injectionPins[4] = GPIO_UNASSIGNED; engineConfiguration->injectionPins[4] = GPIO_UNASSIGNED;
boardConfiguration->injectionPins[5] = GPIO_UNASSIGNED; engineConfiguration->injectionPins[5] = GPIO_UNASSIGNED;
boardConfiguration->injectionPins[6] = GPIO_UNASSIGNED; engineConfiguration->injectionPins[6] = GPIO_UNASSIGNED;
boardConfiguration->injectionPins[7] = GPIO_UNASSIGNED; engineConfiguration->injectionPins[7] = GPIO_UNASSIGNED;
boardConfiguration->injectionPins[8] = GPIO_UNASSIGNED; engineConfiguration->injectionPins[8] = GPIO_UNASSIGNED;
boardConfiguration->injectionPins[9] = GPIO_UNASSIGNED; engineConfiguration->injectionPins[9] = GPIO_UNASSIGNED;
boardConfiguration->injectionPins[10] = GPIO_UNASSIGNED; engineConfiguration->injectionPins[10] = GPIO_UNASSIGNED;
boardConfiguration->injectionPins[11] = GPIO_UNASSIGNED; engineConfiguration->injectionPins[11] = GPIO_UNASSIGNED;
boardConfiguration->ignitionPins[0] = GPIOE_14; engineConfiguration->ignitionPins[0] = GPIOE_14;
boardConfiguration->ignitionPins[1] = GPIOC_7; engineConfiguration->ignitionPins[1] = GPIOC_7;
boardConfiguration->ignitionPins[2] = GPIOC_9; engineConfiguration->ignitionPins[2] = GPIOC_9;
// set_ignition_pin 4 PE10 // set_ignition_pin 4 PE10
boardConfiguration->ignitionPins[3] = GPIOE_10; engineConfiguration->ignitionPins[3] = GPIOE_10;
#endif /* EFI_PWM_TESTER */ #endif /* EFI_PWM_TESTER */
// todo: 8.2 or 10k? // todo: 8.2 or 10k?
@ -198,7 +198,7 @@ void setFrankensoBoardTestConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
engineConfiguration->directSelfStimulation = true; // this engine type is used for board validation engineConfiguration->directSelfStimulation = true; // this engine type is used for board validation
boardConfiguration->triggerSimulatorFrequency = 300; engineConfiguration->triggerSimulatorFrequency = 300;
engineConfiguration->cranking.rpm = 100; engineConfiguration->cranking.rpm = 100;
engineConfiguration->specs.cylindersCount = 12; engineConfiguration->specs.cylindersCount = 12;
@ -207,38 +207,38 @@ void setFrankensoBoardTestConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
// set ignition_mode 1 // set ignition_mode 1
engineConfiguration->ignitionMode = IM_INDIVIDUAL_COILS; engineConfiguration->ignitionMode = IM_INDIVIDUAL_COILS;
boardConfiguration->injectionPins[0] = GPIOB_7; // injector in default pinout engineConfiguration->injectionPins[0] = GPIOB_7; // injector in default pinout
boardConfiguration->injectionPins[1] = GPIOB_8; // injector in default pinout engineConfiguration->injectionPins[1] = GPIOB_8; // injector in default pinout
boardConfiguration->injectionPins[2] = GPIOB_9; // injector in default pinout engineConfiguration->injectionPins[2] = GPIOB_9; // injector in default pinout
boardConfiguration->injectionPins[3] = GPIOC_13; engineConfiguration->injectionPins[3] = GPIOC_13;
boardConfiguration->injectionPins[4] = GPIOD_3; engineConfiguration->injectionPins[4] = GPIOD_3;
boardConfiguration->injectionPins[5] = GPIOD_5; engineConfiguration->injectionPins[5] = GPIOD_5;
boardConfiguration->injectionPins[6] = GPIOD_7; engineConfiguration->injectionPins[6] = GPIOD_7;
boardConfiguration->injectionPins[7] = GPIOE_2; // injector in default pinout engineConfiguration->injectionPins[7] = GPIOE_2; // injector in default pinout
boardConfiguration->injectionPins[8] = GPIOE_3; engineConfiguration->injectionPins[8] = GPIOE_3;
boardConfiguration->injectionPins[9] = GPIOE_4; engineConfiguration->injectionPins[9] = GPIOE_4;
boardConfiguration->injectionPins[10] = GPIOE_5; engineConfiguration->injectionPins[10] = GPIOE_5;
boardConfiguration->injectionPins[11] = GPIOE_6; engineConfiguration->injectionPins[11] = GPIOE_6;
boardConfiguration->fuelPumpPin = GPIO_UNASSIGNED; engineConfiguration->fuelPumpPin = GPIO_UNASSIGNED;
boardConfiguration->mainRelayPin = GPIO_UNASSIGNED; engineConfiguration->mainRelayPin = GPIO_UNASSIGNED;
boardConfiguration->idle.solenoidPin = GPIO_UNASSIGNED; engineConfiguration->idle.solenoidPin = GPIO_UNASSIGNED;
boardConfiguration->fanPin = GPIO_UNASSIGNED; engineConfiguration->fanPin = GPIO_UNASSIGNED;
boardConfiguration->ignitionPins[0] = GPIOC_9; // coil in default pinout engineConfiguration->ignitionPins[0] = GPIOC_9; // coil in default pinout
boardConfiguration->ignitionPins[1] = GPIOC_7; // coil in default pinout engineConfiguration->ignitionPins[1] = GPIOC_7; // coil in default pinout
boardConfiguration->ignitionPins[2] = GPIOE_10; // coil in default pinout engineConfiguration->ignitionPins[2] = GPIOE_10; // coil in default pinout
boardConfiguration->ignitionPins[3] = GPIOE_8; // Miata VVT tach engineConfiguration->ignitionPins[3] = GPIOE_8; // Miata VVT tach
boardConfiguration->ignitionPins[4] = GPIOE_14; // coil in default pinout engineConfiguration->ignitionPins[4] = GPIOE_14; // coil in default pinout
boardConfiguration->ignitionPins[5] = GPIOE_12; engineConfiguration->ignitionPins[5] = GPIOE_12;
boardConfiguration->ignitionPins[6] = GPIOD_8; engineConfiguration->ignitionPins[6] = GPIOD_8;
boardConfiguration->ignitionPins[7] = GPIOD_9; engineConfiguration->ignitionPins[7] = GPIOD_9;
boardConfiguration->ignitionPins[8] = GPIOE_0; // brain board, not discovery engineConfiguration->ignitionPins[8] = GPIOE_0; // brain board, not discovery
boardConfiguration->ignitionPins[9] = GPIOE_1; // brain board, not discovery engineConfiguration->ignitionPins[9] = GPIOE_1; // brain board, not discovery
} }
@ -260,10 +260,10 @@ void setEtbTestConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
engineConfiguration->trigger.type = TT_TOOTHED_WHEEL_60_2; engineConfiguration->trigger.type = TT_TOOTHED_WHEEL_60_2;
boardConfiguration->ignitionPins[0] = GPIO_UNASSIGNED; engineConfiguration->ignitionPins[0] = GPIO_UNASSIGNED;
boardConfiguration->ignitionPins[1] = GPIO_UNASSIGNED; engineConfiguration->ignitionPins[1] = GPIO_UNASSIGNED;
boardConfiguration->ignitionPins[2] = GPIO_UNASSIGNED; engineConfiguration->ignitionPins[2] = GPIO_UNASSIGNED;
boardConfiguration->ignitionPins[3] = GPIO_UNASSIGNED; engineConfiguration->ignitionPins[3] = GPIO_UNASSIGNED;
/** /**
* remember that some H-bridges require 5v control lines, not just 3v logic outputs we have on stm32 * remember that some H-bridges require 5v control lines, not just 3v logic outputs we have on stm32
*/ */
@ -282,11 +282,11 @@ void setEtbTestConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
engineConfiguration->debugMode = DBG_ELECTRONIC_THROTTLE_PID; engineConfiguration->debugMode = DBG_ELECTRONIC_THROTTLE_PID;
// turning off other PWMs to simplify debugging // turning off other PWMs to simplify debugging
engineConfiguration->bc.triggerSimulatorFrequency = 0; engineConfiguration->triggerSimulatorFrequency = 0;
engineConfiguration->stepperEnablePin = GPIO_UNASSIGNED; engineConfiguration->stepperEnablePin = GPIO_UNASSIGNED;
CONFIGB(idle).stepperStepPin = GPIO_UNASSIGNED; CONFIG(idle).stepperStepPin = GPIO_UNASSIGNED;
CONFIGB(idle).stepperDirectionPin = GPIO_UNASSIGNED; CONFIG(idle).stepperDirectionPin = GPIO_UNASSIGNED;
boardConfiguration->useStepperIdle = true; engineConfiguration->useStepperIdle = true;
// no analog dividers - all sensors with 3v supply, naked discovery bench setup // no analog dividers - all sensors with 3v supply, naked discovery bench setup
engineConfiguration->analogInputDividerCoefficient = 1; engineConfiguration->analogInputDividerCoefficient = 1;
@ -313,28 +313,28 @@ void setTle8888TestConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
engineConfiguration->directSelfStimulation = true; engineConfiguration->directSelfStimulation = true;
#if defined(STM32_HAS_GPIOG) && STM32_HAS_GPIOG #if defined(STM32_HAS_GPIOG) && STM32_HAS_GPIOG
boardConfiguration->ignitionPins[0] = GPIOG_3; engineConfiguration->ignitionPins[0] = GPIOG_3;
boardConfiguration->ignitionPins[1] = GPIOG_4; engineConfiguration->ignitionPins[1] = GPIOG_4;
boardConfiguration->ignitionPins[2] = GPIOG_5; engineConfiguration->ignitionPins[2] = GPIOG_5;
boardConfiguration->ignitionPins[3] = GPIOG_6; engineConfiguration->ignitionPins[3] = GPIOG_6;
boardConfiguration->ignitionPins[4] = GPIOG_7; engineConfiguration->ignitionPins[4] = GPIOG_7;
boardConfiguration->ignitionPins[5] = GPIOG_8; engineConfiguration->ignitionPins[5] = GPIOG_8;
#endif /* STM32_HAS_GPIOG */ #endif /* STM32_HAS_GPIOG */
boardConfiguration->ignitionPins[6] = GPIOC_6; engineConfiguration->ignitionPins[6] = GPIOC_6;
boardConfiguration->ignitionPins[7] = GPIOC_7; engineConfiguration->ignitionPins[7] = GPIOC_7;
#if (BOARD_TLE8888_COUNT > 0) #if (BOARD_TLE8888_COUNT > 0)
engineConfiguration->tle8888spiDevice = SPI_DEVICE_1; engineConfiguration->tle8888spiDevice = SPI_DEVICE_1;
engineConfiguration->tle8888_cs = GPIOD_5; engineConfiguration->tle8888_cs = GPIOD_5;
// PB3 is nicely both SWO and SPI1 SCK so logic analyzer could be used on SWO header // PB3 is nicely both SWO and SPI1 SCK so logic analyzer could be used on SWO header
boardConfiguration->spi1mosiPin = GPIOB_5; engineConfiguration->spi1mosiPin = GPIOB_5;
boardConfiguration->spi1misoPin = GPIOB_4; engineConfiguration->spi1misoPin = GPIOB_4;
boardConfiguration->spi1sckPin = GPIOB_3; // please note that this pin is also SWO/SWD - Single Wire debug Output engineConfiguration->spi1sckPin = GPIOB_3; // please note that this pin is also SWO/SWD - Single Wire debug Output
boardConfiguration->is_enabled_spi_1 = true; engineConfiguration->is_enabled_spi_1 = true;
engineConfiguration->debugMode = DBG_TLE8888; engineConfiguration->debugMode = DBG_TLE8888;
boardConfiguration->fuelPumpPin = TLE8888_PIN_20; engineConfiguration->fuelPumpPin = TLE8888_PIN_20;
#endif /* BOARD_TLE8888_COUNT */ #endif /* BOARD_TLE8888_COUNT */
engineConfiguration->throttlePedalPositionAdcChannel = EFI_ADC_9; // PB1 // just any non-empty value for now engineConfiguration->throttlePedalPositionAdcChannel = EFI_ADC_9; // PB1 // just any non-empty value for now
@ -353,7 +353,7 @@ void setTle8888TestConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
CONFIG(etbIo[0].directionPin2) = GPIOF_14; CONFIG(etbIo[0].directionPin2) = GPIOF_14;
#endif /* STM32_HAS_GPIOF */ #endif /* STM32_HAS_GPIOF */
CONFIG(etb_use_two_wires) = true; CONFIG(etb_use_two_wires) = true;
boardConfiguration->isHip9011Enabled = false; engineConfiguration->isHip9011Enabled = false;
// ETB #2 // ETB #2
// DIS PE5 // DIS PE5
@ -400,7 +400,7 @@ void mreBoardTest(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
#if (BOARD_TLE8888_COUNT > 0) #if (BOARD_TLE8888_COUNT > 0)
engineConfiguration->directSelfStimulation = true; // this engine type is used for board validation engineConfiguration->directSelfStimulation = true; // this engine type is used for board validation
boardConfiguration->triggerSimulatorFrequency = 60; engineConfiguration->triggerSimulatorFrequency = 60;
// set cranking_rpm 500 // set cranking_rpm 500
engineConfiguration->cranking.rpm = 100; engineConfiguration->cranking.rpm = 100;
// set cranking_dwell 200 // set cranking_dwell 200
@ -447,64 +447,64 @@ void mreBoardTest(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
engineConfiguration->specs.firingOrder = FO_1_10_9_4_3_6_5_8_7_2; engineConfiguration->specs.firingOrder = FO_1_10_9_4_3_6_5_8_7_2;
// red LED #1 // red LED #1
boardConfiguration->ignitionPins[1 - 1] = GPIOD_4; engineConfiguration->ignitionPins[1 - 1] = GPIOD_4;
boardConfiguration->ignitionPins[10 - 1] = GPIOD_3; engineConfiguration->ignitionPins[10 - 1] = GPIOD_3;
boardConfiguration->ignitionPins[9 - 1] = GPIOD_6; engineConfiguration->ignitionPins[9 - 1] = GPIOD_6;
boardConfiguration->ignitionPins[4 - 1] = GPIOD_7; engineConfiguration->ignitionPins[4 - 1] = GPIOD_7;
boardConfiguration->ignitionPins[3 - 1] = GPIOD_1; engineConfiguration->ignitionPins[3 - 1] = GPIOD_1;
boardConfiguration->ignitionPins[6 - 1] = GPIOD_2; engineConfiguration->ignitionPins[6 - 1] = GPIOD_2;
boardConfiguration->ignitionPins[1] = GPIO_UNASSIGNED; engineConfiguration->ignitionPins[1] = GPIO_UNASSIGNED;
boardConfiguration->ignitionPins[4] = GPIO_UNASSIGNED; engineConfiguration->ignitionPins[4] = GPIO_UNASSIGNED;
boardConfiguration->ignitionPins[6] = GPIO_UNASSIGNED; engineConfiguration->ignitionPins[6] = GPIO_UNASSIGNED;
boardConfiguration->ignitionPins[7] = GPIO_UNASSIGNED; engineConfiguration->ignitionPins[7] = GPIO_UNASSIGNED;
boardConfiguration->fuelPumpPin = GPIO_UNASSIGNED; engineConfiguration->fuelPumpPin = GPIO_UNASSIGNED;
boardConfiguration->idle.solenoidPin = GPIO_UNASSIGNED; engineConfiguration->idle.solenoidPin = GPIO_UNASSIGNED;
boardConfiguration->fanPin = GPIO_UNASSIGNED; engineConfiguration->fanPin = GPIO_UNASSIGNED;
// fuel pump is useful to test power on/off scenario // fuel pump is useful to test power on/off scenario
// boardConfiguration->fuelPumpPin = TLE8888_PIN_22; // engineConfiguration->fuelPumpPin = TLE8888_PIN_22;
// LED #1 // LED #1
// GPIOE_7: "34 - GP Out 2" // GPIOE_7: "34 - GP Out 2"
boardConfiguration->injectionPins[1 - 1] = TLE8888_PIN_22;//GPIOE_7; engineConfiguration->injectionPins[1 - 1] = TLE8888_PIN_22;//GPIOE_7;
// LED #2 // LED #2
// TLE8888_PIN_23: "33 - GP Out 3" // TLE8888_PIN_23: "33 - GP Out 3"
boardConfiguration->injectionPins[10 - 1] = TLE8888_PIN_23; engineConfiguration->injectionPins[10 - 1] = TLE8888_PIN_23;
// LED #3 - INJ#1 // LED #3 - INJ#1
boardConfiguration->injectionPins[9 - 1] = GPIOE_13; engineConfiguration->injectionPins[9 - 1] = GPIOE_13;
// LED #4 - INJ#2 // LED #4 - INJ#2
boardConfiguration->injectionPins[4 - 1] = GPIOE_14; engineConfiguration->injectionPins[4 - 1] = GPIOE_14;
// LED #5 - INJ#3 // LED #5 - INJ#3
boardConfiguration->injectionPins[3 - 1] = GPIOE_12; engineConfiguration->injectionPins[3 - 1] = GPIOE_12;
// LED #6 - INJ#4 // LED #6 - INJ#4
boardConfiguration->injectionPins[6 - 1] = GPIOE_11; engineConfiguration->injectionPins[6 - 1] = GPIOE_11;
// LED #7 // LED #7
// TLE8888_PIN_24: "43 - GP Out 4" // TLE8888_PIN_24: "43 - GP Out 4"
boardConfiguration->injectionPins[5 - 1] = TLE8888_PIN_24; engineConfiguration->injectionPins[5 - 1] = TLE8888_PIN_24;
// LED #8 // LED #8
// TLE8888 half bridges (pushpull, lowside, or high-low) IN12 // TLE8888 half bridges (pushpull, lowside, or high-low) IN12
// GPIOE_8: "35 - GP Out 1" // GPIOE_8: "35 - GP Out 1"
boardConfiguration->injectionPins[8 - 1] = GPIOE_8; engineConfiguration->injectionPins[8 - 1] = GPIOE_8;
// LED #9 // LED #9
// TLE8888 high current low side: IN10 // TLE8888 high current low side: IN10
// GPIOE_9: "7 - Lowside 1" // GPIOE_9: "7 - Lowside 1"
boardConfiguration->injectionPins[7 - 1] = GPIOE_9; engineConfiguration->injectionPins[7 - 1] = GPIOE_9;
// LED #10 // LED #10
// TLE8888 high current low side: VVT2 IN9 / OUT5 // TLE8888 high current low side: VVT2 IN9 / OUT5
// GPIOE_10: "3 - Lowside 2" // GPIOE_10: "3 - Lowside 2"
boardConfiguration->injectionPins[2 - 1] = GPIOE_10; engineConfiguration->injectionPins[2 - 1] = GPIOE_10;
#endif /* BOARD_TLE8888_COUNT */ #endif /* BOARD_TLE8888_COUNT */
} }

View File

@ -10,8 +10,8 @@
#include "engine_configuration.h" #include "engine_configuration.h"
void setFrankensoConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE); void setFrankensoConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE);
void setFrankenso_01_LCD(board_configuration_s *boardConfiguration); void setFrankenso_01_LCD(engine_configuration_s *engineConfiguration);
void disableLCD(board_configuration_s *boardConfiguration); void disableLCD(engine_configuration_s *engineConfiguration);
void runSchedulingPrecisionTestIfNeeded(void); void runSchedulingPrecisionTestIfNeeded(void);
void setFrankensoBoardTestConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE); void setFrankensoBoardTestConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE);
void setEtbTestConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE); void setEtbTestConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE);

View File

@ -155,12 +155,12 @@ void setDodgeNeon1995EngineConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
// engineConfiguration->spi2MosiMode = PAL_STM32_OTYPE_OPENDRAIN; // 4 // engineConfiguration->spi2MosiMode = PAL_STM32_OTYPE_OPENDRAIN; // 4
// engineConfiguration->spi2MisoMode = PAL_STM32_PUDR_PULLUP; // 32 // engineConfiguration->spi2MisoMode = PAL_STM32_PUDR_PULLUP; // 32
// boardConfiguration->spi2mosiPin = GPIOB_15; // engineConfiguration->spi2mosiPin = GPIOB_15;
// boardConfiguration->spi2misoPin = GPIOB_14; // engineConfiguration->spi2misoPin = GPIOB_14;
// boardConfiguration->spi2sckPin = GPIOB_13; // engineConfiguration->spi2sckPin = GPIOB_13;
boardConfiguration->cj125CsPin = GPIOB_0; // rev 0.4 engineConfiguration->cj125CsPin = GPIOB_0; // rev 0.4
boardConfiguration->isCJ125Enabled = true; engineConfiguration->isCJ125Enabled = true;
boardConfiguration->is_enabled_spi_2 = true; engineConfiguration->is_enabled_spi_2 = true;
// set_rpm_hard_limit 4000 // set_rpm_hard_limit 4000
@ -222,28 +222,28 @@ void setDodgeNeon1995EngineConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
// Frankenstein: low side - out #11: PB8 // Frankenstein: low side - out #11: PB8
// Frankenstein: low side - out #12: PB9 // Frankenstein: low side - out #12: PB9
boardConfiguration->injectionPins[0] = GPIOB_9; // Frankenstein: low side - out #12 engineConfiguration->injectionPins[0] = GPIOB_9; // Frankenstein: low side - out #12
boardConfiguration->injectionPins[1] = GPIOB_8; // Frankenstein: low side - out #11 engineConfiguration->injectionPins[1] = GPIOB_8; // Frankenstein: low side - out #11
boardConfiguration->injectionPins[2] = GPIOE_3; // Frankenstein: low side - out #8 engineConfiguration->injectionPins[2] = GPIOE_3; // Frankenstein: low side - out #8
boardConfiguration->injectionPins[3] = GPIOE_5; // Frankenstein: low side - out #6 engineConfiguration->injectionPins[3] = GPIOE_5; // Frankenstein: low side - out #6
boardConfiguration->fuelPumpPin = GPIOC_13; // Frankenstein: low side - out #4 engineConfiguration->fuelPumpPin = GPIOC_13; // Frankenstein: low side - out #4
boardConfiguration->fuelPumpPinMode = OM_DEFAULT; engineConfiguration->fuelPumpPinMode = OM_DEFAULT;
engineConfiguration->mapErrorDetectionTooHigh = 120; engineConfiguration->mapErrorDetectionTooHigh = 120;
// set injection_pin_mode 0 // set injection_pin_mode 0
boardConfiguration->injectionPinMode = OM_DEFAULT; engineConfiguration->injectionPinMode = OM_DEFAULT;
// Frankenstein: high side #1: PE8 // Frankenstein: high side #1: PE8
// Frankenstein: high side #2: PE10 // Frankenstein: high side #2: PE10
boardConfiguration->ignitionPins[0] = GPIOE_8; // Frankenstein: high side #1 engineConfiguration->ignitionPins[0] = GPIOE_8; // Frankenstein: high side #1
boardConfiguration->ignitionPins[1] = GPIO_UNASSIGNED; engineConfiguration->ignitionPins[1] = GPIO_UNASSIGNED;
boardConfiguration->ignitionPins[2] = GPIOE_10; // // Frankenstein: high side #2 engineConfiguration->ignitionPins[2] = GPIOE_10; // // Frankenstein: high side #2
// set ignition_pin_mode 0 // set ignition_pin_mode 0
boardConfiguration->ignitionPinMode = OM_DEFAULT; engineConfiguration->ignitionPinMode = OM_DEFAULT;
engineConfiguration->clt.config = {0, 30, 100, 32500, 7550, 700, 2700}; engineConfiguration->clt.config = {0, 30, 100, 32500, 7550, 700, 2700};
@ -253,7 +253,7 @@ void setDodgeNeon1995EngineConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
void setDodgeNeonNGCEngineConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE) { void setDodgeNeonNGCEngineConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
setDefaultFrankensoConfiguration(PASS_CONFIG_PARAMETER_SIGNATURE); setDefaultFrankensoConfiguration(PASS_CONFIG_PARAMETER_SIGNATURE);
engineConfiguration->trigger.type = TT_DODGE_NEON_2003_CAM; engineConfiguration->trigger.type = TT_DODGE_NEON_2003_CAM;
setFrankenso_01_LCD(boardConfiguration); setFrankenso_01_LCD(engineConfiguration);
setFrankenso0_1_joystick(engineConfiguration); setFrankenso0_1_joystick(engineConfiguration);
// set global_trigger_offset_angle 38 // set global_trigger_offset_angle 38
@ -316,7 +316,7 @@ void setDodgeNeonNGCEngineConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
setFuelTablesLoadBin(20, 120 PASS_CONFIG_PARAMETER_SUFFIX); setFuelTablesLoadBin(20, 120 PASS_CONFIG_PARAMETER_SUFFIX);
boardConfiguration->malfunctionIndicatorPin = GPIO_UNASSIGNED; engineConfiguration->malfunctionIndicatorPin = GPIO_UNASSIGNED;
/** /**
* PA4 Wideband O2 Sensor * PA4 Wideband O2 Sensor
@ -342,29 +342,29 @@ void setDodgeNeonNGCEngineConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
// Frankenso low out #11: PB8 injector #1 // Frankenso low out #11: PB8 injector #1
// Frankenso low out #12: PB7 injector #4 // Frankenso low out #12: PB7 injector #4
boardConfiguration->fanPin = GPIOD_7; engineConfiguration->fanPin = GPIOD_7;
boardConfiguration->injectionPins[0] = GPIOB_8; engineConfiguration->injectionPins[0] = GPIOB_8;
boardConfiguration->injectionPins[1] = GPIOB_9; engineConfiguration->injectionPins[1] = GPIOB_9;
boardConfiguration->injectionPins[2] = GPIOE_2; engineConfiguration->injectionPins[2] = GPIOE_2;
boardConfiguration->injectionPins[3] = GPIOB_7; engineConfiguration->injectionPins[3] = GPIOB_7;
boardConfiguration->ignitionPins[0] = GPIOC_9; engineConfiguration->ignitionPins[0] = GPIOC_9;
boardConfiguration->ignitionPins[1] = GPIO_UNASSIGNED; engineConfiguration->ignitionPins[1] = GPIO_UNASSIGNED;
boardConfiguration->ignitionPins[2] = GPIOE_8; engineConfiguration->ignitionPins[2] = GPIOE_8;
boardConfiguration->ignitionPins[3] = GPIO_UNASSIGNED; engineConfiguration->ignitionPins[3] = GPIO_UNASSIGNED;
boardConfiguration->mainRelayPin = GPIOE_6; engineConfiguration->mainRelayPin = GPIOE_6;
boardConfiguration->idle.solenoidPin = GPIOC_13; engineConfiguration->idle.solenoidPin = GPIOC_13;
boardConfiguration->idle.solenoidFrequency = 300; engineConfiguration->idle.solenoidFrequency = 300;
boardConfiguration->manIdlePosition = 36; engineConfiguration->manIdlePosition = 36;
boardConfiguration->fuelPumpPin = GPIOE_3; engineConfiguration->fuelPumpPin = GPIOE_3;
boardConfiguration->fuelPumpPinMode = OM_DEFAULT; engineConfiguration->fuelPumpPinMode = OM_DEFAULT;
boardConfiguration->triggerInputPins[0] = GPIOA_5; engineConfiguration->triggerInputPins[0] = GPIOA_5;
boardConfiguration->triggerInputPins[1] = GPIOC_6; engineConfiguration->triggerInputPins[1] = GPIOC_6;
/** /**
* Frankenso analog #1 PC2 ADC12 CLT * Frankenso analog #1 PC2 ADC12 CLT
@ -412,8 +412,8 @@ void setDodgeNeonNGCEngineConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
*/ */
engineConfiguration->clt.adcChannel = EFI_ADC_12; engineConfiguration->clt.adcChannel = EFI_ADC_12;
boardConfiguration->sensorChartMode = SC_MAP; engineConfiguration->sensorChartMode = SC_MAP;
boardConfiguration->isFastAdcEnabled = true; engineConfiguration->isFastAdcEnabled = true;
engineConfiguration->map.sensor.type = MT_DODGE_NEON_2003; engineConfiguration->map.sensor.type = MT_DODGE_NEON_2003;
engineConfiguration->hip9011Gain = 0.3; engineConfiguration->hip9011Gain = 0.3;
@ -432,8 +432,8 @@ void setDodgeNeonNGCEngineConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
engineConfiguration->cylinderBore = 87.5; engineConfiguration->cylinderBore = 87.5;
boardConfiguration->clutchDownPin = GPIOC_12; engineConfiguration->clutchDownPin = GPIOC_12;
boardConfiguration->clutchDownPinMode = PI_PULLUP; engineConfiguration->clutchDownPinMode = PI_PULLUP;
// engineConfiguration->clutchUpPin = GPIOA_14; // note SWCLK - conflict with SWD // engineConfiguration->clutchUpPin = GPIOA_14; // note SWCLK - conflict with SWD
engineConfiguration->clutchUpPinMode = PI_PULLUP; engineConfiguration->clutchUpPinMode = PI_PULLUP;
@ -452,7 +452,7 @@ void setDodgeNeonNGCEngineConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
// /** // /**
// * set_fsio_setting 1 0.55 // * set_fsio_setting 1 0.55
// */ // */
// boardConfiguration->fsio_setting[0] = 0.55; // engineConfiguration->fsio_setting[0] = 0.55;
// setFsioExt(0, GPIOE_5, "0 fsio_setting", 400 PASS_CONFIG_PARAMETER_SUFFIX); // setFsioExt(0, GPIOE_5, "0 fsio_setting", 400 PASS_CONFIG_PARAMETER_SUFFIX);
#endif #endif
@ -463,11 +463,11 @@ void setDodgeNeonNGCEngineConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
// engineConfiguration->fanOnTemperature = 115; // knock testing - value is a bit high // engineConfiguration->fanOnTemperature = 115; // knock testing - value is a bit high
// engineConfiguration->fanOffTemperature = 100; // engineConfiguration->fanOffTemperature = 100;
// boardConfiguration->tunerStudioSerialSpeed = 9600; // engineConfiguration->tunerStudioSerialSpeed = 9600;
boardConfiguration->tunerStudioSerialSpeed = 19200; engineConfiguration->tunerStudioSerialSpeed = 19200;
setAlgorithm(LM_SPEED_DENSITY PASS_CONFIG_PARAMETER_SUFFIX); setAlgorithm(LM_SPEED_DENSITY PASS_CONFIG_PARAMETER_SUFFIX);
//temp boardConfiguration->alternatorControlPin = GPIOD_5; //temp engineConfiguration->alternatorControlPin = GPIOD_5;
engineConfiguration->targetVBatt = 14.0; engineConfiguration->targetVBatt = 14.0;
engineConfiguration->alternatorControl.offset = 20; engineConfiguration->alternatorControl.offset = 20;
engineConfiguration->alternatorControl.pFactor = 20; engineConfiguration->alternatorControl.pFactor = 20;
@ -493,8 +493,8 @@ void setDodgeNeonNGCEngineConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
engineConfiguration->wwaeTau = 0; engineConfiguration->wwaeTau = 0;
engineConfiguration->wwaeBeta = 0; engineConfiguration->wwaeBeta = 0;
boardConfiguration->isSdCardEnabled = false; engineConfiguration->isSdCardEnabled = false;
boardConfiguration->manIdlePosition = 36; // set_idle_pwm 40 engineConfiguration->manIdlePosition = 36; // set_idle_pwm 40
engineConfiguration->slowAdcAlpha = 0.33333; engineConfiguration->slowAdcAlpha = 0.33333;

View File

@ -35,27 +35,27 @@ void setDodgeRam1996(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
engineConfiguration->specs.firingOrder = FO_1_8_4_3_6_5_7_2; engineConfiguration->specs.firingOrder = FO_1_8_4_3_6_5_7_2;
engineConfiguration->specs.displacement = 5.2; engineConfiguration->specs.displacement = 5.2;
boardConfiguration->triggerInputPins[0] = GPIOC_6; engineConfiguration->triggerInputPins[0] = GPIOC_6;
boardConfiguration->triggerInputPins[1] = GPIOA_5; engineConfiguration->triggerInputPins[1] = GPIOA_5;
boardConfiguration->injectionPins[0] = GPIOE_2; engineConfiguration->injectionPins[0] = GPIOE_2;
boardConfiguration->injectionPins[1] = GPIOB_9; engineConfiguration->injectionPins[1] = GPIOB_9;
boardConfiguration->injectionPins[2] = GPIOD_5; engineConfiguration->injectionPins[2] = GPIOD_5;
boardConfiguration->injectionPins[3] = GPIOB_8; engineConfiguration->injectionPins[3] = GPIOB_8;
boardConfiguration->injectionPins[4] = GPIOB_7; engineConfiguration->injectionPins[4] = GPIOB_7;
boardConfiguration->injectionPins[5] = GPIOE_3; engineConfiguration->injectionPins[5] = GPIOE_3;
boardConfiguration->injectionPins[6] = GPIOE_4; engineConfiguration->injectionPins[6] = GPIOE_4;
boardConfiguration->injectionPins[7] = GPIOD_3; engineConfiguration->injectionPins[7] = GPIOD_3;
boardConfiguration->ignitionPins[0] = GPIOC_9; engineConfiguration->ignitionPins[0] = GPIOC_9;
boardConfiguration->ignitionPins[1] = GPIO_UNASSIGNED; engineConfiguration->ignitionPins[1] = GPIO_UNASSIGNED;
boardConfiguration->ignitionPins[2] = GPIO_UNASSIGNED; engineConfiguration->ignitionPins[2] = GPIO_UNASSIGNED;
boardConfiguration->ignitionPins[3] = GPIO_UNASSIGNED; engineConfiguration->ignitionPins[3] = GPIO_UNASSIGNED;
boardConfiguration->mainRelayPin = GPIOE_5; engineConfiguration->mainRelayPin = GPIOE_5;
boardConfiguration->fuelPumpPin = GPIOE_6; engineConfiguration->fuelPumpPin = GPIOE_6;
boardConfiguration->fanPin = GPIO_UNASSIGNED; engineConfiguration->fanPin = GPIO_UNASSIGNED;
engineConfiguration->engineChartSize = 450; engineConfiguration->engineChartSize = 450;
@ -69,11 +69,11 @@ void setDodgeRam1996(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
setWholeTimingTable_d(10 PASS_CONFIG_PARAMETER_SUFFIX); setWholeTimingTable_d(10 PASS_CONFIG_PARAMETER_SUFFIX);
boardConfiguration->alternatorControlPin = GPIOD_7; engineConfiguration->alternatorControlPin = GPIOD_7;
engineConfiguration->alternatorControl.pFactor = 22; engineConfiguration->alternatorControl.pFactor = 22;
boardConfiguration->idle.solenoidPin = GPIOC_13; engineConfiguration->idle.solenoidPin = GPIOC_13;
boardConfiguration->idle.solenoidFrequency = 300; engineConfiguration->idle.solenoidFrequency = 300;
engineConfiguration->vbattAdcChannel = EFI_ADC_14; engineConfiguration->vbattAdcChannel = EFI_ADC_14;
// engineConfiguration->vbattDividerCoeff = ((float) (8.93 + 41.27)) / 8.93 * 2; // engineConfiguration->vbattDividerCoeff = ((float) (8.93 + 41.27)) / 8.93 * 2;
@ -82,5 +82,5 @@ void setDodgeRam1996(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
setDodgeSensor(&engineConfiguration->clt, 2700); setDodgeSensor(&engineConfiguration->clt, 2700);
setDodgeSensor(&engineConfiguration->iat, 2700); setDodgeSensor(&engineConfiguration->iat, 2700);
boardConfiguration->useStepperIdle = true; engineConfiguration->useStepperIdle = true;
} }

View File

@ -82,13 +82,13 @@ void setFordInline6(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
// output 5 is PC13 // output 5 is PC13
// output 6 is PC15 // output 6 is PC15
boardConfiguration->fuelPumpPin = GPIOC_13; engineConfiguration->fuelPumpPin = GPIOC_13;
boardConfiguration->injectionPins[0] = GPIOB_9; engineConfiguration->injectionPins[0] = GPIOB_9;
boardConfiguration->injectionPins[1] = GPIOE_3; engineConfiguration->injectionPins[1] = GPIOE_3;
boardConfiguration->ignitionPins[0] = GPIOC_15; engineConfiguration->ignitionPins[0] = GPIOC_15;
boardConfiguration->injectionPins[2] = GPIO_UNASSIGNED; engineConfiguration->injectionPins[2] = GPIO_UNASSIGNED;
boardConfiguration->fanPin = GPIO_UNASSIGNED; engineConfiguration->fanPin = GPIO_UNASSIGNED;
engineConfiguration->tpsMin = convertVoltageTo10bitADC(1.250); engineConfiguration->tpsMin = convertVoltageTo10bitADC(1.250);
engineConfiguration->tpsMax = convertVoltageTo10bitADC(4.538); engineConfiguration->tpsMax = convertVoltageTo10bitADC(4.538);
@ -96,10 +96,10 @@ void setFordInline6(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
// engineConfiguration->vbattAdcChannel = 0; // // engineConfiguration->vbattAdcChannel = 0; //
engineConfiguration->mafAdcChannel = EFI_ADC_1; engineConfiguration->mafAdcChannel = EFI_ADC_1;
boardConfiguration->triggerInputPins[0] = GPIOA_8; engineConfiguration->triggerInputPins[0] = GPIOA_8;
boardConfiguration->triggerInputPins[1] = GPIOA_5; engineConfiguration->triggerInputPins[1] = GPIOA_5;
boardConfiguration->logicAnalyzerPins[0] = GPIOC_6; engineConfiguration->logicAnalyzerPins[0] = GPIOC_6;
boardConfiguration->logicAnalyzerPins[1] = GPIOE_5; engineConfiguration->logicAnalyzerPins[1] = GPIOE_5;
} }
#endif /* EFI_SUPPORT_1995_FORD_INLINE_6 */ #endif /* EFI_SUPPORT_1995_FORD_INLINE_6 */

View File

@ -129,8 +129,8 @@ void setFordAspireEngineConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
engineConfiguration->useOnlyRisingEdgeForTrigger = true; engineConfiguration->useOnlyRisingEdgeForTrigger = true;
engineConfiguration->trigger.type = TT_FORD_ASPIRE; engineConfiguration->trigger.type = TT_FORD_ASPIRE;
boardConfiguration->injectionPins[4] = GPIO_UNASSIGNED; engineConfiguration->injectionPins[4] = GPIO_UNASSIGNED;
boardConfiguration->injectionPins[5] = GPIO_UNASSIGNED; engineConfiguration->injectionPins[5] = GPIO_UNASSIGNED;
engineConfiguration->HD44780width = 20; engineConfiguration->HD44780width = 20;
engineConfiguration->HD44780height = 4; engineConfiguration->HD44780height = 4;

View File

@ -73,7 +73,7 @@ void setFordEscortGt(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
engineConfiguration->trigger.type = TT_MAZDA_DOHC_1_4; engineConfiguration->trigger.type = TT_MAZDA_DOHC_1_4;
setFrankenso_01_LCD(boardConfiguration); setFrankenso_01_LCD(engineConfiguration);
setFrankenso0_1_joystick(engineConfiguration); setFrankenso0_1_joystick(engineConfiguration);
setDensoTODO(config); setDensoTODO(config);
@ -112,21 +112,21 @@ void setFordEscortGt(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
copyFuelTable(racingFestivaVeTable, config->veTable); copyFuelTable(racingFestivaVeTable, config->veTable);
// boardConfiguration->triggerInputPins[0] = GPIOC_6; // 2G YEL/BLU // engineConfiguration->triggerInputPins[0] = GPIOC_6; // 2G YEL/BLU
// boardConfiguration->triggerInputPins[1] = GPIOA_5; // 2E White CKP // engineConfiguration->triggerInputPins[1] = GPIOA_5; // 2E White CKP
// in case of SOHC distributor we only have one signal // in case of SOHC distributor we only have one signal
// boardConfiguration->triggerInputPins[0] = GPIOA_5; // 2E White CKP // engineConfiguration->triggerInputPins[0] = GPIOA_5; // 2E White CKP
// boardConfiguration->triggerInputPins[1] = GPIO_UNASSIGNED; // engineConfiguration->triggerInputPins[1] = GPIO_UNASSIGNED;
// in case of DOHC distributor we have two signals // in case of DOHC distributor we have two signals
boardConfiguration->triggerInputPins[0] = GPIOC_6; engineConfiguration->triggerInputPins[0] = GPIOC_6;
boardConfiguration->triggerInputPins[1] = GPIOA_5; // 2E White CKP engineConfiguration->triggerInputPins[1] = GPIOA_5; // 2E White CKP
// Denso 195500-2180 // Denso 195500-2180
engineConfiguration->injector.flow = 265; engineConfiguration->injector.flow = 265;
boardConfiguration->isFastAdcEnabled = true; engineConfiguration->isFastAdcEnabled = true;
engineConfiguration->map.sensor.type = MT_DENSO183; engineConfiguration->map.sensor.type = MT_DENSO183;
/** /**
* pin PA4: jumper W47<>W47 - ecu plug 3I * pin PA4: jumper W47<>W47 - ecu plug 3I
@ -137,7 +137,7 @@ void setFordEscortGt(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
engineConfiguration->afr.hwChannel = EFI_ADC_2; // Frankenso analog #5 // PA2 engineConfiguration->afr.hwChannel = EFI_ADC_2; // Frankenso analog #5 // PA2
// set_idle_position 10 // set_idle_position 10
boardConfiguration->manIdlePosition = 10; engineConfiguration->manIdlePosition = 10;
engineConfiguration->crankingIACposition = 65; engineConfiguration->crankingIACposition = 65;
setWholeIatCorrTimingTable(0 PASS_CONFIG_PARAMETER_SUFFIX); setWholeIatCorrTimingTable(0 PASS_CONFIG_PARAMETER_SUFFIX);
@ -164,8 +164,8 @@ void setFordEscortGt(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
setSingleCoilDwell(PASS_CONFIG_PARAMETER_SIGNATURE); setSingleCoilDwell(PASS_CONFIG_PARAMETER_SIGNATURE);
engineConfiguration->ignitionMode = IM_ONE_COIL; engineConfiguration->ignitionMode = IM_ONE_COIL;
boardConfiguration->triggerSimulatorPinModes[0] = OM_OPENDRAIN; engineConfiguration->triggerSimulatorPinModes[0] = OM_OPENDRAIN;
boardConfiguration->triggerSimulatorPinModes[1] = OM_OPENDRAIN; engineConfiguration->triggerSimulatorPinModes[1] = OM_OPENDRAIN;
// individual coils // individual coils
// W6 PC9 // W6 PC9
@ -173,11 +173,11 @@ void setFordEscortGt(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
// W12 PE8 // W12 PE8
// W13 PE12 // W13 PE12
boardConfiguration->ignitionPins[0] = GPIOC_9; engineConfiguration->ignitionPins[0] = GPIOC_9;
boardConfiguration->ignitionPins[1] = GPIOC_7; engineConfiguration->ignitionPins[1] = GPIOC_7;
boardConfiguration->ignitionPins[2] = GPIOE_8; engineConfiguration->ignitionPins[2] = GPIOE_8;
boardConfiguration->ignitionPins[3] = GPIOE_12; engineConfiguration->ignitionPins[3] = GPIOE_12;
boardConfiguration->ignitionPinMode = OM_DEFAULT; engineConfiguration->ignitionPinMode = OM_DEFAULT;
engineConfiguration->ignitionMode = IM_INDIVIDUAL_COILS; engineConfiguration->ignitionMode = IM_INDIVIDUAL_COILS;
@ -199,18 +199,18 @@ void setFordEscortGt(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
// Frankenso low out #11: PB8 // Frankenso low out #11: PB8
// Frankenso low out #12: PB7 // Frankenso low out #12: PB7
boardConfiguration->injectionPins[0] = GPIOD_3; engineConfiguration->injectionPins[0] = GPIOD_3;
boardConfiguration->injectionPins[1] = GPIOE_2; engineConfiguration->injectionPins[1] = GPIOE_2;
// 40% idle is good default // 40% idle is good default
boardConfiguration->idle.solenoidFrequency = 300; engineConfiguration->idle.solenoidFrequency = 300;
boardConfiguration->idle.solenoidPin = GPIOB_9; engineConfiguration->idle.solenoidPin = GPIOB_9;
boardConfiguration->malfunctionIndicatorPin = GPIOE_5; engineConfiguration->malfunctionIndicatorPin = GPIOE_5;
boardConfiguration->malfunctionIndicatorPinMode = OM_DEFAULT; engineConfiguration->malfunctionIndicatorPinMode = OM_DEFAULT;
boardConfiguration->tunerStudioSerialSpeed = 19200; engineConfiguration->tunerStudioSerialSpeed = 19200;
commonFrankensoAnalogInputs(engineConfiguration); commonFrankensoAnalogInputs(engineConfiguration);
setCommonNTCSensor(&engineConfiguration->clt, 2700); setCommonNTCSensor(&engineConfiguration->clt, 2700);
@ -235,7 +235,7 @@ void setFordEscortGt(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
* to test * to test
* set_fsio_setting 1 5000 * set_fsio_setting 1 5000
*/ */
boardConfiguration->fsio_setting[0] = 5000; engineConfiguration->fsio_setting[0] = 5000;
// set_fsio_expression 1 "rpm > fsio_setting(1)" // set_fsio_expression 1 "rpm > fsio_setting(1)"
setFsioExt(0, GPIOE_3, RPM_ABOVE_USER_SETTING_1, 150 PASS_CONFIG_PARAMETER_SUFFIX); setFsioExt(0, GPIOE_3, RPM_ABOVE_USER_SETTING_1, 150 PASS_CONFIG_PARAMETER_SUFFIX);
@ -250,9 +250,9 @@ void setFordEscortGt(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
* set_rpn_expression 1 "rpm 0 fsio_setting > coolant 1 fsio_setting > | vbatt 2 fsio_setting < |" * set_rpn_expression 1 "rpm 0 fsio_setting > coolant 1 fsio_setting > | vbatt 2 fsio_setting < |"
* eval "rpm 0 fsio_setting > coolant 1 fsio_setting > | vbatt 2 fsio_setting < |" * eval "rpm 0 fsio_setting > coolant 1 fsio_setting > | vbatt 2 fsio_setting < |"
*/ */
boardConfiguration->fsio_setting[1] = 6200; // RPM threshold engineConfiguration->fsio_setting[1] = 6200; // RPM threshold
boardConfiguration->fsio_setting[2] = 90; // CLT threshold engineConfiguration->fsio_setting[2] = 90; // CLT threshold
boardConfiguration->fsio_setting[3] = 13.5; // voltage threshold engineConfiguration->fsio_setting[3] = 13.5; // voltage threshold
// setFsio(1, GPIOC_13, "rpm 2 fsio_setting > coolant 3 fsio_setting > | vbatt 4 fsio_setting < |" PASS_CONFIG_PARAMETER_SUFFIX); // setFsio(1, GPIOC_13, "rpm 2 fsio_setting > coolant 3 fsio_setting > | vbatt 4 fsio_setting < |" PASS_CONFIG_PARAMETER_SUFFIX);
setFsio(1, GPIOD_7, RPM_ABOVE_USER_SETTING_2 PASS_CONFIG_PARAMETER_SUFFIX); setFsio(1, GPIOD_7, RPM_ABOVE_USER_SETTING_2 PASS_CONFIG_PARAMETER_SUFFIX);
@ -289,7 +289,7 @@ void setFordEscortGt(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
engineConfiguration->engineLoadAccelEnrichmentThreshold = 5.0; engineConfiguration->engineLoadAccelEnrichmentThreshold = 5.0;
engineConfiguration->engineLoadAccelEnrichmentMultiplier = 1; engineConfiguration->engineLoadAccelEnrichmentMultiplier = 1;
boardConfiguration->isSdCardEnabled = true; engineConfiguration->isSdCardEnabled = true;
// engineConfiguration->useFSIO16ForTimingAdjustment = true; // engineConfiguration->useFSIO16ForTimingAdjustment = true;
// we wanted to have a timinig table adjustment switch here // we wanted to have a timinig table adjustment switch here

View File

@ -69,8 +69,8 @@ void setHonda600(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
engineConfiguration->fuelAlgorithm = LM_ALPHA_N; engineConfiguration->fuelAlgorithm = LM_ALPHA_N;
// upside down wiring // upside down wiring
boardConfiguration->triggerInputPins[0] = GPIOA_5; engineConfiguration->triggerInputPins[0] = GPIOA_5;
boardConfiguration->triggerInputPins[1] = GPIOC_6; engineConfiguration->triggerInputPins[1] = GPIOC_6;
// set global_trigger_offset_angle 180 // set global_trigger_offset_angle 180
@ -90,7 +90,7 @@ void setHonda600(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
//setIndividualCoilsIgnition(); //setIndividualCoilsIgnition();
setFrankenso_01_LCD(boardConfiguration); setFrankenso_01_LCD(engineConfiguration);
commonFrankensoAnalogInputs(engineConfiguration); commonFrankensoAnalogInputs(engineConfiguration);
setFrankenso0_1_joystick(engineConfiguration); setFrankenso0_1_joystick(engineConfiguration);
#if IGN_LOAD_COUNT == DEFAULT_IGN_LOAD_COUNT #if IGN_LOAD_COUNT == DEFAULT_IGN_LOAD_COUNT
@ -138,33 +138,33 @@ void setHonda600(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
// Frankenso low out #11: PB8 injector #3 // Frankenso low out #11: PB8 injector #3
// Frankenso low out #12: PB7 injector #4 // Frankenso low out #12: PB7 injector #4
boardConfiguration->fuelPumpPin = GPIOE_4; engineConfiguration->fuelPumpPin = GPIOE_4;
boardConfiguration->mainRelayPin = GPIOD_7; engineConfiguration->mainRelayPin = GPIOD_7;
boardConfiguration->idle.solenoidPin = GPIOC_13; engineConfiguration->idle.solenoidPin = GPIOC_13;
boardConfiguration->fanPin = GPIOE_5; engineConfiguration->fanPin = GPIOE_5;
boardConfiguration->injectionPins[0] = GPIOB_9; // #1 engineConfiguration->injectionPins[0] = GPIOB_9; // #1
boardConfiguration->injectionPins[1] = GPIOD_5; // #2 engineConfiguration->injectionPins[1] = GPIOD_5; // #2
boardConfiguration->injectionPins[2] = GPIOB_7; // #3 engineConfiguration->injectionPins[2] = GPIOB_7; // #3
boardConfiguration->injectionPins[3] = GPIOB_8; // #4 engineConfiguration->injectionPins[3] = GPIOB_8; // #4
setDefaultCustomMaps(PASS_CONFIG_PARAMETER_SIGNATURE); setDefaultCustomMaps(PASS_CONFIG_PARAMETER_SIGNATURE);
setAlgorithm(LM_ALPHA_N PASS_CONFIG_PARAMETER_SUFFIX); setAlgorithm(LM_ALPHA_N PASS_CONFIG_PARAMETER_SUFFIX);
boardConfiguration->injectionPins[4] = GPIO_UNASSIGNED; engineConfiguration->injectionPins[4] = GPIO_UNASSIGNED;
boardConfiguration->injectionPins[5] = GPIO_UNASSIGNED; engineConfiguration->injectionPins[5] = GPIO_UNASSIGNED;
boardConfiguration->injectionPins[6] = GPIO_UNASSIGNED; engineConfiguration->injectionPins[6] = GPIO_UNASSIGNED;
boardConfiguration->injectionPins[7] = GPIO_UNASSIGNED; engineConfiguration->injectionPins[7] = GPIO_UNASSIGNED;
boardConfiguration->injectionPins[8] = GPIO_UNASSIGNED; engineConfiguration->injectionPins[8] = GPIO_UNASSIGNED;
boardConfiguration->injectionPins[9] = GPIO_UNASSIGNED; engineConfiguration->injectionPins[9] = GPIO_UNASSIGNED;
boardConfiguration->injectionPins[10] = GPIO_UNASSIGNED; engineConfiguration->injectionPins[10] = GPIO_UNASSIGNED;
boardConfiguration->injectionPins[11] = GPIO_UNASSIGNED; engineConfiguration->injectionPins[11] = GPIO_UNASSIGNED;
boardConfiguration->ignitionPins[0] = GPIOE_14; engineConfiguration->ignitionPins[0] = GPIOE_14;
boardConfiguration->ignitionPins[1] = GPIOC_7; engineConfiguration->ignitionPins[1] = GPIOC_7;
boardConfiguration->ignitionPins[2] = GPIOE_10; engineConfiguration->ignitionPins[2] = GPIOE_10;
boardConfiguration->ignitionPins[3] = GPIOC_9; // #4 engineConfiguration->ignitionPins[3] = GPIOC_9; // #4
// todo: 8.2 or 10k? // todo: 8.2 or 10k?
engineConfiguration->vbattDividerCoeff = ((float) (10 + 33)) / 10 * 2; engineConfiguration->vbattDividerCoeff = ((float) (10 + 33)) / 10 * 2;

View File

@ -39,7 +39,7 @@ EXTERN_CONFIG;
static void setHondaAccordConfigurationCommon(DECLARE_CONFIG_PARAMETER_SIGNATURE) { static void setHondaAccordConfigurationCommon(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
engineConfiguration->map.sensor.type = MT_DENSO183; engineConfiguration->map.sensor.type = MT_DENSO183;
boardConfiguration->isFastAdcEnabled = true; engineConfiguration->isFastAdcEnabled = true;
// set ignition_mode 0 // set ignition_mode 0
engineConfiguration->ignitionMode = IM_ONE_COIL; engineConfiguration->ignitionMode = IM_ONE_COIL;
@ -148,29 +148,29 @@ static void setHondaAccordConfigurationCommon(DECLARE_CONFIG_PARAMETER_SIGNATURE
// Frankenso low out #10: PD5 Injector #3 // Frankenso low out #10: PD5 Injector #3
// Frankenso low out #11: PB8 injector #1 // Frankenso low out #11: PB8 injector #1
// Frankenso low out #12: PB7 injector #4 // Frankenso low out #12: PB7 injector #4
boardConfiguration->fuelPumpPin = GPIOE_3; engineConfiguration->fuelPumpPin = GPIOE_3;
boardConfiguration->fuelPumpPinMode = OM_DEFAULT; engineConfiguration->fuelPumpPinMode = OM_DEFAULT;
boardConfiguration->malfunctionIndicatorPin = GPIOE_2; engineConfiguration->malfunctionIndicatorPin = GPIOE_2;
boardConfiguration->malfunctionIndicatorPinMode = OM_DEFAULT; engineConfiguration->malfunctionIndicatorPinMode = OM_DEFAULT;
boardConfiguration->fanPin = GPIOE_4; // blue wire engineConfiguration->fanPin = GPIOE_4; // blue wire
boardConfiguration->idle.solenoidPin = GPIOD_3; // green wire engineConfiguration->idle.solenoidPin = GPIOD_3; // green wire
boardConfiguration->injectionPins[0] = GPIOB_8; engineConfiguration->injectionPins[0] = GPIOB_8;
boardConfiguration->injectionPins[1] = GPIOB_9; engineConfiguration->injectionPins[1] = GPIOB_9;
boardConfiguration->injectionPins[2] = GPIOD_5; engineConfiguration->injectionPins[2] = GPIOD_5;
boardConfiguration->injectionPins[3] = GPIOB_7; engineConfiguration->injectionPins[3] = GPIOB_7;
boardConfiguration->ignitionPins[0] = GPIOE_12; // white wire engineConfiguration->ignitionPins[0] = GPIOE_12; // white wire
boardConfiguration->ignitionPins[1] = GPIO_UNASSIGNED; engineConfiguration->ignitionPins[1] = GPIO_UNASSIGNED;
boardConfiguration->ignitionPins[2] = GPIO_UNASSIGNED; engineConfiguration->ignitionPins[2] = GPIO_UNASSIGNED;
boardConfiguration->ignitionPins[3] = GPIO_UNASSIGNED; engineConfiguration->ignitionPins[3] = GPIO_UNASSIGNED;
setFrankenso_01_LCD(boardConfiguration); setFrankenso_01_LCD(engineConfiguration);
setFrankenso0_1_joystick(engineConfiguration); setFrankenso0_1_joystick(engineConfiguration);
boardConfiguration->idle.solenoidFrequency = 500; engineConfiguration->idle.solenoidFrequency = 500;
} }
/* /*

View File

@ -15,35 +15,35 @@ EXTERN_CONFIG;
void setLadaKalina(DECLARE_CONFIG_PARAMETER_SIGNATURE) { void setLadaKalina(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
setFrankensoConfiguration(PASS_CONFIG_PARAMETER_SIGNATURE); setFrankensoConfiguration(PASS_CONFIG_PARAMETER_SIGNATURE);
disableLCD(boardConfiguration); disableLCD(engineConfiguration);
boardConfiguration->HD44780_rs = GPIO_UNASSIGNED; engineConfiguration->HD44780_rs = GPIO_UNASSIGNED;
boardConfiguration->HD44780_e = GPIO_UNASSIGNED; engineConfiguration->HD44780_e = GPIO_UNASSIGNED;
boardConfiguration->HD44780_db4 = GPIO_UNASSIGNED; engineConfiguration->HD44780_db4 = GPIO_UNASSIGNED;
boardConfiguration->HD44780_db5 = GPIO_UNASSIGNED; engineConfiguration->HD44780_db5 = GPIO_UNASSIGNED;
boardConfiguration->HD44780_db6 = GPIO_UNASSIGNED; engineConfiguration->HD44780_db6 = GPIO_UNASSIGNED;
boardConfiguration->HD44780_db7 = GPIO_UNASSIGNED; engineConfiguration->HD44780_db7 = GPIO_UNASSIGNED;
setOperationMode(engineConfiguration, FOUR_STROKE_CRANK_SENSOR); setOperationMode(engineConfiguration, FOUR_STROKE_CRANK_SENSOR);
engineConfiguration->trigger.type = TT_TOOTHED_WHEEL_60_2; engineConfiguration->trigger.type = TT_TOOTHED_WHEEL_60_2;
boardConfiguration->triggerInputPins[0] = GPIOA_5; engineConfiguration->triggerInputPins[0] = GPIOA_5;
boardConfiguration->triggerInputPins[1] = GPIO_UNASSIGNED; engineConfiguration->triggerInputPins[1] = GPIO_UNASSIGNED;
engineConfiguration->globalTriggerAngleOffset = 114; engineConfiguration->globalTriggerAngleOffset = 114;
boardConfiguration->ignitionPins[0] = GPIOE_14; engineConfiguration->ignitionPins[0] = GPIOE_14;
boardConfiguration->ignitionPins[1] = GPIOC_7; engineConfiguration->ignitionPins[1] = GPIOC_7;
boardConfiguration->ignitionPins[2] = GPIOC_9; engineConfiguration->ignitionPins[2] = GPIOC_9;
boardConfiguration->ignitionPins[3] = GPIOE_12; engineConfiguration->ignitionPins[3] = GPIOE_12;
boardConfiguration->useStepperIdle = true; engineConfiguration->useStepperIdle = true;
boardConfiguration->fuelPumpPin = GPIOC_13; engineConfiguration->fuelPumpPin = GPIOC_13;
boardConfiguration->mainRelayPin = GPIOD_7; engineConfiguration->mainRelayPin = GPIOD_7;
boardConfiguration->idle.stepperDirectionPin = GPIOE_15; engineConfiguration->idle.stepperDirectionPin = GPIOE_15;
boardConfiguration->idle.stepperStepPin = GPIOE_13; engineConfiguration->idle.stepperStepPin = GPIOE_13;
engineConfiguration->stepperEnablePin = GPIOE_11; engineConfiguration->stepperEnablePin = GPIOE_11;
@ -54,7 +54,7 @@ void setLadaKalina(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
* to test * to test
* set_fsio_setting 1 5000 * set_fsio_setting 1 5000
*/ */
engineConfiguration->bc.fsio_setting[0] = 500; engineConfiguration->fsio_setting[0] = 500;
// set_rpn_expression 1 "rpm 0 fsio_setting <" // set_rpn_expression 1 "rpm 0 fsio_setting <"
setFsioExt(0, GPIOE_3, RPM_BELOW_USER_SETTING_1, 0 PASS_CONFIG_PARAMETER_SUFFIX); setFsioExt(0, GPIOE_3, RPM_BELOW_USER_SETTING_1, 0 PASS_CONFIG_PARAMETER_SUFFIX);
#endif /* EFI_FSIO */ #endif /* EFI_FSIO */

View File

@ -26,7 +26,7 @@ void setMazda626EngineConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
// engineConfiguration->trigger.type = TT_MAZDA_DOHC_1_4; // engineConfiguration->trigger.type = TT_MAZDA_DOHC_1_4;
// with this complex trigger we do not need this by default // with this complex trigger we do not need this by default
boardConfiguration->sensorChartMode = SC_OFF; engineConfiguration->sensorChartMode = SC_OFF;
engineConfiguration->useOnlyRisingEdgeForTrigger = true; engineConfiguration->useOnlyRisingEdgeForTrigger = true;
@ -103,6 +103,6 @@ void setMazda626EngineConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
engineConfiguration->externalKnockSenseAdc = EFI_ADC_4; engineConfiguration->externalKnockSenseAdc = EFI_ADC_4;
boardConfiguration->triggerInputPins[1] = GPIO_UNASSIGNED; engineConfiguration->triggerInputPins[1] = GPIO_UNASSIGNED;
engineConfiguration->camInputs[0] = GPIOA_5; engineConfiguration->camInputs[0] = GPIOA_5;
} }

View File

@ -135,14 +135,14 @@ static void commonMiataNa(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
engineConfiguration->trigger.type = TT_MAZDA_MIATA_NA; engineConfiguration->trigger.type = TT_MAZDA_MIATA_NA;
engineConfiguration->engineChartSize = 100; engineConfiguration->engineChartSize = 100;
boardConfiguration->triggerInputPins[0] = GPIOC_6; // 2G YEL/BLU engineConfiguration->triggerInputPins[0] = GPIOC_6; // 2G YEL/BLU
boardConfiguration->triggerInputPins[1] = GPIOA_5; // 2E White CKP engineConfiguration->triggerInputPins[1] = GPIOA_5; // 2E White CKP
engineConfiguration->ignitionMode = IM_WASTED_SPARK; engineConfiguration->ignitionMode = IM_WASTED_SPARK;
setFuelLoadBin(1.2, 4.4 PASS_CONFIG_PARAMETER_SUFFIX); setFuelLoadBin(1.2, 4.4 PASS_CONFIG_PARAMETER_SUFFIX);
setFuelRpmBin(800, 7000 PASS_CONFIG_PARAMETER_SUFFIX); setFuelRpmBin(800, 7000 PASS_CONFIG_PARAMETER_SUFFIX);
boardConfiguration->idle.solenoidFrequency = 160; engineConfiguration->idle.solenoidFrequency = 160;
// Frankenstein: high side #1 is PE8 // Frankenstein: high side #1 is PE8
// Frankenstein: high side #2 is PE10 // Frankenstein: high side #2 is PE10
@ -151,16 +151,16 @@ static void commonMiataNa(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
// Frankenstein: high side #5 is PC9 // Frankenstein: high side #5 is PC9
// Frankenstein: high side #6 is PC7 // Frankenstein: high side #6 is PC7
boardConfiguration->ignitionPins[0] = GPIOE_12; // Frankenstein: high side #3 engineConfiguration->ignitionPins[0] = GPIOE_12; // Frankenstein: high side #3
boardConfiguration->ignitionPins[1] = GPIOE_14; // Frankenstein: high side #4 engineConfiguration->ignitionPins[1] = GPIOE_14; // Frankenstein: high side #4
boardConfiguration->ignitionPins[2] = GPIO_UNASSIGNED; engineConfiguration->ignitionPins[2] = GPIO_UNASSIGNED;
boardConfiguration->ignitionPins[3] = GPIO_UNASSIGNED; engineConfiguration->ignitionPins[3] = GPIO_UNASSIGNED;
boardConfiguration->ignitionPinMode = OM_DEFAULT; engineConfiguration->ignitionPinMode = OM_DEFAULT;
setDefaultCrankingFuel(engineConfiguration); setDefaultCrankingFuel(engineConfiguration);
boardConfiguration->triggerSimulatorPinModes[0] = OM_OPENDRAIN; engineConfiguration->triggerSimulatorPinModes[0] = OM_OPENDRAIN;
boardConfiguration->triggerSimulatorPinModes[1] = OM_OPENDRAIN; engineConfiguration->triggerSimulatorPinModes[1] = OM_OPENDRAIN;
setCommonNTCSensor(&engineConfiguration->clt, 2700); setCommonNTCSensor(&engineConfiguration->clt, 2700);
setCommonNTCSensor(&engineConfiguration->iat, 2700); setCommonNTCSensor(&engineConfiguration->iat, 2700);
@ -174,7 +174,7 @@ void common079721_2351(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
engineConfiguration->specs.cylindersCount = 4; engineConfiguration->specs.cylindersCount = 4;
engineConfiguration->specs.firingOrder = FO_1_3_4_2; engineConfiguration->specs.firingOrder = FO_1_3_4_2;
boardConfiguration->fuelPumpPin = GPIO_UNASSIGNED; // fuel pump is not controlled by ECU on this engine engineConfiguration->fuelPumpPin = GPIO_UNASSIGNED; // fuel pump is not controlled by ECU on this engine
// set cranking_injection_mode 0 // set cranking_injection_mode 0
engineConfiguration->crankingInjectionMode = IM_SIMULTANEOUS; engineConfiguration->crankingInjectionMode = IM_SIMULTANEOUS;
@ -221,13 +221,13 @@ void setMiata1990(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
// Frankenstein: low side - out #11: PB8 // Frankenstein: low side - out #11: PB8
// Frankenstein: low side - out #12: PB9 // Frankenstein: low side - out #12: PB9
boardConfiguration->injectionPins[0] = GPIOB_9; // Frankenstein: low side - out #12 engineConfiguration->injectionPins[0] = GPIOB_9; // Frankenstein: low side - out #12
boardConfiguration->injectionPins[1] = GPIOB_8; // Frankenstein: low side - out #11 engineConfiguration->injectionPins[1] = GPIOB_8; // Frankenstein: low side - out #11
boardConfiguration->injectionPins[2] = GPIO_UNASSIGNED; engineConfiguration->injectionPins[2] = GPIO_UNASSIGNED;
boardConfiguration->injectionPins[3] = GPIO_UNASSIGNED; engineConfiguration->injectionPins[3] = GPIO_UNASSIGNED;
boardConfiguration->injectionPins[4] = GPIO_UNASSIGNED; engineConfiguration->injectionPins[4] = GPIO_UNASSIGNED;
boardConfiguration->injectionPins[5] = GPIO_UNASSIGNED; engineConfiguration->injectionPins[5] = GPIO_UNASSIGNED;
boardConfiguration->injectionPinMode = OM_DEFAULT; engineConfiguration->injectionPinMode = OM_DEFAULT;
// todo: idleValvePin // todo: idleValvePin
} }
@ -250,17 +250,17 @@ static void setMiata1994_common(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
copyTimingTable(miataNA8_maf_advance_table, config->ignitionTable); copyTimingTable(miataNA8_maf_advance_table, config->ignitionTable);
#endif #endif
// boardConfiguration->triggerSimulatorPins[0] = GPIOD_2; // 2G - YEL/BLU // engineConfiguration->triggerSimulatorPins[0] = GPIOD_2; // 2G - YEL/BLU
// boardConfiguration->triggerSimulatorPins[1] = GPIOB_3; // 2E - WHT - four times // engineConfiguration->triggerSimulatorPins[1] = GPIOB_3; // 2E - WHT - four times
// boardConfiguration->triggerSimulatorPinModes[0] = OM_OPENDRAIN; // engineConfiguration->triggerSimulatorPinModes[0] = OM_OPENDRAIN;
// boardConfiguration->triggerSimulatorPinModes[1] = OM_OPENDRAIN; // engineConfiguration->triggerSimulatorPinModes[1] = OM_OPENDRAIN;
// //
// boardConfiguration->triggerInputPins[0] = GPIO_UNASSIGNED; // engineConfiguration->triggerInputPins[0] = GPIO_UNASSIGNED;
// boardConfiguration->triggerInputPins[1] = GPIO_UNASSIGNED; // engineConfiguration->triggerInputPins[1] = GPIO_UNASSIGNED;
// //
// boardConfiguration->is_enabled_spi_1 = false; // engineConfiguration->is_enabled_spi_1 = false;
// boardConfiguration->is_enabled_spi_2 = false; // engineConfiguration->is_enabled_spi_2 = false;
// boardConfiguration->is_enabled_spi_3 = false; // engineConfiguration->is_enabled_spi_3 = false;
/** /**
* Outputs * Outputs
@ -277,25 +277,25 @@ static void setMiata1994_common(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
// Frankenso low out #10: PE0 (do not use with discovery!) // Frankenso low out #10: PE0 (do not use with discovery!)
// Frankenso low out #11: PB8 // Frankenso low out #11: PB8
// Frankenso low out #12: PB7 // Frankenso low out #12: PB7
boardConfiguration->fanPin = GPIOE_6; engineConfiguration->fanPin = GPIOE_6;
boardConfiguration->o2heaterPin = GPIO_UNASSIGNED; engineConfiguration->o2heaterPin = GPIO_UNASSIGNED;
boardConfiguration->fuelPumpPin = GPIOE_4; engineConfiguration->fuelPumpPin = GPIOE_4;
boardConfiguration->injectionPins[4] = GPIO_UNASSIGNED; engineConfiguration->injectionPins[4] = GPIO_UNASSIGNED;
boardConfiguration->injectionPins[5] = GPIO_UNASSIGNED; engineConfiguration->injectionPins[5] = GPIO_UNASSIGNED;
boardConfiguration->injectionPinMode = OM_DEFAULT; engineConfiguration->injectionPinMode = OM_DEFAULT;
boardConfiguration->idle.solenoidPin = GPIOB_9; engineConfiguration->idle.solenoidPin = GPIOB_9;
boardConfiguration->ignitionPins[0] = GPIOE_14; // Frankenso high side - pin 1G engineConfiguration->ignitionPins[0] = GPIOE_14; // Frankenso high side - pin 1G
boardConfiguration->ignitionPins[1] = GPIO_UNASSIGNED; engineConfiguration->ignitionPins[1] = GPIO_UNASSIGNED;
boardConfiguration->ignitionPins[2] = GPIOC_7; // Frankenso high side - pin 1H engineConfiguration->ignitionPins[2] = GPIOC_7; // Frankenso high side - pin 1H
boardConfiguration->ignitionPins[3] = GPIO_UNASSIGNED; engineConfiguration->ignitionPins[3] = GPIO_UNASSIGNED;
boardConfiguration->ignitionPinMode = OM_DEFAULT; engineConfiguration->ignitionPinMode = OM_DEFAULT;
setFrankenso_01_LCD(boardConfiguration); setFrankenso_01_LCD(engineConfiguration);
commonFrankensoAnalogInputs(engineConfiguration); commonFrankensoAnalogInputs(engineConfiguration);
@ -318,13 +318,13 @@ void setMiata1994_d(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
/** /**
* This board was avoiding PE0 & PE1 mosfets altogether * This board was avoiding PE0 & PE1 mosfets altogether
*/ */
boardConfiguration->injectionPins[0] = GPIOD_7; // avoiding PE1 engineConfiguration->injectionPins[0] = GPIOD_7; // avoiding PE1
boardConfiguration->injectionPins[1] = GPIOE_2; engineConfiguration->injectionPins[1] = GPIOE_2;
boardConfiguration->injectionPins[2] = GPIOB_8; engineConfiguration->injectionPins[2] = GPIOB_8;
boardConfiguration->injectionPins[3] = GPIOB_7; engineConfiguration->injectionPins[3] = GPIOB_7;
// todo: add the diode? change idle valve logic? // todo: add the diode? change idle valve logic?
boardConfiguration->idle.solenoidPin = GPIO_UNASSIGNED; engineConfiguration->idle.solenoidPin = GPIO_UNASSIGNED;
} }
/** /**
@ -342,31 +342,31 @@ void setMiata1996(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
#endif #endif
// upside down // upside down
boardConfiguration->triggerInputPins[0] = GPIOA_5; engineConfiguration->triggerInputPins[0] = GPIOA_5;
boardConfiguration->triggerInputPins[1] = GPIOC_6; engineConfiguration->triggerInputPins[1] = GPIOC_6;
boardConfiguration->fuelPumpPin = GPIOE_4; engineConfiguration->fuelPumpPin = GPIOE_4;
boardConfiguration->idle.solenoidPin = GPIOE_5; engineConfiguration->idle.solenoidPin = GPIOE_5;
engineConfiguration->mafAdcChannel = EFI_ADC_1; engineConfiguration->mafAdcChannel = EFI_ADC_1;
engineConfiguration->clt.adcChannel = EFI_ADC_11; engineConfiguration->clt.adcChannel = EFI_ADC_11;
engineConfiguration->tps1_1AdcChannel = EFI_ADC_13; engineConfiguration->tps1_1AdcChannel = EFI_ADC_13;
boardConfiguration->ignitionPins[0] = GPIOE_12; // Frankenstein: high side #3 engineConfiguration->ignitionPins[0] = GPIOE_12; // Frankenstein: high side #3
boardConfiguration->ignitionPins[1] = GPIO_UNASSIGNED; engineConfiguration->ignitionPins[1] = GPIO_UNASSIGNED;
boardConfiguration->ignitionPins[2] = GPIOE_14; // Frankenstein: high side #4 engineConfiguration->ignitionPins[2] = GPIOE_14; // Frankenstein: high side #4
boardConfiguration->ignitionPins[3] = GPIO_UNASSIGNED; engineConfiguration->ignitionPins[3] = GPIO_UNASSIGNED;
boardConfiguration->ignitionPinMode = OM_DEFAULT; engineConfiguration->ignitionPinMode = OM_DEFAULT;
// harness is sequential but we have a limited board // harness is sequential but we have a limited board
engineConfiguration->crankingInjectionMode = IM_BATCH; engineConfiguration->crankingInjectionMode = IM_BATCH;
engineConfiguration->injectionMode = IM_BATCH; engineConfiguration->injectionMode = IM_BATCH;
boardConfiguration->injectionPins[0] = GPIOB_9; // Frankenstein: low side - out #12 engineConfiguration->injectionPins[0] = GPIOB_9; // Frankenstein: low side - out #12
boardConfiguration->injectionPins[1] = GPIOB_8; // Frankenstein: low side - out #11 engineConfiguration->injectionPins[1] = GPIOB_8; // Frankenstein: low side - out #11
boardConfiguration->injectionPins[2] = GPIO_UNASSIGNED; engineConfiguration->injectionPins[2] = GPIO_UNASSIGNED;
boardConfiguration->injectionPins[3] = GPIO_UNASSIGNED; engineConfiguration->injectionPins[3] = GPIO_UNASSIGNED;
boardConfiguration->injectionPins[4] = GPIO_UNASSIGNED; engineConfiguration->injectionPins[4] = GPIO_UNASSIGNED;
boardConfiguration->injectionPins[5] = GPIO_UNASSIGNED; engineConfiguration->injectionPins[5] = GPIO_UNASSIGNED;
boardConfiguration->injectionPinMode = OM_DEFAULT; engineConfiguration->injectionPinMode = OM_DEFAULT;
} }

View File

@ -114,7 +114,7 @@ static void miataNAcommonEngineSettings(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
copyTimingTable(mapBased16IgnitionTable, config->ignitionTable); copyTimingTable(mapBased16IgnitionTable, config->ignitionTable);
#endif #endif
boardConfiguration->idle.solenoidFrequency = 160; engineConfiguration->idle.solenoidFrequency = 160;
engineConfiguration->ignitionMode = IM_WASTED_SPARK; engineConfiguration->ignitionMode = IM_WASTED_SPARK;
} }
@ -122,16 +122,16 @@ void miataNAcommon(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
miataNAcommonEngineSettings(PASS_CONFIG_PARAMETER_SIGNATURE); miataNAcommonEngineSettings(PASS_CONFIG_PARAMETER_SIGNATURE);
boardConfiguration->idle.solenoidPin = GPIOB_9; // this W61 <> W61 jumper, pin 3W engineConfiguration->idle.solenoidPin = GPIOB_9; // this W61 <> W61 jumper, pin 3W
boardConfiguration->ignitionPins[0] = GPIOE_14; // Frankenso high side - pin 1G engineConfiguration->ignitionPins[0] = GPIOE_14; // Frankenso high side - pin 1G
boardConfiguration->ignitionPins[1] = GPIO_UNASSIGNED; engineConfiguration->ignitionPins[1] = GPIO_UNASSIGNED;
boardConfiguration->ignitionPins[2] = GPIOC_7; // Frankenso high side - pin 1H engineConfiguration->ignitionPins[2] = GPIOC_7; // Frankenso high side - pin 1H
boardConfiguration->ignitionPins[3] = GPIO_UNASSIGNED; engineConfiguration->ignitionPins[3] = GPIO_UNASSIGNED;
} }
static void setMiataNA6_settings(DECLARE_CONFIG_PARAMETER_SIGNATURE) { static void setMiataNA6_settings(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
engineConfiguration->bc.isFasterEngineSpinUpEnabled = true; engineConfiguration->isFasterEngineSpinUpEnabled = true;
memcpy(config->veRpmBins, ve16RpmBins, sizeof(ve16RpmBins)); memcpy(config->veRpmBins, ve16RpmBins, sizeof(ve16RpmBins));
memcpy(config->veLoadBins, ve16LoadBins, sizeof(ve16LoadBins)); memcpy(config->veLoadBins, ve16LoadBins, sizeof(ve16LoadBins));
@ -202,8 +202,8 @@ void setMiataNA6_MAP_Frankenso(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
setFrankensoConfiguration(PASS_CONFIG_PARAMETER_SIGNATURE); setFrankensoConfiguration(PASS_CONFIG_PARAMETER_SIGNATURE);
boardConfiguration->isHip9011Enabled = false; engineConfiguration->isHip9011Enabled = false;
boardConfiguration->isSdCardEnabled = false; engineConfiguration->isSdCardEnabled = false;
setMiataNA6_settings(PASS_CONFIG_PARAMETER_SIGNATURE); setMiataNA6_settings(PASS_CONFIG_PARAMETER_SIGNATURE);
@ -217,7 +217,7 @@ void setMiataNA6_MAP_Frankenso(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
engineConfiguration->vbattDividerCoeff = 9.75;// ((float) (8.2 + 33)) / 8.2 * 2; engineConfiguration->vbattDividerCoeff = 9.75;// ((float) (8.2 + 33)) / 8.2 * 2;
boardConfiguration->isSdCardEnabled = true; engineConfiguration->isSdCardEnabled = true;
// /** // /**
// * oil pressure line // * oil pressure line
@ -238,14 +238,14 @@ void setMiataNA6_MAP_Frankenso(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
*/ */
/* /*
//WARNING: these indeces are off //WARNING: these indeces are off
boardConfiguration->fsio_setting[0] = 6400; // RPM threshold engineConfiguration->fsio_setting[0] = 6400; // RPM threshold
boardConfiguration->fsio_setting[1] = 100; // CLT threshold, fsio_setting #2 engineConfiguration->fsio_setting[1] = 100; // CLT threshold, fsio_setting #2
boardConfiguration->fsio_setting[2] = 13.0; // voltage threshold, fsio_setting #3 engineConfiguration->fsio_setting[2] = 13.0; // voltage threshold, fsio_setting #3
// set_fsio_setting 4 3000 // set_fsio_setting 4 3000
boardConfiguration->fsio_setting[3] = 3000; // oil pressure RPM, fsio_setting #4 engineConfiguration->fsio_setting[3] = 3000; // oil pressure RPM, fsio_setting #4
// set_fsio_setting 5 0.52 // set_fsio_setting 5 0.52
boardConfiguration->fsio_setting[4] = 0.52; // oil pressure threshold, fsio_setting #5 engineConfiguration->fsio_setting[4] = 0.52; // oil pressure threshold, fsio_setting #5
*/ */
// * set_rpn_expression 1 "rpm 3 fsio_setting >" // * set_rpn_expression 1 "rpm 3 fsio_setting >"
@ -259,17 +259,17 @@ void setMiataNA6_MAP_Frankenso(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
setFsio(0, GPIOC_13, COMBINED_WARNING_LIGHT PASS_CONFIG_PARAMETER_SUFFIX); setFsio(0, GPIOC_13, COMBINED_WARNING_LIGHT PASS_CONFIG_PARAMETER_SUFFIX);
#endif /* EFI_FSIO */ #endif /* EFI_FSIO */
boardConfiguration->injectionPins[0] = GPIOD_3; // #1&3 pin 3U engineConfiguration->injectionPins[0] = GPIOD_3; // #1&3 pin 3U
boardConfiguration->injectionPins[1] = GPIOE_2; // #2&4 pin 3V engineConfiguration->injectionPins[1] = GPIOE_2; // #2&4 pin 3V
boardConfiguration->injectionPins[2] = GPIO_UNASSIGNED; engineConfiguration->injectionPins[2] = GPIO_UNASSIGNED;
boardConfiguration->injectionPins[3] = GPIO_UNASSIGNED; engineConfiguration->injectionPins[3] = GPIO_UNASSIGNED;
// white wire from 1E - TOP of W4 to BOTTOM W62 // white wire from 1E - TOP of W4 to BOTTOM W62
boardConfiguration->malfunctionIndicatorPin = GPIOD_5; engineConfiguration->malfunctionIndicatorPin = GPIOD_5;
// yellow wire from 1V/W22 to bottom of W48 // yellow wire from 1V/W22 to bottom of W48
boardConfiguration->clutchDownPin = GPIOA_3; engineConfiguration->clutchDownPin = GPIOA_3;
boardConfiguration->clutchDownPinMode = PI_PULLUP; engineConfiguration->clutchDownPinMode = PI_PULLUP;
// 110mm red wire from 1N/W14 to bottom of W45 // 110mm red wire from 1N/W14 to bottom of W45
@ -280,7 +280,7 @@ void setMiataNA6_MAP_Frankenso(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
#if ! EFI_UNIT_TEST #if ! EFI_UNIT_TEST
// W57 PE3 A/C compressor relay out // W57 PE3 A/C compressor relay out
boardConfiguration->acRelayPin = GPIOE_3; engineConfiguration->acRelayPin = GPIOE_3;
// W58 PE4 A/C fan relay out // W58 PE4 A/C fan relay out
#endif /* EFI_UNIT_TEST */ #endif /* EFI_UNIT_TEST */
@ -311,17 +311,17 @@ void setMiataNA6_VAF_MRE(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
// MAF/VAF: "19 - AN volt 4" // MAF/VAF: "19 - AN volt 4"
engineConfiguration->mafAdcChannel = EFI_ADC_12; engineConfiguration->mafAdcChannel = EFI_ADC_12;
//boardConfiguration->triggerInputPins[0] = GPIOC_6; //engineConfiguration->triggerInputPins[0] = GPIOC_6;
boardConfiguration->triggerInputPins[1] = GPIOA_5; engineConfiguration->triggerInputPins[1] = GPIOA_5;
engineConfiguration->camInputs[0] = GPIO_UNASSIGNED; engineConfiguration->camInputs[0] = GPIO_UNASSIGNED;
boardConfiguration->ignitionPins[0] = GPIOD_7; engineConfiguration->ignitionPins[0] = GPIOD_7;
boardConfiguration->ignitionPins[1] = GPIO_UNASSIGNED; engineConfiguration->ignitionPins[1] = GPIO_UNASSIGNED;
boardConfiguration->ignitionPins[2] = GPIOD_6; engineConfiguration->ignitionPins[2] = GPIOD_6;
boardConfiguration->ignitionPins[3] = GPIO_UNASSIGNED; engineConfiguration->ignitionPins[3] = GPIO_UNASSIGNED;
boardConfiguration->injectionPins[2] = GPIO_UNASSIGNED; engineConfiguration->injectionPins[2] = GPIO_UNASSIGNED;
boardConfiguration->injectionPins[3] = GPIO_UNASSIGNED; engineConfiguration->injectionPins[3] = GPIO_UNASSIGNED;
// tps = "20 - AN volt 5" // tps = "20 - AN volt 5"
//engineConfiguration->tps1_1AdcChannel = EFI_ADC_13; //engineConfiguration->tps1_1AdcChannel = EFI_ADC_13;
@ -332,7 +332,7 @@ void setMiataNA6_VAF_MRE(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
// TLE8888_PIN_24: "43 - GP Out 4" // TLE8888_PIN_24: "43 - GP Out 4"
// MIL check engine // MIL check engine
// NA6 check engine light is just a normal low side driver // NA6 check engine light is just a normal low side driver
boardConfiguration->malfunctionIndicatorPin = TLE8888_PIN_24; engineConfiguration->malfunctionIndicatorPin = TLE8888_PIN_24;
// IAC: GPIOE_9: "7 - Lowside 1" // IAC: GPIOE_9: "7 - Lowside 1"
@ -342,8 +342,8 @@ void setMiataNA6_VAF_MRE(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
// engineConfiguration->vbattDividerCoeff = (66.0f / 10.0f) * engineConfiguration->analogInputDividerCoefficient; // engineConfiguration->vbattDividerCoeff = (66.0f / 10.0f) * engineConfiguration->analogInputDividerCoefficient;
boardConfiguration->isHip9011Enabled = false; engineConfiguration->isHip9011Enabled = false;
boardConfiguration->isSdCardEnabled = false; engineConfiguration->isSdCardEnabled = false;
setMiataNA6_settings(PASS_CONFIG_PARAMETER_SIGNATURE); setMiataNA6_settings(PASS_CONFIG_PARAMETER_SIGNATURE);
miataNAcommonEngineSettings(PASS_CONFIG_PARAMETER_SIGNATURE); miataNAcommonEngineSettings(PASS_CONFIG_PARAMETER_SIGNATURE);

View File

@ -122,7 +122,7 @@ void setMazdaMiata2003EngineConfigurationNaFuelRail(DECLARE_CONFIG_PARAMETER_SIG
memcpy(config->afrLoadBins, mazda_miata_nb2_targetAfrLoadBins, sizeof(mazda_miata_nb2_targetAfrLoadBins)); memcpy(config->afrLoadBins, mazda_miata_nb2_targetAfrLoadBins, sizeof(mazda_miata_nb2_targetAfrLoadBins));
copyTargetAfrTable(target_AFR_hunchback, config->afrTable); copyTargetAfrTable(target_AFR_hunchback, config->afrTable);
boardConfiguration->ignitionPins[2] = GPIOC_7; engineConfiguration->ignitionPins[2] = GPIOC_7;
// Frankenso analog #7 pin 3J, W48 top <>W48 bottom jumper, not OEM // Frankenso analog #7 pin 3J, W48 top <>W48 bottom jumper, not OEM
engineConfiguration->afr.hwChannel = EFI_ADC_3; // PA3 engineConfiguration->afr.hwChannel = EFI_ADC_3; // PA3
@ -145,7 +145,7 @@ void setMazdaMiata2003EngineConfigurationNaFuelRail(DECLARE_CONFIG_PARAMETER_SIG
engineConfiguration->rpmHardLimit = 7200; // we want to survive the race, but we also want some fun! engineConfiguration->rpmHardLimit = 7200; // we want to survive the race, but we also want some fun!
// set idle_position 30 // set idle_position 30
boardConfiguration->manIdlePosition = 30; engineConfiguration->manIdlePosition = 30;
engineConfiguration->crankingIACposition = 65; engineConfiguration->crankingIACposition = 65;
} }

View File

@ -41,10 +41,10 @@ void setMazdaMiataNA8Configuration(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
engineConfiguration->vbattDividerCoeff = 9.75;// ((float) (8.2 + 33)) / 8.2 * 2; engineConfiguration->vbattDividerCoeff = 9.75;// ((float) (8.2 + 33)) / 8.2 * 2;
boardConfiguration->injectionPins[0] = GPIOD_3; // #1 pin 3U engineConfiguration->injectionPins[0] = GPIOD_3; // #1 pin 3U
boardConfiguration->injectionPins[1] = GPIOE_2; // #2 pin 3V engineConfiguration->injectionPins[1] = GPIOE_2; // #2 pin 3V
boardConfiguration->injectionPins[2] = GPIOB_8; // #3 pin 3Y engineConfiguration->injectionPins[2] = GPIOB_8; // #3 pin 3Y
boardConfiguration->injectionPins[3] = GPIOB_7; // #4 pin 3Z engineConfiguration->injectionPins[3] = GPIOB_7; // #4 pin 3Z
engineConfiguration->injectionMode = IM_SEQUENTIAL; engineConfiguration->injectionMode = IM_SEQUENTIAL;
} }

View File

@ -45,33 +45,33 @@ void setMazdaMiataNb1EngineConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
engineConfiguration->iat.adcChannel = EFI_ADC_13; engineConfiguration->iat.adcChannel = EFI_ADC_13;
engineConfiguration->afr.hwChannel = EFI_ADC_2; // PA2 engineConfiguration->afr.hwChannel = EFI_ADC_2; // PA2
boardConfiguration->idle.solenoidPin = GPIOE_0; engineConfiguration->idle.solenoidPin = GPIOE_0;
boardConfiguration->idle.solenoidPinMode = OM_DEFAULT; engineConfiguration->idle.solenoidPinMode = OM_DEFAULT;
boardConfiguration->fuelPumpPin = GPIOC_14; // Frankenstein: low side - out #4 engineConfiguration->fuelPumpPin = GPIOC_14; // Frankenstein: low side - out #4
boardConfiguration->fuelPumpPinMode = OM_DEFAULT; engineConfiguration->fuelPumpPinMode = OM_DEFAULT;
boardConfiguration->injectionPins[0] = GPIOB_9; // Frankenstein: low side - out #12 engineConfiguration->injectionPins[0] = GPIOB_9; // Frankenstein: low side - out #12
boardConfiguration->injectionPins[1] = GPIOB_8; // Frankenstein: low side - out #11 engineConfiguration->injectionPins[1] = GPIOB_8; // Frankenstein: low side - out #11
boardConfiguration->injectionPins[2] = GPIOE_3; // Frankenstein: low side - out #8 engineConfiguration->injectionPins[2] = GPIOE_3; // Frankenstein: low side - out #8
boardConfiguration->injectionPins[3] = GPIOE_5; // Frankenstein: low side - out #6 engineConfiguration->injectionPins[3] = GPIOE_5; // Frankenstein: low side - out #6
boardConfiguration->injectionPins[4] = GPIO_UNASSIGNED; engineConfiguration->injectionPins[4] = GPIO_UNASSIGNED;
boardConfiguration->injectionPins[5] = GPIO_UNASSIGNED; engineConfiguration->injectionPins[5] = GPIO_UNASSIGNED;
boardConfiguration->injectionPinMode = OM_DEFAULT; engineConfiguration->injectionPinMode = OM_DEFAULT;
boardConfiguration->ignitionPins[0] = GPIOE_10; // Frankenstein: high side #1 engineConfiguration->ignitionPins[0] = GPIOE_10; // Frankenstein: high side #1
boardConfiguration->ignitionPins[1] = GPIO_UNASSIGNED; engineConfiguration->ignitionPins[1] = GPIO_UNASSIGNED;
boardConfiguration->ignitionPins[2] = GPIOC_9; // // Frankenstein: high side #2 engineConfiguration->ignitionPins[2] = GPIOC_9; // // Frankenstein: high side #2
boardConfiguration->ignitionPins[3] = GPIO_UNASSIGNED; engineConfiguration->ignitionPins[3] = GPIO_UNASSIGNED;
boardConfiguration->ignitionPinMode = OM_INVERTED; engineConfiguration->ignitionPinMode = OM_INVERTED;
boardConfiguration->malfunctionIndicatorPin = GPIOE_1; engineConfiguration->malfunctionIndicatorPin = GPIOE_1;
boardConfiguration->malfunctionIndicatorPinMode = OM_DEFAULT; engineConfiguration->malfunctionIndicatorPinMode = OM_DEFAULT;
boardConfiguration->fanPin = GPIOE_6; engineConfiguration->fanPin = GPIOE_6;
boardConfiguration->fanPinMode = OM_DEFAULT; engineConfiguration->fanPinMode = OM_DEFAULT;
boardConfiguration->clutchDownPin = GPIO_UNASSIGNED; engineConfiguration->clutchDownPin = GPIO_UNASSIGNED;
// set_whole_fuel_map 3 // set_whole_fuel_map 3
setWholeFuelMap(3 PASS_CONFIG_PARAMETER_SUFFIX); setWholeFuelMap(3 PASS_CONFIG_PARAMETER_SUFFIX);
@ -84,7 +84,7 @@ void setMazdaMiataNb1EngineConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
* to test * to test
* set_fsio_setting 1 5000 * set_fsio_setting 1 5000
*/ */
boardConfiguration->fsio_setting[0] = 5000; engineConfiguration->fsio_setting[0] = 5000;
// (self and (rpm > 4800)) OR (rpm > 5000) // (self and (rpm > 4800)) OR (rpm > 5000)
// set_rpn_expression 1 "self rpm 4800 > & rpm 5000 > OR" // set_rpn_expression 1 "self rpm 4800 > & rpm 5000 > OR"
// setFsioExt(0, GPIOE_3, "self rpm 4800 > & rpm 5000 > OR", 150 PASS_CONFIG_PARAMETER_SUFFIX); // setFsioExt(0, GPIOE_3, "self rpm 4800 > & rpm 5000 > OR", 150 PASS_CONFIG_PARAMETER_SUFFIX);

View File

@ -197,14 +197,14 @@ static void setMazdaMiataEngineNB2Defaults(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
// 0.1375 // 0.1375
// 6.375 // 6.375
// 10.625 // 10.625
boardConfiguration->miataNb2VVTRatioFrom = 8.50 * 0.75; engineConfiguration->miataNb2VVTRatioFrom = 8.50 * 0.75;
boardConfiguration->miataNb2VVTRatioTo = 14; engineConfiguration->miataNb2VVTRatioTo = 14;
engineConfiguration->nbVvtIndex = 0; engineConfiguration->nbVvtIndex = 0;
engineConfiguration->auxPidFrequency[0] = 300; // VVT solenoid control engineConfiguration->auxPidFrequency[0] = 300; // VVT solenoid control
// set idle_position 35 // set idle_position 35
boardConfiguration->manIdlePosition = 35; engineConfiguration->manIdlePosition = 35;
engineConfiguration->specs.cylindersCount = 4; engineConfiguration->specs.cylindersCount = 4;
engineConfiguration->specs.firingOrder = FO_1_3_4_2; engineConfiguration->specs.firingOrder = FO_1_3_4_2;
@ -292,29 +292,29 @@ void setMazdaMiata2003EngineConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
setMazdaMiataEngineNB2Defaults(PASS_CONFIG_PARAMETER_SIGNATURE); setMazdaMiataEngineNB2Defaults(PASS_CONFIG_PARAMETER_SIGNATURE);
// boardConfiguration->triggerInputPins[0] = GPIOA_8; // custom Frankenso wiring in order to use SPI1 for accelerometer // engineConfiguration->triggerInputPins[0] = GPIOA_8; // custom Frankenso wiring in order to use SPI1 for accelerometer
boardConfiguration->triggerInputPins[0] = GPIOA_5; // board still not modified engineConfiguration->triggerInputPins[0] = GPIOA_5; // board still not modified
boardConfiguration->triggerInputPins[1] = GPIO_UNASSIGNED; engineConfiguration->triggerInputPins[1] = GPIO_UNASSIGNED;
engineConfiguration->camInputs[0] = GPIOC_6; engineConfiguration->camInputs[0] = GPIOC_6;
// boardConfiguration->is_enabled_spi_1 = true; // engineConfiguration->is_enabled_spi_1 = true;
engineConfiguration->twoWireBatchInjection = true; // this is needed for #492 testing engineConfiguration->twoWireBatchInjection = true; // this is needed for #492 testing
boardConfiguration->alternatorControlPin = GPIOE_10; engineConfiguration->alternatorControlPin = GPIOE_10;
boardConfiguration->alternatorControlPinMode = OM_OPENDRAIN; engineConfiguration->alternatorControlPinMode = OM_OPENDRAIN;
// engineConfiguration->vehicleSpeedSensorInputPin = GPIOA_8; // engineConfiguration->vehicleSpeedSensorInputPin = GPIOA_8;
boardConfiguration->vvtCamSensorUseRise = true; engineConfiguration->vvtCamSensorUseRise = true;
engineConfiguration->vvtDisplayInverted = true; engineConfiguration->vvtDisplayInverted = true;
engineConfiguration->auxPidPins[0] = GPIOE_3; // VVT solenoid control engineConfiguration->auxPidPins[0] = GPIOE_3; // VVT solenoid control
// /** // /**
// * set_fsio_setting 1 0.55 // * set_fsio_setting 1 0.55
// */ // */
boardConfiguration->fsio_setting[0] = 0.0; engineConfiguration->fsio_setting[0] = 0.0;
// setFsioExt(0, GPIOE_3, "0 fsio_setting", 400 PASS_CONFIG_PARAMETER_SUFFIX); // setFsioExt(0, GPIOE_3, "0 fsio_setting", 400 PASS_CONFIG_PARAMETER_SUFFIX);
@ -341,10 +341,10 @@ void setMazdaMiata2003EngineConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
* Miata coil on #4 PE14 - white ECU wire "1&4" * Miata coil on #4 PE14 - white ECU wire "1&4"
*/ */
boardConfiguration->ignitionPins[0] = GPIOE_14; engineConfiguration->ignitionPins[0] = GPIOE_14;
boardConfiguration->ignitionPins[1] = GPIO_UNASSIGNED; engineConfiguration->ignitionPins[1] = GPIO_UNASSIGNED;
boardConfiguration->ignitionPins[2] = GPIOC_9; engineConfiguration->ignitionPins[2] = GPIOC_9;
boardConfiguration->ignitionPins[3] = GPIO_UNASSIGNED; engineConfiguration->ignitionPins[3] = GPIO_UNASSIGNED;
// set tps_min 90 // set tps_min 90
engineConfiguration->tpsMin = 100; // convert 12to10 bit (ADC/4) engineConfiguration->tpsMin = 100; // convert 12to10 bit (ADC/4)
@ -354,11 +354,11 @@ void setMazdaMiata2003EngineConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
boardConfiguration->malfunctionIndicatorPin = GPIOD_5; engineConfiguration->malfunctionIndicatorPin = GPIOD_5;
// boardConfiguration->malfunctionIndicatorPin = GPIOD_9; // engineConfiguration->malfunctionIndicatorPin = GPIOD_9;
// boardConfiguration->malfunctionIndicatorPinMode = OM_INVERTED; // engineConfiguration->malfunctionIndicatorPinMode = OM_INVERTED;
// todo: blue jumper wire - what is it?! // todo: blue jumper wire - what is it?!
// Frankenso analog #6 pin 3R, W56 (5th lower row pin from the end) top <> W45 bottom jumper, not OEM // Frankenso analog #6 pin 3R, W56 (5th lower row pin from the end) top <> W45 bottom jumper, not OEM
@ -383,9 +383,9 @@ void setMazdaMiata2003EngineConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
* set_fsio_setting 3 65 * set_fsio_setting 3 65
* set_fsio_setting 4 15 * set_fsio_setting 4 15
*/ */
boardConfiguration->fsio_setting[1] = 6500; // #2 RPM threshold engineConfiguration->fsio_setting[1] = 6500; // #2 RPM threshold
boardConfiguration->fsio_setting[2] = 105; // #3 CLT threshold engineConfiguration->fsio_setting[2] = 105; // #3 CLT threshold
boardConfiguration->fsio_setting[3] = 12.0; // #4 voltage threshold engineConfiguration->fsio_setting[3] = 12.0; // #4 voltage threshold
// setFsio(1, GPIOE_6, COMBINED_WARNING_LIGHT PASS_CONFIG_PARAMETER_SUFFIX); // setFsio(1, GPIOE_6, COMBINED_WARNING_LIGHT PASS_CONFIG_PARAMETER_SUFFIX);
@ -422,7 +422,7 @@ void setMazdaMiata2003EngineConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
engineConfiguration->tps1_1AdcChannel = EFI_ADC_13; // PC3 engineConfiguration->tps1_1AdcChannel = EFI_ADC_13; // PC3
engineConfiguration->idleMode = IM_AUTO; engineConfiguration->idleMode = IM_AUTO;
CONFIGB(useETBforIdleControl) = true; CONFIG(useETBforIdleControl) = true;
// set_analog_input_pin pps PA2 // set_analog_input_pin pps PA2
engineConfiguration->throttlePedalPositionAdcChannel = EFI_ADC_2; engineConfiguration->throttlePedalPositionAdcChannel = EFI_ADC_2;
@ -432,7 +432,7 @@ void setMazdaMiata2003EngineConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
engineConfiguration->idleRpmPid.dFactor = 5; engineConfiguration->idleRpmPid.dFactor = 5;
engineConfiguration->idleRpmPid.periodMs = 10; engineConfiguration->idleRpmPid.periodMs = 10;
engineConfiguration->bc.isFasterEngineSpinUpEnabled = true; engineConfiguration->isFasterEngineSpinUpEnabled = true;
//set etb_p 12 //set etb_p 12
engineConfiguration->etb.pFactor = 12; // a bit lower p-factor seems to work better on TLE9201? MRE? engineConfiguration->etb.pFactor = 12; // a bit lower p-factor seems to work better on TLE9201? MRE?
@ -473,7 +473,7 @@ void setMazdaMiata2003EngineConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
void setMazdaMiata2003EngineConfigurationBoardTest(DECLARE_CONFIG_PARAMETER_SIGNATURE) { void setMazdaMiata2003EngineConfigurationBoardTest(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
setMazdaMiata2003EngineConfiguration(PASS_CONFIG_PARAMETER_SIGNATURE); setMazdaMiata2003EngineConfiguration(PASS_CONFIG_PARAMETER_SIGNATURE);
boardConfiguration->ignitionPins[2] = GPIOC_7; engineConfiguration->ignitionPins[2] = GPIOC_7;
// Frankenso analog #7 pin 3J, W48 top <>W48 bottom jumper, not OEM. Make sure 500K pull-down on Frankenso // Frankenso analog #7 pin 3J, W48 top <>W48 bottom jumper, not OEM. Make sure 500K pull-down on Frankenso
engineConfiguration->afr.hwChannel = EFI_ADC_3; // PA3 engineConfiguration->afr.hwChannel = EFI_ADC_3; // PA3
@ -499,15 +499,15 @@ void setMiataNB2_MRE(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
// tps1_1AdcChannel input is inherited from boards/microrusefi/board_configuration.cpp // tps1_1AdcChannel input is inherited from boards/microrusefi/board_configuration.cpp
// afr.hwChannel input is inherited from boards/microrusefi/board_configuration.cpp // afr.hwChannel input is inherited from boards/microrusefi/board_configuration.cpp
boardConfiguration->ignitionPins[1] = GPIO_UNASSIGNED; engineConfiguration->ignitionPins[1] = GPIO_UNASSIGNED;
boardConfiguration->ignitionPins[3] = GPIO_UNASSIGNED; engineConfiguration->ignitionPins[3] = GPIO_UNASSIGNED;
engineConfiguration->camInputs[0] = GPIOA_5; engineConfiguration->camInputs[0] = GPIOA_5;
engineConfiguration->useOnlyRisingEdgeForTrigger = false; engineConfiguration->useOnlyRisingEdgeForTrigger = false;
engineConfiguration->useTLE8888_hall_mode = true; engineConfiguration->useTLE8888_hall_mode = true;
// GPIOD_6: "13 - GP Out 6" - selected to +12v // GPIOD_6: "13 - GP Out 6" - selected to +12v
boardConfiguration->alternatorControlPin = GPIOD_6; engineConfiguration->alternatorControlPin = GPIOD_6;
// GPIOD_7: "14 - GP Out 5" - selected to +12v // GPIOD_7: "14 - GP Out 5" - selected to +12v
engineConfiguration->dizzySparkOutputPin = GPIOD_7; // tachometer engineConfiguration->dizzySparkOutputPin = GPIOD_7; // tachometer
@ -525,7 +525,7 @@ void setMiataNB2_MRE(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
engineConfiguration->auxPidPins[0] = GPIOE_9; // VVT solenoid control engineConfiguration->auxPidPins[0] = GPIOE_9; // VVT solenoid control
// TLE8888_PIN_23: "33 - GP Out 3" // TLE8888_PIN_23: "33 - GP Out 3"
boardConfiguration->malfunctionIndicatorPin = TLE8888_PIN_23; engineConfiguration->malfunctionIndicatorPin = TLE8888_PIN_23;
//set idle_offset 0 //set idle_offset 0
engineConfiguration->idleRpmPid.offset = 0; engineConfiguration->idleRpmPid.offset = 0;
@ -534,7 +534,7 @@ void setMiataNB2_MRE(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
engineConfiguration->idleRpmPid.dFactor = 5; engineConfiguration->idleRpmPid.dFactor = 5;
engineConfiguration->idleRpmPid.periodMs = 10; engineConfiguration->idleRpmPid.periodMs = 10;
engineConfiguration->bc.isFasterEngineSpinUpEnabled = true; engineConfiguration->isFasterEngineSpinUpEnabled = true;
engineConfiguration->etb.pFactor = 12; // a bit lower p-factor seems to work better on TLE9201? MRE? engineConfiguration->etb.pFactor = 12; // a bit lower p-factor seems to work better on TLE9201? MRE?
engineConfiguration->etb.iFactor = 0; engineConfiguration->etb.iFactor = 0;
@ -556,7 +556,7 @@ void setMiataNB2_MRE(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
engineConfiguration->tpsMax = 870; engineConfiguration->tpsMax = 870;
engineConfiguration->idleMode = IM_AUTO; engineConfiguration->idleMode = IM_AUTO;
CONFIGB(useETBforIdleControl) = true; CONFIG(useETBforIdleControl) = true;
engineConfiguration->throttlePedalUpVoltage = 1; engineConfiguration->throttlePedalUpVoltage = 1;
// WAT? that's an interesting value, how come it's above 5v? // WAT? that's an interesting value, how come it's above 5v?
engineConfiguration->throttlePedalWOTVoltage = 5.47; engineConfiguration->throttlePedalWOTVoltage = 5.47;

View File

@ -35,8 +35,8 @@ void vag_18_Turbo(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
engineConfiguration->ignitionMode = IM_INDIVIDUAL_COILS; engineConfiguration->ignitionMode = IM_INDIVIDUAL_COILS;
engineConfiguration->crankingInjectionMode = IM_SEQUENTIAL; engineConfiguration->crankingInjectionMode = IM_SEQUENTIAL;
engineConfiguration->injectionMode = IM_SEQUENTIAL; engineConfiguration->injectionMode = IM_SEQUENTIAL;
boardConfiguration->ignitionPinMode = OM_INVERTED; engineConfiguration->ignitionPinMode = OM_INVERTED;
boardConfiguration->injectionPinMode = OM_OPENDRAIN_INVERTED; engineConfiguration->injectionPinMode = OM_OPENDRAIN_INVERTED;
engineConfiguration->isCylinderCleanupEnabled = true; engineConfiguration->isCylinderCleanupEnabled = true;
engineConfiguration->rpmHardLimit = 8000; engineConfiguration->rpmHardLimit = 8000;
engineConfiguration->cranking.baseFuel = 4; engineConfiguration->cranking.baseFuel = 4;
@ -44,7 +44,7 @@ void vag_18_Turbo(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
//Analog Inputs //Analog Inputs
boardConfiguration->isFastAdcEnabled = true; engineConfiguration->isFastAdcEnabled = true;
engineConfiguration->map.sensor.type = MT_GM_3_BAR; engineConfiguration->map.sensor.type = MT_GM_3_BAR;
setCommonNTCSensor(&engineConfiguration->clt, 2700); setCommonNTCSensor(&engineConfiguration->clt, 2700);
setCommonNTCSensor(&engineConfiguration->iat, 2700); setCommonNTCSensor(&engineConfiguration->iat, 2700);
@ -65,56 +65,56 @@ void vag_18_Turbo(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
engineConfiguration->canNbcType = CAN_BUS_NBC_VAG; engineConfiguration->canNbcType = CAN_BUS_NBC_VAG;
engineConfiguration->canReadEnabled = true; engineConfiguration->canReadEnabled = true;
engineConfiguration->canWriteEnabled = true; engineConfiguration->canWriteEnabled = true;
boardConfiguration->canDeviceMode = CD_USE_CAN1; engineConfiguration->canDeviceMode = CD_USE_CAN1;
boardConfiguration->canTxPin = GPIOB_6; engineConfiguration->canTxPin = GPIOB_6;
boardConfiguration->canRxPin = GPIOB_12; engineConfiguration->canRxPin = GPIOB_12;
// Injectors // Injectors
boardConfiguration->injectionPins[0] = GPIOE_4; // #1 engineConfiguration->injectionPins[0] = GPIOE_4; // #1
boardConfiguration->injectionPins[1] = GPIOE_2; // #2 engineConfiguration->injectionPins[1] = GPIOE_2; // #2
boardConfiguration->injectionPins[2] = GPIOE_3; // #3 engineConfiguration->injectionPins[2] = GPIOE_3; // #3
boardConfiguration->injectionPins[3] = GPIOE_1; // #4 engineConfiguration->injectionPins[3] = GPIOE_1; // #4
boardConfiguration->injectionPins[4] = GPIOE_6; // #5 engineConfiguration->injectionPins[4] = GPIOE_6; // #5
boardConfiguration->injectionPins[5] = GPIOE_5; // #6 engineConfiguration->injectionPins[5] = GPIOE_5; // #6
boardConfiguration->injectionPins[6] = GPIOB_9; // #7 engineConfiguration->injectionPins[6] = GPIOB_9; // #7
boardConfiguration->injectionPins[7] = GPIOE_0; // #8 engineConfiguration->injectionPins[7] = GPIOE_0; // #8
//Ignition Outputs //Ignition Outputs
boardConfiguration->ignitionPins[0] = GPIOD_1; // #1 engineConfiguration->ignitionPins[0] = GPIOD_1; // #1
boardConfiguration->ignitionPins[1] = GPIOD_6; // #2 engineConfiguration->ignitionPins[1] = GPIOD_6; // #2
boardConfiguration->ignitionPins[2] = GPIOD_3; // #3 engineConfiguration->ignitionPins[2] = GPIOD_3; // #3
boardConfiguration->ignitionPins[3] = GPIOD_4; // #4 engineConfiguration->ignitionPins[3] = GPIOD_4; // #4
boardConfiguration->ignitionPins[4] = GPIOD_0; // #5 engineConfiguration->ignitionPins[4] = GPIOD_0; // #5
boardConfiguration->ignitionPins[5] = GPIOD_2; // #6 engineConfiguration->ignitionPins[5] = GPIOD_2; // #6
boardConfiguration->ignitionPins[6] = GPIOA_15; // #7 engineConfiguration->ignitionPins[6] = GPIOA_15; // #7
boardConfiguration->ignitionPins[7] = GPIOC_12; // #8 engineConfiguration->ignitionPins[7] = GPIOC_12; // #8
//SPI Settings //SPI Settings
boardConfiguration->is_enabled_spi_1 = true; engineConfiguration->is_enabled_spi_1 = true;
boardConfiguration->is_enabled_spi_2 = true; engineConfiguration->is_enabled_spi_2 = true;
boardConfiguration->is_enabled_spi_3 = false; engineConfiguration->is_enabled_spi_3 = false;
engineConfiguration->cj125SpiDevice = SPI_DEVICE_2; engineConfiguration->cj125SpiDevice = SPI_DEVICE_2;
boardConfiguration->cj125CsPin = GPIOB_11; engineConfiguration->cj125CsPin = GPIOB_11;
//Digital Inputs/Outputs //Digital Inputs/Outputs
#if (BOARD_TLE8888_COUNT > 0) #if (BOARD_TLE8888_COUNT > 0)
engineConfiguration->tle8888spiDevice = SPI_DEVICE_1; engineConfiguration->tle8888spiDevice = SPI_DEVICE_1;
boardConfiguration->fuelPumpPin = TLE8888_PIN_22; engineConfiguration->fuelPumpPin = TLE8888_PIN_22;
boardConfiguration->tachOutputPin = TLE8888_PIN_16; engineConfiguration->tachOutputPin = TLE8888_PIN_16;
boardConfiguration->alternatorControlPin = TLE8888_PIN_17; engineConfiguration->alternatorControlPin = TLE8888_PIN_17;
engineConfiguration->auxPidPins[0] = TLE8888_PIN_6; // VVT solenoid control engineConfiguration->auxPidPins[0] = TLE8888_PIN_6; // VVT solenoid control
#endif /* BOARD_TLE8888_COUNT */ #endif /* BOARD_TLE8888_COUNT */
boardConfiguration->mainRelayPin = GPIO_UNASSIGNED; engineConfiguration->mainRelayPin = GPIO_UNASSIGNED;
boardConfiguration->idle.solenoidPin = GPIO_UNASSIGNED; engineConfiguration->idle.solenoidPin = GPIO_UNASSIGNED;
boardConfiguration->fanPin = GPIO_UNASSIGNED; engineConfiguration->fanPin = GPIO_UNASSIGNED;
boardConfiguration->clutchDownPin = GPIOD_11; engineConfiguration->clutchDownPin = GPIOD_11;
engineConfiguration->brakePedalPin = GPIOE_10; engineConfiguration->brakePedalPin = GPIOE_10;
engineConfiguration->camInputs[0] = GPIOA_2; engineConfiguration->camInputs[0] = GPIOA_2;
#if defined(STM32_HAS_GPIOG) && STM32_HAS_GPIOG #if defined(STM32_HAS_GPIOG) && STM32_HAS_GPIOG
boardConfiguration->triggerInputPins[0] = GPIOG_7; engineConfiguration->triggerInputPins[0] = GPIOG_7;
#endif /* STM32_HAS_GPIOF */ #endif /* STM32_HAS_GPIOF */
#if defined(STM32_HAS_GPIOF) && STM32_HAS_GPIOF #if defined(STM32_HAS_GPIOF) && STM32_HAS_GPIOF
engineConfiguration->vehicleSpeedSensorInputPin = GPIOF_14; engineConfiguration->vehicleSpeedSensorInputPin = GPIOF_14;
@ -122,7 +122,7 @@ void vag_18_Turbo(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
//Alternator Settings //Alternator Settings
boardConfiguration->alternatorControlPinMode = OM_OPENDRAIN; engineConfiguration->alternatorControlPinMode = OM_OPENDRAIN;
engineConfiguration->targetVBatt = 13.8; engineConfiguration->targetVBatt = 13.8;
engineConfiguration->alternatorControl.offset = 40; engineConfiguration->alternatorControl.offset = 40;
engineConfiguration->alternatorControl.pFactor = 14; engineConfiguration->alternatorControl.pFactor = 14;
@ -145,7 +145,7 @@ void vag_18_Turbo(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
CONFIG(etbIo[0].directionPin1) = GPIOF_15; CONFIG(etbIo[0].directionPin1) = GPIOF_15;
CONFIG(etbIo[0].directionPin2) = GPIOF_14; CONFIG(etbIo[0].directionPin2) = GPIOF_14;
#endif /* STM32_HAS_GPIOF */ #endif /* STM32_HAS_GPIOF */
boardConfiguration->isHip9011Enabled = false; engineConfiguration->isHip9011Enabled = false;
#if EFI_FSIO #if EFI_FSIO
setFsio (13, GPIOE_5, "0" PASS_CONFIG_PARAMETER_SUFFIX); setFsio (13, GPIOE_5, "0" PASS_CONFIG_PARAMETER_SUFFIX);
@ -165,7 +165,7 @@ void vag_18_Turbo(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
engineConfiguration->activateAuxPid1 = true; engineConfiguration->activateAuxPid1 = true;
engineConfiguration->auxPidFrequency[0] = 300; engineConfiguration->auxPidFrequency[0] = 300;
boardConfiguration->fsio_setting[0] = 0.0; engineConfiguration->fsio_setting[0] = 0.0;
engineConfiguration->auxPid[0].pFactor = 2; engineConfiguration->auxPid[0].pFactor = 2;
engineConfiguration->auxPid[0].iFactor = 0.005; engineConfiguration->auxPid[0].iFactor = 0.005;
engineConfiguration->auxPid[0].dFactor = 0; engineConfiguration->auxPid[0].dFactor = 0;
@ -173,7 +173,7 @@ void vag_18_Turbo(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
engineConfiguration->auxPid[0].minValue = 24; engineConfiguration->auxPid[0].minValue = 24;
engineConfiguration->auxPid[0].maxValue = 44; engineConfiguration->auxPid[0].maxValue = 44;
engineConfiguration->auxPidFrequency[0] = 300; engineConfiguration->auxPidFrequency[0] = 300;
boardConfiguration->fsio_setting[0] = 0.0; engineConfiguration->fsio_setting[0] = 0.0;
//AC Settings //AC Settings
@ -181,7 +181,7 @@ void vag_18_Turbo(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
//Configuration 2 : Over CAN with variable Kompressor(CAN: Input=B_sacc,B_skoc Output: B_kov) //Configuration 2 : Over CAN with variable Kompressor(CAN: Input=B_sacc,B_skoc Output: B_kov)
//Configuration 3 : 2 Wires //Configuration 3 : 2 Wires
boardConfiguration->acRelayPin = GPIO_UNASSIGNED; engineConfiguration->acRelayPin = GPIO_UNASSIGNED;
engineConfiguration->acCutoffLowRpm = 400; engineConfiguration->acCutoffLowRpm = 400;
engineConfiguration->acCutoffHighRpm = 4500; engineConfiguration->acCutoffHighRpm = 4500;
engineConfiguration->acIdleRpmBump = 200; engineConfiguration->acIdleRpmBump = 200;

View File

@ -65,19 +65,19 @@ void setMitsubishiConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
// Frankenstein: low side - out #11: PB8 // Frankenstein: low side - out #11: PB8
// Frankenstein: low side - out #12: PB9 // Frankenstein: low side - out #12: PB9
boardConfiguration->injectionPins[0] = GPIOB_9; // Frankenstein: low side - out #12 engineConfiguration->injectionPins[0] = GPIOB_9; // Frankenstein: low side - out #12
boardConfiguration->injectionPins[1] = GPIOB_8; // Frankenstein: low side - out #11 engineConfiguration->injectionPins[1] = GPIOB_8; // Frankenstein: low side - out #11
boardConfiguration->injectionPins[2] = GPIOE_3; // Frankenstein: low side - out #8 engineConfiguration->injectionPins[2] = GPIOE_3; // Frankenstein: low side - out #8
boardConfiguration->injectionPins[3] = GPIOE_5; // Frankenstein: low side - out #6 engineConfiguration->injectionPins[3] = GPIOE_5; // Frankenstein: low side - out #6
// Frankenstein: high side #1: PE8 // Frankenstein: high side #1: PE8
// Frankenstein: high side #2: PE10 // Frankenstein: high side #2: PE10
boardConfiguration->ignitionPins[0] = GPIOE_8; // Frankenstein: high side #1 engineConfiguration->ignitionPins[0] = GPIOE_8; // Frankenstein: high side #1
boardConfiguration->ignitionPins[1] = GPIO_UNASSIGNED; engineConfiguration->ignitionPins[1] = GPIO_UNASSIGNED;
boardConfiguration->ignitionPins[2] = GPIOE_10; // // Frankenstein: high side #2 engineConfiguration->ignitionPins[2] = GPIOE_10; // // Frankenstein: high side #2
boardConfiguration->ignitionPins[3] = GPIO_UNASSIGNED; engineConfiguration->ignitionPins[3] = GPIO_UNASSIGNED;
engineConfiguration->HD44780width = 20; engineConfiguration->HD44780width = 20;
engineConfiguration->HD44780height = 4; engineConfiguration->HD44780height = 4;

View File

@ -20,9 +20,9 @@ void setNissanPrimeraEngineConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
engineConfiguration->trigger.type = TT_NISSAN_SR20VE; engineConfiguration->trigger.type = TT_NISSAN_SR20VE;
boardConfiguration->ignitionPins[0] = GPIOD_7; engineConfiguration->ignitionPins[0] = GPIOD_7;
boardConfiguration->ignitionPins[1] = GPIO_UNASSIGNED; engineConfiguration->ignitionPins[1] = GPIO_UNASSIGNED;
boardConfiguration->ignitionPins[2] = GPIOD_6; engineConfiguration->ignitionPins[2] = GPIOD_6;
engineConfiguration->auxValves[0] = GPIOE_14; engineConfiguration->auxValves[0] = GPIOE_14;

View File

@ -16,13 +16,13 @@
#include "engine_math.h" #include "engine_math.h"
#include "allsensors.h" #include "allsensors.h"
void setFrankenstein_01_LCD(board_configuration_s *boardConfiguration) { void setFrankenstein_01_LCD(engine_configuration_s *engineConfiguration) {
boardConfiguration->HD44780_rs = GPIOE_9; engineConfiguration->HD44780_rs = GPIOE_9;
boardConfiguration->HD44780_e = GPIOE_11; engineConfiguration->HD44780_e = GPIOE_11;
boardConfiguration->HD44780_db4 = GPIOE_13; engineConfiguration->HD44780_db4 = GPIOE_13;
boardConfiguration->HD44780_db5 = GPIOE_15; engineConfiguration->HD44780_db5 = GPIOE_15;
boardConfiguration->HD44780_db6 = GPIOB_11; engineConfiguration->HD44780_db6 = GPIOB_11;
boardConfiguration->HD44780_db7 = GPIOB_13; engineConfiguration->HD44780_db7 = GPIOB_13;
} }
EXTERN_CONFIG; EXTERN_CONFIG;
@ -34,10 +34,10 @@ void setRoverv8(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
// set trigger_type 9 // set trigger_type 9
engineConfiguration->trigger.type = TT_TOOTHED_WHEEL_36_1; engineConfiguration->trigger.type = TT_TOOTHED_WHEEL_36_1;
boardConfiguration->is_enabled_spi_2 = false; engineConfiguration->is_enabled_spi_2 = false;
boardConfiguration->isHip9011Enabled = false; engineConfiguration->isHip9011Enabled = false;
CONFIGB(hip9011IntHoldPin) = GPIO_UNASSIGNED; CONFIG(hip9011IntHoldPin) = GPIO_UNASSIGNED;
setFrankenstein_01_LCD(boardConfiguration); setFrankenstein_01_LCD(engineConfiguration);
engineConfiguration->specs.displacement = 3.528; engineConfiguration->specs.displacement = 3.528;
engineConfiguration->specs.cylindersCount = 8; engineConfiguration->specs.cylindersCount = 8;
@ -58,13 +58,13 @@ void setRoverv8(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
// set ignition_mode 2 // set ignition_mode 2
engineConfiguration->ignitionMode = IM_WASTED_SPARK; engineConfiguration->ignitionMode = IM_WASTED_SPARK;
boardConfiguration->ignitionPinMode = OM_INVERTED; engineConfiguration->ignitionPinMode = OM_INVERTED;
// set_ignition_channels // set_ignition_channels
boardConfiguration->ignitionPins[0] = GPIOE_8; // Frankenstein: low side - out #x (?) engineConfiguration->ignitionPins[0] = GPIOE_8; // Frankenstein: low side - out #x (?)
boardConfiguration->ignitionPins[7] = GPIOE_10; // Frankenstein: low side - out #x (?) engineConfiguration->ignitionPins[7] = GPIOE_10; // Frankenstein: low side - out #x (?)
boardConfiguration->ignitionPins[3] = GPIOE_12; // Frankenstein: low side - out #x (?) engineConfiguration->ignitionPins[3] = GPIOE_12; // Frankenstein: low side - out #x (?)
boardConfiguration->ignitionPins[2] = GPIOE_14; // Frankenstein: low side - out #x (?) engineConfiguration->ignitionPins[2] = GPIOE_14; // Frankenstein: low side - out #x (?)
// Frankenstein: low side - out #1: PC14 // Frankenstein: low side - out #1: PC14
// Frankenstein: low side - out #2: PC15 // Frankenstein: low side - out #2: PC15
@ -79,27 +79,27 @@ void setRoverv8(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
// Frankenstein: low side - out #11: PB8 // Frankenstein: low side - out #11: PB8
// Frankenstein: low side - out #12: PB9 // Frankenstein: low side - out #12: PB9
boardConfiguration->injectionPins[0] = GPIOC_14; // Frankenstein: low side - out #1 engineConfiguration->injectionPins[0] = GPIOC_14; // Frankenstein: low side - out #1
boardConfiguration->injectionPins[1] = GPIOC_15; // Frankenstein: low side - out #2 engineConfiguration->injectionPins[1] = GPIOC_15; // Frankenstein: low side - out #2
boardConfiguration->injectionPins[2] = GPIOE_6; // Frankenstein: low side - out #3 engineConfiguration->injectionPins[2] = GPIOE_6; // Frankenstein: low side - out #3
boardConfiguration->injectionPins[3] = GPIOC_13; // Frankenstein: low side - out #4 engineConfiguration->injectionPins[3] = GPIOC_13; // Frankenstein: low side - out #4
boardConfiguration->injectionPins[4] = GPIOE_4; // Frankenstein: low side - out #5 engineConfiguration->injectionPins[4] = GPIOE_4; // Frankenstein: low side - out #5
boardConfiguration->injectionPins[5] = GPIOE_5; // Frankenstein: low side - out #6 engineConfiguration->injectionPins[5] = GPIOE_5; // Frankenstein: low side - out #6
boardConfiguration->injectionPins[6] = GPIOE_2; // Frankenstein: low side - out #7 engineConfiguration->injectionPins[6] = GPIOE_2; // Frankenstein: low side - out #7
boardConfiguration->injectionPins[7] = GPIOE_3; // Frankenstein: low side - out #8 engineConfiguration->injectionPins[7] = GPIOE_3; // Frankenstein: low side - out #8
// not valid ICU pin engineConfiguration->vehicleSpeedSensorInputPin = GPIOC_2; // not valid ICU pin engineConfiguration->vehicleSpeedSensorInputPin = GPIOC_2;
//GPIOE_0 AND GPIOE_1 are bad pins since they conflict with accelerometer //GPIOE_0 AND GPIOE_1 are bad pins since they conflict with accelerometer
//no malfunction indicator pin needed, since we use CAN_BUS_MAZDA_RX8 //no malfunction indicator pin needed, since we use CAN_BUS_MAZDA_RX8
//boardConfiguration->fuelPumpPin = GPIOE_0; // Frankenstein: low side - out #9 //engineConfiguration->fuelPumpPin = GPIOE_0; // Frankenstein: low side - out #9
//boardConfiguration->malfunctionIndicatorPin = GPIOE_1; // Frankenstein: low side - out #10 //engineConfiguration->malfunctionIndicatorPin = GPIOE_1; // Frankenstein: low side - out #10
boardConfiguration->fuelPumpPin = GPIOB_8; // Frankenstein: low side - out #11 engineConfiguration->fuelPumpPin = GPIOB_8; // Frankenstein: low side - out #11
boardConfiguration->fuelPumpPinMode = OM_DEFAULT; engineConfiguration->fuelPumpPinMode = OM_DEFAULT;
boardConfiguration->mainRelayPin = GPIOB_9; // Frankenstein: low side - out #12 engineConfiguration->mainRelayPin = GPIOB_9; // Frankenstein: low side - out #12
boardConfiguration->triggerInputPins[0] = GPIOC_6; // 2G YEL/BLU engineConfiguration->triggerInputPins[0] = GPIOC_6; // 2G YEL/BLU
boardConfiguration->triggerInputPins[1] = GPIOA_5; // 2E White CKP engineConfiguration->triggerInputPins[1] = GPIOA_5; // 2E White CKP
setCommonNTCSensor(&engineConfiguration->clt, 2700); setCommonNTCSensor(&engineConfiguration->clt, 2700);
setCommonNTCSensor(&engineConfiguration->iat, 2700); setCommonNTCSensor(&engineConfiguration->iat, 2700);
@ -117,19 +117,19 @@ void setRoverv8(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
engineConfiguration->tpsMax = convertVoltageTo10bitADC(4.538); engineConfiguration->tpsMax = convertVoltageTo10bitADC(4.538);
// Stepper logic: // Stepper logic:
boardConfiguration->idle.stepperDirectionPin = GPIOB_10; engineConfiguration->idle.stepperDirectionPin = GPIOB_10;
boardConfiguration->idle.stepperStepPin = GPIOB_15; engineConfiguration->idle.stepperStepPin = GPIOB_15;
engineConfiguration->stepperEnablePin = GPIOB_14; engineConfiguration->stepperEnablePin = GPIOB_14;
engineConfiguration->idleStepperReactionTime = 10; engineConfiguration->idleStepperReactionTime = 10;
engineConfiguration->idleStepperTotalSteps = 150; engineConfiguration->idleStepperTotalSteps = 150;
boardConfiguration->useStepperIdle = false; engineConfiguration->useStepperIdle = false;
// set injection_pin_mode 0 // set injection_pin_mode 0
boardConfiguration->injectionPinMode = OM_DEFAULT; engineConfiguration->injectionPinMode = OM_DEFAULT;
boardConfiguration->canTxPin = GPIOB_6; engineConfiguration->canTxPin = GPIOB_6;
boardConfiguration->canRxPin = GPIOB_12; engineConfiguration->canRxPin = GPIOB_12;
engineConfiguration->canWriteEnabled = true; engineConfiguration->canWriteEnabled = true;
engineConfiguration->canReadEnabled = false; engineConfiguration->canReadEnabled = false;
engineConfiguration->canNbcType = CAN_BUS_MAZDA_RX8; engineConfiguration->canNbcType = CAN_BUS_MAZDA_RX8;
@ -138,10 +138,10 @@ void setRoverv8(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
setAlgorithm(LM_SPEED_DENSITY PASS_CONFIG_PARAMETER_SUFFIX); setAlgorithm(LM_SPEED_DENSITY PASS_CONFIG_PARAMETER_SUFFIX);
// todo: make this official Frankenstein joystick? // todo: make this official Frankenstein joystick?
boardConfiguration->joystickCenterPin = GPIOD_8; engineConfiguration->joystickCenterPin = GPIOD_8;
boardConfiguration->joystickAPin = GPIOD_10; engineConfiguration->joystickAPin = GPIOD_10;
boardConfiguration->joystickBPin = GPIO_UNASSIGNED; engineConfiguration->joystickBPin = GPIO_UNASSIGNED;
boardConfiguration->joystickCPin = GPIO_UNASSIGNED; engineConfiguration->joystickCPin = GPIO_UNASSIGNED;
boardConfiguration->joystickDPin = GPIOD_11; engineConfiguration->joystickDPin = GPIOD_11;
} }

View File

@ -9,7 +9,7 @@
#include "engine_configuration.h" #include "engine_configuration.h"
void setFrankenstein_01_LCD(board_configuration_s *boardConfiguration); void setFrankenstein_01_LCD(engine_configuration_s *engineConfiguration);
void setRoverv8(DECLARE_CONFIG_PARAMETER_SIGNATURE); void setRoverv8(DECLARE_CONFIG_PARAMETER_SIGNATURE);
#endif /* ROVER_V8_H_ */ #endif /* ROVER_V8_H_ */

View File

@ -36,7 +36,7 @@ void setSachs(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
engineConfiguration->trigger.customTotalToothCount = 50; engineConfiguration->trigger.customTotalToothCount = 50;
engineConfiguration->trigger.customSkippedToothCount = 2; engineConfiguration->trigger.customSkippedToothCount = 2;
boardConfiguration->useSerialPort = false; engineConfiguration->useSerialPort = false;
// Frankenstein analog input #1: PA1 adc1 MAP // Frankenstein analog input #1: PA1 adc1 MAP
// Frankenstein analog input #2: PA3 adc3 TPS // Frankenstein analog input #2: PA3 adc3 TPS
@ -75,12 +75,12 @@ void setSachs(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
// Frankenstein: low side - out #11: PB8 // Frankenstein: low side - out #11: PB8
// Frankenstein: low side - out #12: PB9 // Frankenstein: low side - out #12: PB9
boardConfiguration->triggerInputPins[0] = GPIOA_5; engineConfiguration->triggerInputPins[0] = GPIOA_5;
boardConfiguration->triggerInputPins[1] = GPIO_UNASSIGNED; engineConfiguration->triggerInputPins[1] = GPIO_UNASSIGNED;
boardConfiguration->injectionPins[0] = GPIOC_15; engineConfiguration->injectionPins[0] = GPIOC_15;
boardConfiguration->fuelPumpPin = GPIOE_6; engineConfiguration->fuelPumpPin = GPIOE_6;
// todo: extract a method? figure out something smarter // todo: extract a method? figure out something smarter
setFuelRpmBin(800, 15000 PASS_CONFIG_PARAMETER_SUFFIX); setFuelRpmBin(800, 15000 PASS_CONFIG_PARAMETER_SUFFIX);
@ -90,6 +90,6 @@ void setSachs(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
engineConfiguration->hasFrequencyReportingMapSensor = true; engineConfiguration->hasFrequencyReportingMapSensor = true;
engineConfiguration->frequencyReportingMapInputPin = GPIOC_6; engineConfiguration->frequencyReportingMapInputPin = GPIOC_6;
boardConfiguration->mapFrequency100Kpa = 159; engineConfiguration->mapFrequency100Kpa = 159;
boardConfiguration->mapFrequency0Kpa = 80; engineConfiguration->mapFrequency0Kpa = 80;
} }

View File

@ -14,7 +14,7 @@
EXTERN_CONFIG; EXTERN_CONFIG;
void setSubaru2003Wrx(DECLARE_CONFIG_PARAMETER_SIGNATURE) { void setSubaru2003Wrx(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
setFrankenso_01_LCD(boardConfiguration); setFrankenso_01_LCD(engineConfiguration);
setFrankenso0_1_joystick(engineConfiguration); setFrankenso0_1_joystick(engineConfiguration);
engineConfiguration->trigger.type = TT_TOOTHED_WHEEL; engineConfiguration->trigger.type = TT_TOOTHED_WHEEL;
@ -23,16 +23,16 @@ void setSubaru2003Wrx(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
engineConfiguration->sensorChartFrequency = 2; engineConfiguration->sensorChartFrequency = 2;
boardConfiguration->useStepperIdle = true; engineConfiguration->useStepperIdle = true;
// See http://rusefi.com/forum/viewtopic.php?f=4&t=1161 // See http://rusefi.com/forum/viewtopic.php?f=4&t=1161
boardConfiguration->idle.stepperDirectionPin = GPIOD_1; // top stepper drive pin, white wire recommended engineConfiguration->idle.stepperDirectionPin = GPIOD_1; // top stepper drive pin, white wire recommended
boardConfiguration->idle.stepperStepPin = GPIOD_6; // yellow wire recommended engineConfiguration->idle.stepperStepPin = GPIOD_6; // yellow wire recommended
engineConfiguration->stepperEnablePin = GPIOB_1; // bottom stepper driver board pin, blue wire recommended engineConfiguration->stepperEnablePin = GPIOB_1; // bottom stepper driver board pin, blue wire recommended
boardConfiguration->triggerSimulatorPins[0] = GPIO_UNASSIGNED; // we want to avoid PD1 conflict engineConfiguration->triggerSimulatorPins[0] = GPIO_UNASSIGNED; // we want to avoid PD1 conflict
boardConfiguration->triggerSimulatorPins[1] = GPIO_UNASSIGNED; engineConfiguration->triggerSimulatorPins[1] = GPIO_UNASSIGNED;
boardConfiguration->triggerSimulatorPins[2] = GPIO_UNASSIGNED; engineConfiguration->triggerSimulatorPins[2] = GPIO_UNASSIGNED;
} }
/* /*

View File

@ -19,7 +19,7 @@ void setSuzukiVitara(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
engineConfiguration->ignitionMode = IM_ONE_COIL; engineConfiguration->ignitionMode = IM_ONE_COIL;
engineConfiguration->injectionMode = IM_SIMULTANEOUS; engineConfiguration->injectionMode = IM_SIMULTANEOUS;
boardConfiguration->mainRelayPin = GPIOE_6; engineConfiguration->mainRelayPin = GPIOE_6;
} }

View File

@ -38,20 +38,19 @@ void setTestEngineConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
engineConfiguration->ignitionMode = IM_ONE_COIL; engineConfiguration->ignitionMode = IM_ONE_COIL;
setConstantDwell(3 PASS_CONFIG_PARAMETER_SUFFIX); // 50% duty cycle @ 5000 rpm setConstantDwell(3 PASS_CONFIG_PARAMETER_SUFFIX); // 50% duty cycle @ 5000 rpm
board_configuration_s *bc = &engineConfiguration->bc; engineConfiguration->malfunctionIndicatorPin = GPIO_UNASSIGNED;
bc->malfunctionIndicatorPin = GPIO_UNASSIGNED;
boardConfiguration->ignitionPins[0] = GPIOC_7; // #1 engineConfiguration->ignitionPins[0] = GPIOC_7; // #1
boardConfiguration->ignitionPins[1] = GPIO_UNASSIGNED; // #2 engineConfiguration->ignitionPins[1] = GPIO_UNASSIGNED; // #2
boardConfiguration->ignitionPins[2] = GPIO_UNASSIGNED; // #3 engineConfiguration->ignitionPins[2] = GPIO_UNASSIGNED; // #3
boardConfiguration->ignitionPins[3] = GPIO_UNASSIGNED; // #4 engineConfiguration->ignitionPins[3] = GPIO_UNASSIGNED; // #4
boardConfiguration->ignitionPins[4] = GPIO_UNASSIGNED; // #5 engineConfiguration->ignitionPins[4] = GPIO_UNASSIGNED; // #5
boardConfiguration->ignitionPins[5] = GPIO_UNASSIGNED; // #6 engineConfiguration->ignitionPins[5] = GPIO_UNASSIGNED; // #6
boardConfiguration->logicAnalyzerPins[0] = GPIO_UNASSIGNED; engineConfiguration->logicAnalyzerPins[0] = GPIO_UNASSIGNED;
boardConfiguration->logicAnalyzerPins[1] = GPIO_UNASSIGNED; engineConfiguration->logicAnalyzerPins[1] = GPIO_UNASSIGNED;
boardConfiguration->logicAnalyzerPins[2] = GPIO_UNASSIGNED; engineConfiguration->logicAnalyzerPins[2] = GPIO_UNASSIGNED;
boardConfiguration->logicAnalyzerPins[3] = GPIO_UNASSIGNED; engineConfiguration->logicAnalyzerPins[3] = GPIO_UNASSIGNED;
} }
void setTestVVTEngineConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE) { void setTestVVTEngineConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
@ -65,7 +64,7 @@ void setTestVVTEngineConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
// set algorithm 3 // set algorithm 3
setAlgorithm(LM_SPEED_DENSITY PASS_CONFIG_PARAMETER_SUFFIX); setAlgorithm(LM_SPEED_DENSITY PASS_CONFIG_PARAMETER_SUFFIX);
boardConfiguration->triggerInputPins[1] = GPIO_UNASSIGNED; engineConfiguration->triggerInputPins[1] = GPIO_UNASSIGNED;
engineConfiguration->camInputs[0] = GPIOA_5; engineConfiguration->camInputs[0] = GPIOA_5;
// set global_trigger_offset_angle 0 // set global_trigger_offset_angle 0

View File

@ -32,22 +32,22 @@ static void common2jz(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
// set ignition_mode 1 // set ignition_mode 1
engineConfiguration->ignitionMode = IM_INDIVIDUAL_COILS; engineConfiguration->ignitionMode = IM_INDIVIDUAL_COILS;
boardConfiguration->ignitionPins[0] = GPIOE_14; engineConfiguration->ignitionPins[0] = GPIOE_14;
boardConfiguration->ignitionPins[1] = GPIOC_7; engineConfiguration->ignitionPins[1] = GPIOC_7;
boardConfiguration->ignitionPins[2] = GPIOC_9; engineConfiguration->ignitionPins[2] = GPIOC_9;
boardConfiguration->ignitionPins[3] = GPIOE_10; engineConfiguration->ignitionPins[3] = GPIOE_10;
boardConfiguration->ignitionPins[4] = GPIOE_8; engineConfiguration->ignitionPins[4] = GPIOE_8;
boardConfiguration->ignitionPins[5] = GPIOE_12; engineConfiguration->ignitionPins[5] = GPIOE_12;
boardConfiguration->injectionPins[0] = GPIOB_9; // #1 engineConfiguration->injectionPins[0] = GPIOB_9; // #1
boardConfiguration->injectionPins[1] = GPIOE_2; // #2 engineConfiguration->injectionPins[1] = GPIOE_2; // #2
boardConfiguration->injectionPins[2] = GPIOB_8; // #3 engineConfiguration->injectionPins[2] = GPIOB_8; // #3
boardConfiguration->injectionPins[3] = GPIOB_7; // #4 engineConfiguration->injectionPins[3] = GPIOB_7; // #4
boardConfiguration->injectionPins[4] = GPIOE_3; // #5 engineConfiguration->injectionPins[4] = GPIOE_3; // #5
boardConfiguration->injectionPins[5] = GPIOE_4; // #6 engineConfiguration->injectionPins[5] = GPIOE_4; // #6
boardConfiguration->fuelPumpPin = GPIO_UNASSIGNED; engineConfiguration->fuelPumpPin = GPIO_UNASSIGNED;
// chartsize 450 // chartsize 450
engineConfiguration->engineChartSize = 450; engineConfiguration->engineChartSize = 450;
@ -87,10 +87,10 @@ void setToyota_jzs147EngineConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
// engineConfiguration->injectionMode = IM_BATCH; // engineConfiguration->injectionMode = IM_BATCH;
// engineConfiguration->twoWireBatchInjection = true; // engineConfiguration->twoWireBatchInjection = true;
// boardConfiguration->triggerInputPins[0] = GPIOA_5; // engineConfiguration->triggerInputPins[0] = GPIOA_5;
// boardConfiguration->triggerInputPins[1] = GPIOC_6; // engineConfiguration->triggerInputPins[1] = GPIOC_6;
boardConfiguration->isSdCardEnabled = false; engineConfiguration->isSdCardEnabled = false;
} }
@ -98,13 +98,13 @@ void setToyota_jzs147EngineConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
void setToyota_2jz_vics(DECLARE_CONFIG_PARAMETER_SIGNATURE) { void setToyota_2jz_vics(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
common2jz(PASS_CONFIG_PARAMETER_SIGNATURE); common2jz(PASS_CONFIG_PARAMETER_SIGNATURE);
boardConfiguration->isSdCardEnabled = true; engineConfiguration->isSdCardEnabled = true;
setOperationMode(engineConfiguration, FOUR_STROKE_CRANK_SENSOR); setOperationMode(engineConfiguration, FOUR_STROKE_CRANK_SENSOR);
engineConfiguration->trigger.type = TT_2JZ_3_34; engineConfiguration->trigger.type = TT_2JZ_3_34;
boardConfiguration->triggerInputPins[0] = GPIOA_5; // crank sensor engineConfiguration->triggerInputPins[0] = GPIOA_5; // crank sensor
boardConfiguration->triggerInputPins[1] = GPIO_UNASSIGNED; // cam sensor will he handled by custom vtti code engineConfiguration->triggerInputPins[1] = GPIO_UNASSIGNED; // cam sensor will he handled by custom vtti code
engineConfiguration->camInputs[0] = GPIOC_6; engineConfiguration->camInputs[0] = GPIOC_6;
engineConfiguration->vvtMode = VVT_2GZ; engineConfiguration->vvtMode = VVT_2GZ;

View File

@ -48,11 +48,11 @@ void setVwAba(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
engineConfiguration->ignitionMode = IM_ONE_COIL; engineConfiguration->ignitionMode = IM_ONE_COIL;
boardConfiguration->ignitionPins[0] = GPIOE_14; // Frankenso high side - pin 1G engineConfiguration->ignitionPins[0] = GPIOE_14; // Frankenso high side - pin 1G
boardConfiguration->ignitionPins[1] = GPIO_UNASSIGNED; engineConfiguration->ignitionPins[1] = GPIO_UNASSIGNED;
boardConfiguration->ignitionPins[2] = GPIO_UNASSIGNED; engineConfiguration->ignitionPins[2] = GPIO_UNASSIGNED;
boardConfiguration->ignitionPins[3] = GPIO_UNASSIGNED; engineConfiguration->ignitionPins[3] = GPIO_UNASSIGNED;
boardConfiguration->ignitionPinMode = OM_DEFAULT; engineConfiguration->ignitionPinMode = OM_DEFAULT;
float mapRange = 110; float mapRange = 110;
@ -60,7 +60,7 @@ void setVwAba(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
setFuelTablesLoadBin(20, mapRange PASS_CONFIG_PARAMETER_SUFFIX); setFuelTablesLoadBin(20, mapRange PASS_CONFIG_PARAMETER_SUFFIX);
setTimingLoadBin(20, mapRange PASS_CONFIG_PARAMETER_SUFFIX); setTimingLoadBin(20, mapRange PASS_CONFIG_PARAMETER_SUFFIX);
boardConfiguration->isSdCardEnabled = false; engineConfiguration->isSdCardEnabled = false;
engineConfiguration->tpsMin = 740; engineConfiguration->tpsMin = 740;
engineConfiguration->tpsMax = 135; engineConfiguration->tpsMax = 135;
} }

View File

@ -31,39 +31,39 @@ void setZil130(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
boardConfiguration->malfunctionIndicatorPin = GPIO_UNASSIGNED; engineConfiguration->malfunctionIndicatorPin = GPIO_UNASSIGNED;
// engineConfiguration->twoWireBatchInjection = true; // engineConfiguration->twoWireBatchInjection = true;
boardConfiguration->injectionPinMode = OM_INVERTED; engineConfiguration->injectionPinMode = OM_INVERTED;
boardConfiguration->injectionPins[0] = GPIOB_8; // #1 engineConfiguration->injectionPins[0] = GPIOB_8; // #1
boardConfiguration->injectionPins[1] = GPIOE_2; // #2 engineConfiguration->injectionPins[1] = GPIOE_2; // #2
boardConfiguration->injectionPins[2] = GPIOE_3; // #3 engineConfiguration->injectionPins[2] = GPIOE_3; // #3
boardConfiguration->injectionPins[3] = GPIOE_4; // #4 engineConfiguration->injectionPins[3] = GPIOE_4; // #4
boardConfiguration->injectionPins[4] = GPIO_UNASSIGNED; // #5 engineConfiguration->injectionPins[4] = GPIO_UNASSIGNED; // #5
boardConfiguration->injectionPins[5] = GPIO_UNASSIGNED; // #6 engineConfiguration->injectionPins[5] = GPIO_UNASSIGNED; // #6
boardConfiguration->injectionPins[6] = GPIO_UNASSIGNED; engineConfiguration->injectionPins[6] = GPIO_UNASSIGNED;
boardConfiguration->injectionPins[5] = GPIO_UNASSIGNED; engineConfiguration->injectionPins[5] = GPIO_UNASSIGNED;
boardConfiguration->ignitionPins[0] = GPIOB_5; // #1 engineConfiguration->ignitionPins[0] = GPIOB_5; // #1
boardConfiguration->ignitionPins[1] = GPIOB_6; // #2 engineConfiguration->ignitionPins[1] = GPIOB_6; // #2
boardConfiguration->ignitionPins[2] = GPIO_UNASSIGNED; // #3 engineConfiguration->ignitionPins[2] = GPIO_UNASSIGNED; // #3
boardConfiguration->ignitionPins[3] = GPIOB_7; // #4 engineConfiguration->ignitionPins[3] = GPIOB_7; // #4
boardConfiguration->ignitionPins[4] = GPIOC_7; // #5 engineConfiguration->ignitionPins[4] = GPIOC_7; // #5
// fuel pump // fuel pump
boardConfiguration->fuelPumpPin = GPIOD_4; engineConfiguration->fuelPumpPin = GPIOD_4;
// idle // idle
boardConfiguration->idle.solenoidPin = GPIOC_14; engineConfiguration->idle.solenoidPin = GPIOC_14;
boardConfiguration->idle.solenoidPinMode = OM_INVERTED; engineConfiguration->idle.solenoidPinMode = OM_INVERTED;
boardConfiguration->idle.solenoidFrequency = 300; engineConfiguration->idle.solenoidFrequency = 300;
boardConfiguration->manIdlePosition = 50; // set_idle_pwm 50 engineConfiguration->manIdlePosition = 50; // set_idle_pwm 50
// disable sd_card // disable sd_card
boardConfiguration->sdCardCsPin = GPIO_UNASSIGNED; engineConfiguration->sdCardCsPin = GPIO_UNASSIGNED;
boardConfiguration->is_enabled_spi_2 = false; engineConfiguration->is_enabled_spi_2 = false;
boardConfiguration->is_enabled_spi_3 = false; engineConfiguration->is_enabled_spi_3 = false;
boardConfiguration->max31855spiDevice = SPI_NONE; engineConfiguration->max31855spiDevice = SPI_NONE;
boardConfiguration->fanPin = GPIO_UNASSIGNED; engineConfiguration->fanPin = GPIO_UNASSIGNED;
} }

View File

@ -49,7 +49,7 @@ static void runCommands() {
chThdSleepMilliseconds(1000); // safety chThdSleepMilliseconds(1000); // safety
// Store current serial port speed - we're going to change it // Store current serial port speed - we're going to change it
int savedSerialSpeed = CONFIGB(tunerStudioSerialSpeed); int savedSerialSpeed = CONFIG(tunerStudioSerialSpeed);
int prevBaudIdx = -1, baudIdx = -1, baudListIdx = 0; int prevBaudIdx = -1, baudIdx = -1, baudListIdx = 0;
int cmdIdx = 0; int cmdIdx = 0;
@ -75,7 +75,7 @@ static void runCommands() {
} }
chThdSleepMilliseconds(10); // safety chThdSleepMilliseconds(10); // safety
// change the port speed // change the port speed
CONFIGB(tunerStudioSerialSpeed) = restoreAndExit ? savedSerialSpeed : baudRates[baudIdx]; CONFIG(tunerStudioSerialSpeed) = restoreAndExit ? savedSerialSpeed : baudRates[baudIdx];
// init UART // init UART
startTsPort(tsChannel); startTsPort(tsChannel);
chThdSleepMilliseconds(10); // safety chThdSleepMilliseconds(10); // safety
@ -160,7 +160,7 @@ void bluetoothStart(ts_channel_s *tsChan, bluetooth_module_e moduleType, const c
tsChannel = tsChan; tsChannel = tsChan;
// if a binary protocol uses USB, we cannot init the bluetooth module! // if a binary protocol uses USB, we cannot init the bluetooth module!
if (!CONFIGB(useSerialPort)) { if (!CONFIG(useSerialPort)) {
scheduleMsg(&btLogger, "Failed! Serial Port connection is disabled!"); scheduleMsg(&btLogger, "Failed! Serial Port connection is disabled!");
return; return;
} }

View File

@ -152,7 +152,7 @@ void printTsStats(void) {
scheduleMsg(&tsLogger, "TS RX on %s", hwPortname(engineConfiguration->binarySerialRxPin)); scheduleMsg(&tsLogger, "TS RX on %s", hwPortname(engineConfiguration->binarySerialRxPin));
scheduleMsg(&tsLogger, "TS TX on %s @%d", hwPortname(engineConfiguration->binarySerialTxPin), scheduleMsg(&tsLogger, "TS TX on %s @%d", hwPortname(engineConfiguration->binarySerialTxPin),
CONFIGB(tunerStudioSerialSpeed)); CONFIG(tunerStudioSerialSpeed));
} }
#endif /* EFI_PROD_CODE */ #endif /* EFI_PROD_CODE */
@ -164,7 +164,7 @@ void printTsStats(void) {
// int fuelMapOffset = (int) (&engineConfiguration->fuelTable) - (int) engineConfiguration; // int fuelMapOffset = (int) (&engineConfiguration->fuelTable) - (int) engineConfiguration;
// scheduleMsg(logger, "fuelTable %d", fuelMapOffset); // scheduleMsg(logger, "fuelTable %d", fuelMapOffset);
// //
// int offset = (int) (&CONFIGB(hip9011Gain)) - (int) engineConfiguration; // int offset = (int) (&CONFIG(hip9011Gain)) - (int) engineConfiguration;
// scheduleMsg(&tsLogger, "hip9011Gain %d", offset); // scheduleMsg(&tsLogger, "hip9011Gain %d", offset);
// //
// offset = (int) (&engineConfiguration->crankingCycleBins) - (int) engineConfiguration; // offset = (int) (&engineConfiguration->crankingCycleBins) - (int) engineConfiguration;
@ -175,7 +175,7 @@ void printTsStats(void) {
} }
static void setTsSpeed(int value) { static void setTsSpeed(int value) {
CONFIGB(tunerStudioSerialSpeed) = value; CONFIG(tunerStudioSerialSpeed) = value;
printTsStats(); printTsStats();
} }

View File

@ -99,7 +99,7 @@ void startTsPort(ts_channel_s *tsChannel) {
return; return;
#endif /* CONSOLE_USB_DEVICE */ #endif /* CONSOLE_USB_DEVICE */
#if defined(TS_UART_DEVICE) || defined(TS_SERIAL_DEVICE) #if defined(TS_UART_DEVICE) || defined(TS_SERIAL_DEVICE)
if (CONFIGB(useSerialPort)) { if (CONFIG(useSerialPort)) {
print("TunerStudio over USART"); print("TunerStudio over USART");
/** /**
@ -115,7 +115,7 @@ void startTsPort(ts_channel_s *tsChannel) {
iqObjectInit(&tsUartDma.fifoRxQueue, tsUartDma.buffer, sizeof(tsUartDma.buffer), NULL, NULL); iqObjectInit(&tsUartDma.fifoRxQueue, tsUartDma.buffer, sizeof(tsUartDma.buffer), NULL, NULL);
// start DMA driver // start DMA driver
tsDmaUartConfig.speed = CONFIGB(tunerStudioSerialSpeed); tsDmaUartConfig.speed = CONFIG(tunerStudioSerialSpeed);
uartStart(TS_UART_DEVICE, &tsDmaUartConfig); uartStart(TS_UART_DEVICE, &tsDmaUartConfig);
// start continuous DMA transfer using our circular buffer // start continuous DMA transfer using our circular buffer
@ -124,11 +124,11 @@ void startTsPort(ts_channel_s *tsChannel) {
#elif TS_UART_MODE #elif TS_UART_MODE
print("Using UART mode"); print("Using UART mode");
// start DMA driver // start DMA driver
tsUartConfig.speed = CONFIGB(tunerStudioSerialSpeed); tsUartConfig.speed = CONFIG(tunerStudioSerialSpeed);
uartStart(TS_UART_DEVICE, &tsUartConfig); uartStart(TS_UART_DEVICE, &tsUartConfig);
#elif defined(TS_SERIAL_DEVICE) #elif defined(TS_SERIAL_DEVICE)
print("Using Serial mode"); print("Using Serial mode");
tsSerialConfig.speed = CONFIGB(tunerStudioSerialSpeed); tsSerialConfig.speed = CONFIG(tunerStudioSerialSpeed);
sdStart(TS_SERIAL_DEVICE, &tsSerialConfig); sdStart(TS_SERIAL_DEVICE, &tsSerialConfig);
@ -148,7 +148,7 @@ bool stopTsPort(ts_channel_s *tsChannel) {
//usb_serial_stop(); //usb_serial_stop();
return false; return false;
#endif #endif
if (CONFIGB(useSerialPort)) { if (CONFIG(useSerialPort)) {
// todo: disable Rx/Tx pads? // todo: disable Rx/Tx pads?
#if (TS_UART_DMA_MODE || TS_UART_MODE) #if (TS_UART_DMA_MODE || TS_UART_MODE)
uartStop(TS_UART_DEVICE); uartStop(TS_UART_DEVICE);

View File

@ -452,21 +452,21 @@ void printOverallStatus(systime_t nowSeconds) {
int seconds = getTimeNowSeconds(); int seconds = getTimeNowSeconds();
printCurrentState(&logger, seconds, getConfigurationName(engineConfiguration->engineType), FIRMWARE_ID); printCurrentState(&logger, seconds, getConfigurationName(engineConfiguration->engineType), FIRMWARE_ID);
#if EFI_PROD_CODE #if EFI_PROD_CODE
printOutPin(PROTOCOL_CRANK1, CONFIGB(triggerInputPins)[0]); printOutPin(PROTOCOL_CRANK1, CONFIG(triggerInputPins)[0]);
printOutPin(PROTOCOL_CRANK2, CONFIGB(triggerInputPins)[1]); printOutPin(PROTOCOL_CRANK2, CONFIG(triggerInputPins)[1]);
printOutPin(PROTOCOL_VVT_NAME, engineConfiguration->camInputs[0]); printOutPin(PROTOCOL_VVT_NAME, engineConfiguration->camInputs[0]);
printOutPin(PROTOCOL_HIP_NAME, CONFIGB(hip9011IntHoldPin)); printOutPin(PROTOCOL_HIP_NAME, CONFIG(hip9011IntHoldPin));
printOutPin(PROTOCOL_TACH_NAME, CONFIGB(tachOutputPin)); printOutPin(PROTOCOL_TACH_NAME, CONFIG(tachOutputPin));
printOutPin(PROTOCOL_DIZZY_NAME, engineConfiguration->dizzySparkOutputPin); printOutPin(PROTOCOL_DIZZY_NAME, engineConfiguration->dizzySparkOutputPin);
#if EFI_LOGIC_ANALYZER #if EFI_LOGIC_ANALYZER
printOutPin(PROTOCOL_WA_CHANNEL_1, CONFIGB(logicAnalyzerPins)[0]); printOutPin(PROTOCOL_WA_CHANNEL_1, CONFIG(logicAnalyzerPins)[0]);
printOutPin(PROTOCOL_WA_CHANNEL_2, CONFIGB(logicAnalyzerPins)[1]); printOutPin(PROTOCOL_WA_CHANNEL_2, CONFIG(logicAnalyzerPins)[1]);
#endif /* EFI_LOGIC_ANALYZER */ #endif /* EFI_LOGIC_ANALYZER */
for (int i = 0; i < engineConfiguration->specs.cylindersCount; i++) { for (int i = 0; i < engineConfiguration->specs.cylindersCount; i++) {
printOutPin(enginePins.coils[i].getShortName(), CONFIGB(ignitionPins)[i]); printOutPin(enginePins.coils[i].getShortName(), CONFIG(ignitionPins)[i]);
printOutPin(enginePins.injectors[i].getShortName(), CONFIGB(injectionPins)[i]); printOutPin(enginePins.injectors[i].getShortName(), CONFIG(injectionPins)[i]);
} }
for (int i = 0; i < AUX_DIGITAL_VALVE_COUNT;i++) { for (int i = 0; i < AUX_DIGITAL_VALVE_COUNT;i++) {
printOutPin(enginePins.auxValve[i].getShortName(), engineConfiguration->auxValves[i]); printOutPin(enginePins.auxValve[i].getShortName(), engineConfiguration->auxValves[i]);
@ -586,14 +586,14 @@ static OutputPin *leds[] = { &enginePins.warningLedPin, &enginePins.runningLedPi
static void initStatusLeds(void) { static void initStatusLeds(void) {
enginePins.communicationLedPin.initPin("led: comm status", engineConfiguration->communicationLedPin); enginePins.communicationLedPin.initPin("led: comm status", engineConfiguration->communicationLedPin);
// we initialize this here so that we can blink it on start-up // we initialize this here so that we can blink it on start-up
enginePins.checkEnginePin.initPin("MalfunctionIndicator", CONFIGB(malfunctionIndicatorPin), &CONFIGB(malfunctionIndicatorPinMode)); enginePins.checkEnginePin.initPin("MalfunctionIndicator", CONFIG(malfunctionIndicatorPin), &CONFIG(malfunctionIndicatorPinMode));
enginePins.warningLedPin.initPin("led: warning status", engineConfiguration->warningLedPin); enginePins.warningLedPin.initPin("led: warning status", engineConfiguration->warningLedPin);
enginePins.runningLedPin.initPin("led: running status", engineConfiguration->runningLedPin); enginePins.runningLedPin.initPin("led: running status", engineConfiguration->runningLedPin);
enginePins.debugTriggerSync.initPin("debug: sync", CONFIGB(debugTriggerSync)); enginePins.debugTriggerSync.initPin("debug: sync", CONFIG(debugTriggerSync));
enginePins.debugTimerCallback.initPin("debug: timer callback", CONFIGB(debugTimerCallback)); enginePins.debugTimerCallback.initPin("debug: timer callback", CONFIG(debugTimerCallback));
enginePins.debugSetTimer.initPin("debug: set timer", CONFIGB(debugSetTimer)); enginePins.debugSetTimer.initPin("debug: set timer", CONFIG(debugSetTimer));
} }
#define BLINKING_PERIOD_MS 33 #define BLINKING_PERIOD_MS 33
@ -680,8 +680,8 @@ public:
private: private:
void PeriodicTask(efitime_t nowNt) override { void PeriodicTask(efitime_t nowNt) override {
UNUSED(nowNt); UNUSED(nowNt);
setPeriod(NOT_TOO_OFTEN(10 /* ms */, engineConfiguration->bc.lcdThreadPeriodMs)); setPeriod(NOT_TOO_OFTEN(10 /* ms */, engineConfiguration->lcdThreadPeriodMs));
if (engineConfiguration->bc.useLcdScreen) { if (engineConfiguration->useLcdScreen) {
#if EFI_HD44780_LCD #if EFI_HD44780_LCD
updateHD44780lcd(); updateHD44780lcd();
#endif #endif

View File

@ -86,7 +86,7 @@ class AlternatorController : public PeriodicTimerController {
float vBatt = getVBatt(PASS_ENGINE_PARAMETER_SIGNATURE); float vBatt = getVBatt(PASS_ENGINE_PARAMETER_SIGNATURE);
float targetVoltage = engineConfiguration->targetVBatt; float targetVoltage = engineConfiguration->targetVBatt;
if (CONFIGB(onOffAlternatorLogic)) { if (CONFIG(onOffAlternatorLogic)) {
float h = 0.1; float h = 0.1;
bool newState = (vBatt < targetVoltage - h) || (currentPlainOnOffState && vBatt < targetVoltage); bool newState = (vBatt < targetVoltage - h) || (currentPlainOnOffState && vBatt < targetVoltage);
enginePins.alternatorPin.setValue(newState); enginePins.alternatorPin.setValue(newState);
@ -102,7 +102,7 @@ class AlternatorController : public PeriodicTimerController {
currentAltDuty = alternatorPid.getOutput(targetVoltage, vBatt); currentAltDuty = alternatorPid.getOutput(targetVoltage, vBatt);
if (CONFIGB(isVerboseAlternator)) { if (CONFIG(isVerboseAlternator)) {
scheduleMsg(logger, "alt duty: %.2f/vbatt=%.2f/p=%.2f/i=%.2f/d=%.2f int=%.2f", currentAltDuty, vBatt, scheduleMsg(logger, "alt duty: %.2f/vbatt=%.2f/p=%.2f/i=%.2f/d=%.2f int=%.2f", currentAltDuty, vBatt,
alternatorPid.getP(), alternatorPid.getI(), alternatorPid.getD(), alternatorPid.getIntegration()); alternatorPid.getP(), alternatorPid.getI(), alternatorPid.getD(), alternatorPid.getIntegration());
} }
@ -116,7 +116,7 @@ static AlternatorController instance;
void showAltInfo(void) { void showAltInfo(void) {
scheduleMsg(logger, "alt=%s @%s t=%dms", boolToString(engineConfiguration->isAlternatorControlEnabled), scheduleMsg(logger, "alt=%s @%s t=%dms", boolToString(engineConfiguration->isAlternatorControlEnabled),
hwPortname(CONFIGB(alternatorControlPin)), hwPortname(CONFIG(alternatorControlPin)),
engineConfiguration->alternatorControl.periodMs); engineConfiguration->alternatorControl.periodMs);
scheduleMsg(logger, "p=%.2f/i=%.2f/d=%.2f offset=%.2f", engineConfiguration->alternatorControl.pFactor, scheduleMsg(logger, "p=%.2f/i=%.2f/d=%.2f offset=%.2f", engineConfiguration->alternatorControl.pFactor,
0, 0, engineConfiguration->alternatorControl.offset); // todo: i & d 0, 0, engineConfiguration->alternatorControl.offset); // todo: i & d
@ -160,17 +160,17 @@ void onConfigurationChangeAlternatorCallback(engine_configuration_s *previousCon
void initAlternatorCtrl(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX) { void initAlternatorCtrl(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX) {
logger = sharedLogger; logger = sharedLogger;
addConsoleAction("altinfo", showAltInfo); addConsoleAction("altinfo", showAltInfo);
if (CONFIGB(alternatorControlPin) == GPIO_UNASSIGNED) if (CONFIG(alternatorControlPin) == GPIO_UNASSIGNED)
return; return;
if (CONFIGB(onOffAlternatorLogic)) { if (CONFIG(onOffAlternatorLogic)) {
enginePins.alternatorPin.initPin("on/off alternator", CONFIGB(alternatorControlPin)); enginePins.alternatorPin.initPin("on/off alternator", CONFIG(alternatorControlPin));
} else { } else {
startSimplePwmExt(&alternatorControl, startSimplePwmExt(&alternatorControl,
"Alternator control", "Alternator control",
&engine->executor, &engine->executor,
CONFIGB(alternatorControlPin), CONFIG(alternatorControlPin),
&enginePins.alternatorPin, &enginePins.alternatorPin,
engineConfiguration->alternatorPwmFrequency, 0.1, (pwm_gen_callback*)applyAlternatorPinState); engineConfiguration->alternatorPwmFrequency, 0.1, (pwm_gen_callback*)applyAlternatorPinState);
} }

View File

@ -238,7 +238,7 @@ void EtbController::PeriodicTask() {
return; return;
} }
if (boardConfiguration->pauseEtbControl) { if (engineConfiguration->pauseEtbControl) {
m_motor->set(0); m_motor->set(0);
return; return;
} }
@ -270,7 +270,7 @@ void EtbController::PeriodicTask() {
int rpm = GET_RPM(); int rpm = GET_RPM();
engine->engineState.targetFromTable = pedal2tpsMap.getValue(rpm / RPM_1_BYTE_PACKING_MULT, pedalPosition); engine->engineState.targetFromTable = pedal2tpsMap.getValue(rpm / RPM_1_BYTE_PACKING_MULT, pedalPosition);
percent_t etbIdleAddition = CONFIGB(useETBforIdleControl) ? engine->engineState.idle.etbIdleAddition : 0; percent_t etbIdleAddition = CONFIG(useETBforIdleControl) ? engine->engineState.idle.etbIdleAddition : 0;
percent_t targetPosition = engine->engineState.targetFromTable + etbIdleAddition; percent_t targetPosition = engine->engineState.targetFromTable + etbIdleAddition;
if (engineConfiguration->debugMode == DBG_ETB_LOGIC) { if (engineConfiguration->debugMode == DBG_ETB_LOGIC) {

View File

@ -112,18 +112,18 @@ void idleDebug(const char *msg, percent_t value) {
static void showIdleInfo(void) { static void showIdleInfo(void) {
const char * idleModeStr = getIdle_mode_e(engineConfiguration->idleMode); const char * idleModeStr = getIdle_mode_e(engineConfiguration->idleMode);
scheduleMsg(logger, "idleMode=%s position=%.2f isStepper=%s", idleModeStr, scheduleMsg(logger, "idleMode=%s position=%.2f isStepper=%s", idleModeStr,
getIdlePosition(), boolToString(CONFIGB(useStepperIdle))); getIdlePosition(), boolToString(CONFIG(useStepperIdle)));
if (CONFIGB(useStepperIdle)) { if (CONFIG(useStepperIdle)) {
scheduleMsg(logger, "directionPin=%s reactionTime=%.2f", hwPortname(CONFIGB(idle).stepperDirectionPin), scheduleMsg(logger, "directionPin=%s reactionTime=%.2f", hwPortname(CONFIG(idle).stepperDirectionPin),
engineConfiguration->idleStepperReactionTime); engineConfiguration->idleStepperReactionTime);
scheduleMsg(logger, "stepPin=%s steps=%d", hwPortname(CONFIGB(idle).stepperStepPin), scheduleMsg(logger, "stepPin=%s steps=%d", hwPortname(CONFIG(idle).stepperStepPin),
engineConfiguration->idleStepperTotalSteps); engineConfiguration->idleStepperTotalSteps);
scheduleMsg(logger, "enablePin=%s/%d", hwPortname(engineConfiguration->stepperEnablePin), scheduleMsg(logger, "enablePin=%s/%d", hwPortname(engineConfiguration->stepperEnablePin),
engineConfiguration->stepperEnablePinMode); engineConfiguration->stepperEnablePinMode);
} else { } else {
scheduleMsg(logger, "idle valve freq=%d on %s", CONFIGB(idle).solenoidFrequency, scheduleMsg(logger, "idle valve freq=%d on %s", CONFIG(idle).solenoidFrequency,
hwPortname(CONFIGB(idle).solenoidPin)); hwPortname(CONFIG(idle).solenoidPin));
} }
@ -138,10 +138,10 @@ void setIdleMode(idle_mode_e value) {
} }
static void applyIACposition(percent_t position) { static void applyIACposition(percent_t position) {
if (CONFIGB(useETBforIdleControl)) { if (CONFIG(useETBforIdleControl)) {
engine->engineState.idle.etbIdleAddition = position / 100 * CONFIG(etbIdleThrottleRange); engine->engineState.idle.etbIdleAddition = position / 100 * CONFIG(etbIdleThrottleRange);
#if ! EFI_UNIT_TEST #if ! EFI_UNIT_TEST
} if (CONFIGB(useStepperIdle)) { } if (CONFIG(useStepperIdle)) {
iacMotor.setTargetPosition(position / 100 * engineConfiguration->idleStepperTotalSteps); iacMotor.setTargetPosition(position / 100 * engineConfiguration->idleStepperTotalSteps);
#endif /* EFI_UNIT_TEST */ #endif /* EFI_UNIT_TEST */
} else { } else {
@ -165,14 +165,14 @@ void setIdleValvePosition(int positionPercent) {
showIdleInfo(); showIdleInfo();
#endif /* EFI_UNIT_TEST */ #endif /* EFI_UNIT_TEST */
// todo: this is not great that we have to write into configuration here // todo: this is not great that we have to write into configuration here
CONFIGB(manIdlePosition) = positionPercent; CONFIG(manIdlePosition) = positionPercent;
} }
#endif /* EFI_UNIT_TEST */ #endif /* EFI_UNIT_TEST */
static percent_t manualIdleController(float cltCorrection DECLARE_ENGINE_PARAMETER_SUFFIX) { static percent_t manualIdleController(float cltCorrection DECLARE_ENGINE_PARAMETER_SUFFIX) {
percent_t correctedPosition = cltCorrection * CONFIGB(manIdlePosition); percent_t correctedPosition = cltCorrection * CONFIG(manIdlePosition);
// let's put the value into the right range // let's put the value into the right range
correctedPosition = maxF(correctedPosition, 0.01); correctedPosition = maxF(correctedPosition, 0.01);
@ -223,7 +223,7 @@ static bool isOutOfAutomaticIdleCondition(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
inputPosition = getTPS(PASS_ENGINE_PARAMETER_SIGNATURE); inputPosition = getTPS(PASS_ENGINE_PARAMETER_SIGNATURE);
} }
return inputPosition > CONFIGB(idlePidDeactivationTpsThreshold); return inputPosition > CONFIG(idlePidDeactivationTpsThreshold);
} }
/** /**
@ -287,7 +287,7 @@ static percent_t automaticIdleController(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
// Apply PID Deactivation Threshold as a smooth taper for TPS transients. // Apply PID Deactivation Threshold as a smooth taper for TPS transients.
percent_t tpsPos = getTPS(PASS_ENGINE_PARAMETER_SIGNATURE); percent_t tpsPos = getTPS(PASS_ENGINE_PARAMETER_SIGNATURE);
// if tps==0 then PID just works as usual, or we completely disable it if tps>=threshold // if tps==0 then PID just works as usual, or we completely disable it if tps>=threshold
newValue = interpolateClamped(0.0f, newValue, CONFIGB(idlePidDeactivationTpsThreshold), engine->engineState.idle.baseIdlePosition, tpsPos); newValue = interpolateClamped(0.0f, newValue, CONFIG(idlePidDeactivationTpsThreshold), engine->engineState.idle.baseIdlePosition, tpsPos);
// Interpolate to the manual position when RPM is close to the upper RPM limit (if idlePidRpmUpperLimit is set). // Interpolate to the manual position when RPM is close to the upper RPM limit (if idlePidRpmUpperLimit is set).
// If RPM increases and the throttle is closed, then we're in coasting mode, and we should smoothly disable auto-pid. // If RPM increases and the throttle is closed, then we're in coasting mode, and we should smoothly disable auto-pid.
@ -297,7 +297,7 @@ static percent_t automaticIdleController(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
int idlePidLowerRpm = targetRpm + CONFIG(idlePidRpmDeadZone); int idlePidLowerRpm = targetRpm + CONFIG(idlePidRpmDeadZone);
if (CONFIG(idlePidRpmUpperLimit) > 0) { if (CONFIG(idlePidRpmUpperLimit) > 0) {
engine->engineState.idle.idleState = PID_UPPER; engine->engineState.idle.idleState = PID_UPPER;
if (CONFIGB(useIacTableForCoasting) && hasCltSensor()) { if (CONFIG(useIacTableForCoasting) && hasCltSensor()) {
percent_t iacPosForCoasting = interpolate2d("iacCoasting", getCoolantTemperature(), CONFIG(iacCoastingBins), CONFIG(iacCoasting)); percent_t iacPosForCoasting = interpolate2d("iacCoasting", getCoolantTemperature(), CONFIG(iacCoastingBins), CONFIG(iacCoasting));
newValue = interpolateClamped(idlePidLowerRpm, newValue, idlePidLowerRpm + CONFIG(idlePidRpmUpperLimit), iacPosForCoasting, rpm); newValue = interpolateClamped(idlePidLowerRpm, newValue, idlePidLowerRpm + CONFIG(idlePidRpmUpperLimit), iacPosForCoasting, rpm);
} else { } else {
@ -341,8 +341,8 @@ static percent_t automaticIdleController(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
#if EFI_GPIO_HARDWARE #if EFI_GPIO_HARDWARE
// this value is not used yet // this value is not used yet
if (CONFIGB(clutchDownPin) != GPIO_UNASSIGNED) { if (CONFIG(clutchDownPin) != GPIO_UNASSIGNED) {
engine->clutchDownState = efiReadPin(CONFIGB(clutchDownPin)); engine->clutchDownState = efiReadPin(CONFIG(clutchDownPin));
} }
if (hasAcToggle(PASS_ENGINE_PARAMETER_SIGNATURE)) { if (hasAcToggle(PASS_ENGINE_PARAMETER_SIGNATURE)) {
bool result = getAcToggle(PASS_ENGINE_PARAMETER_SIGNATURE); bool result = getAcToggle(PASS_ENGINE_PARAMETER_SIGNATURE);
@ -412,7 +412,7 @@ static percent_t automaticIdleController(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
percent_t tpsPos = getTPS(PASS_ENGINE_PARAMETER_SIGNATURE); percent_t tpsPos = getTPS(PASS_ENGINE_PARAMETER_SIGNATURE);
float additionalAir = (float)engineConfiguration->iacByTpsTaper; float additionalAir = (float)engineConfiguration->iacByTpsTaper;
iacPosition += interpolateClamped(0.0f, 0.0f, CONFIGB(idlePidDeactivationTpsThreshold), additionalAir, tpsPos); iacPosition += interpolateClamped(0.0f, 0.0f, CONFIG(idlePidDeactivationTpsThreshold), additionalAir, tpsPos);
// taper transition from cranking to running (uint32_t to float conversion is safe here) // taper transition from cranking to running (uint32_t to float conversion is safe here)
if (engineConfiguration->afterCrankingIACtaperDuration > 0) if (engineConfiguration->afterCrankingIACtaperDuration > 0)
@ -472,7 +472,7 @@ void setDefaultIdleParameters(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
void onConfigurationChangeIdleCallback(engine_configuration_s *previousConfiguration) { void onConfigurationChangeIdleCallback(engine_configuration_s *previousConfiguration) {
shouldResetPid = !idlePid.isSame(&previousConfiguration->idleRpmPid); shouldResetPid = !idlePid.isSame(&previousConfiguration->idleRpmPid);
idleSolenoid.setFrequency(CONFIGB(idle).solenoidFrequency); idleSolenoid.setFrequency(CONFIG(idle).solenoidFrequency);
} }
void setTargetIdleRpm(int value) { void setTargetIdleRpm(int value) {
@ -534,31 +534,31 @@ static void applyIdleSolenoidPinState(int stateIndex, PwmConfig *state) /* pwm_g
bool isIdleHardwareRestartNeeded() { bool isIdleHardwareRestartNeeded() {
return isConfigurationChanged(stepperEnablePin) || return isConfigurationChanged(stepperEnablePin) ||
isConfigurationChanged(stepperEnablePinMode) || isConfigurationChanged(stepperEnablePinMode) ||
isConfigurationChanged(bc.idle.stepperStepPin) || isConfigurationChanged(idle.stepperStepPin) ||
isConfigurationChanged(bc.idle.solenoidFrequency) || isConfigurationChanged(idle.solenoidFrequency) ||
isConfigurationChanged(bc.useStepperIdle) || isConfigurationChanged(useStepperIdle) ||
// isConfigurationChanged() || // isConfigurationChanged() ||
isConfigurationChanged(bc.useETBforIdleControl) || isConfigurationChanged(useETBforIdleControl) ||
isConfigurationChanged(bc.idle.solenoidPin); isConfigurationChanged(idle.solenoidPin);
} }
void stopIdleHardware(DECLARE_ENGINE_PARAMETER_SIGNATURE) { void stopIdleHardware(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
#if EFI_PROD_CODE #if EFI_PROD_CODE
brain_pin_markUnused(activeConfiguration.stepperEnablePin); brain_pin_markUnused(activeConfiguration.stepperEnablePin);
brain_pin_markUnused(activeConfiguration.bc.idle.stepperStepPin); brain_pin_markUnused(activeConfiguration.idle.stepperStepPin);
brain_pin_markUnused(activeConfiguration.bc.idle.solenoidPin); brain_pin_markUnused(activeConfiguration.idle.solenoidPin);
// brain_pin_markUnused(activeConfiguration.bc.idle.); // brain_pin_markUnused(activeConfiguration.idle.);
// brain_pin_markUnused(activeConfiguration.bc.idle.); // brain_pin_markUnused(activeConfiguration.idle.);
// brain_pin_markUnused(activeConfiguration.bc.idle.); // brain_pin_markUnused(activeConfiguration.idle.);
// brain_pin_markUnused(activeConfiguration.bc.idle.); // brain_pin_markUnused(activeConfiguration.idle.);
#endif /* EFI_PROD_CODE */ #endif /* EFI_PROD_CODE */
} }
void initIdleHardware(DECLARE_ENGINE_PARAMETER_SIGNATURE) { void initIdleHardware(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
if (CONFIGB(useStepperIdle)) { if (CONFIG(useStepperIdle)) {
iacMotor.initialize(CONFIGB(idle).stepperStepPin, iacMotor.initialize(CONFIG(idle).stepperStepPin,
CONFIGB(idle).stepperDirectionPin, CONFIG(idle).stepperDirectionPin,
engineConfiguration->stepperDirectionPinMode, engineConfiguration->stepperDirectionPinMode,
engineConfiguration->idleStepperReactionTime, engineConfiguration->idleStepperReactionTime,
engineConfiguration->idleStepperTotalSteps, engineConfiguration->idleStepperTotalSteps,
@ -566,14 +566,14 @@ void initIdleHardware(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
logger); logger);
// This greatly improves PID accuracy for steppers with a small number of steps // This greatly improves PID accuracy for steppers with a small number of steps
idlePositionSensitivityThreshold = 1.0f / engineConfiguration->idleStepperTotalSteps; idlePositionSensitivityThreshold = 1.0f / engineConfiguration->idleStepperTotalSteps;
} else if (!engineConfiguration->bc.useETBforIdleControl) { } else if (!engineConfiguration->useETBforIdleControl) {
/** /**
* Start PWM for idleValvePin * Start PWM for idleValvePin
*/ */
startSimplePwmExt(&idleSolenoid, "Idle Valve", startSimplePwmExt(&idleSolenoid, "Idle Valve",
&engine->executor, &engine->executor,
CONFIGB(idle).solenoidPin, &enginePins.idleSolenoidPin, CONFIG(idle).solenoidPin, &enginePins.idleSolenoidPin,
CONFIGB(idle).solenoidFrequency, CONFIGB(manIdlePosition) / 100, CONFIG(idle).solenoidFrequency, CONFIG(manIdlePosition) / 100,
(pwm_gen_callback*)applyIdleSolenoidPinState); (pwm_gen_callback*)applyIdleSolenoidPinState);
idlePositionSensitivityThreshold = 0.0f; idlePositionSensitivityThreshold = 0.0f;
} }
@ -642,9 +642,9 @@ void startIdleThread(Logging*sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX) {
#if ! EFI_UNIT_TEST #if ! EFI_UNIT_TEST
// this is neutral/no gear switch input. on Miata it's wired both to clutch pedal and neutral in gearbox // this is neutral/no gear switch input. on Miata it's wired both to clutch pedal and neutral in gearbox
// this switch is not used yet // this switch is not used yet
if (CONFIGB(clutchDownPin) != GPIO_UNASSIGNED) { if (CONFIG(clutchDownPin) != GPIO_UNASSIGNED) {
efiSetPadMode("clutch down switch", CONFIGB(clutchDownPin), efiSetPadMode("clutch down switch", CONFIG(clutchDownPin),
getInputMode(CONFIGB(clutchDownPinMode))); getInputMode(CONFIG(clutchDownPinMode)));
} }
if (CONFIG(clutchUpPin) != GPIO_UNASSIGNED) { if (CONFIG(clutchUpPin) != GPIO_UNASSIGNED) {
@ -654,7 +654,7 @@ void startIdleThread(Logging*sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX) {
if (CONFIG(throttlePedalUpPin) != GPIO_UNASSIGNED) { if (CONFIG(throttlePedalUpPin) != GPIO_UNASSIGNED) {
efiSetPadMode("throttle pedal up switch", CONFIG(throttlePedalUpPin), efiSetPadMode("throttle pedal up switch", CONFIG(throttlePedalUpPin),
getInputMode(CONFIGB(throttlePedalUpPinMode))); getInputMode(CONFIG(throttlePedalUpPinMode)));
} }
if (engineConfiguration->brakePedalPin != GPIO_UNASSIGNED) { if (engineConfiguration->brakePedalPin != GPIO_UNASSIGNED) {

View File

@ -35,7 +35,7 @@ static void startPwmTest(int freq) {
/** /**
* See custom_engine.cpp for pinout * See custom_engine.cpp for pinout
*/ */
// currently this is PB9 by default - see CONFIGB(injectionPins) // currently this is PB9 by default - see CONFIG(injectionPins)
startSimplePwm(&pwmTest[1], "tester", &enginePins.injectors[0], freq / 1.3333333333, 0.5f, applyPinState); startSimplePwm(&pwmTest[1], "tester", &enginePins.injectors[0], freq / 1.3333333333, 0.5f, applyPinState);
// currently this is PE2 by default // currently this is PE2 by default
startSimplePwm(&pwmTest[2], "tester", &enginePins.injectors[1], freq / 1000, 0.5f, applyPinState); startSimplePwm(&pwmTest[2], "tester", &enginePins.injectors[1], freq / 1000, 0.5f, applyPinState);

View File

@ -68,7 +68,7 @@ static const ignition_table_t defaultIatTiming = {
#endif /* IGN_LOAD_COUNT == DEFAULT_IGN_LOAD_COUNT */ #endif /* IGN_LOAD_COUNT == DEFAULT_IGN_LOAD_COUNT */
bool isStep1Condition(int rpm DECLARE_ENGINE_PARAMETER_SUFFIX) { bool isStep1Condition(int rpm DECLARE_ENGINE_PARAMETER_SUFFIX) {
return CONFIGB(enabledStep1Limiter) && rpm >= engineConfiguration->step1rpm; return CONFIG(enabledStep1Limiter) && rpm >= engineConfiguration->step1rpm;
} }
/** /**
@ -104,7 +104,7 @@ static angle_t getRunningAdvance(int rpm, float engineLoad DECLARE_ENGINE_PARAME
float idleAdvance = interpolate2d("idleAdvance", rpm, config->idleAdvanceBins, config->idleAdvance); float idleAdvance = interpolate2d("idleAdvance", rpm, config->idleAdvanceBins, config->idleAdvance);
// interpolate between idle table and normal (running) table using TPS threshold // interpolate between idle table and normal (running) table using TPS threshold
float tps = getTPS(PASS_ENGINE_PARAMETER_SIGNATURE); float tps = getTPS(PASS_ENGINE_PARAMETER_SIGNATURE);
advanceAngle = interpolateClamped(0.0f, idleAdvance, CONFIGB(idlePidDeactivationTpsThreshold), advanceAngle, tps); advanceAngle = interpolateClamped(0.0f, idleAdvance, CONFIG(idlePidDeactivationTpsThreshold), advanceAngle, tps);
} }
engine->m.advanceLookupTime = getTimeNowLowerNt() - engine->m.beforeAdvance; engine->m.advanceLookupTime = getTimeNowLowerNt() - engine->m.beforeAdvance;
@ -120,11 +120,11 @@ angle_t getAdvanceCorrections(int rpm DECLARE_ENGINE_PARAMETER_SUFFIX) {
} }
// PID Ignition Advance angle correction // PID Ignition Advance angle correction
float pidTimingCorrection = 0.0f; float pidTimingCorrection = 0.0f;
if (CONFIGB(useIdleTimingPidControl)) { if (CONFIG(useIdleTimingPidControl)) {
int targetRpm = getTargetRpmForIdleCorrection(PASS_ENGINE_PARAMETER_SIGNATURE); int targetRpm = getTargetRpmForIdleCorrection(PASS_ENGINE_PARAMETER_SIGNATURE);
int rpmDelta = absI(rpm - targetRpm); int rpmDelta = absI(rpm - targetRpm);
float tps = getTPS(PASS_ENGINE_PARAMETER_SIGNATURE); float tps = getTPS(PASS_ENGINE_PARAMETER_SIGNATURE);
if (tps >= CONFIGB(idlePidDeactivationTpsThreshold)) { if (tps >= CONFIG(idlePidDeactivationTpsThreshold)) {
// we are not in the idle mode anymore, so the 'reset' flag will help us when we return to the idle. // we are not in the idle mode anymore, so the 'reset' flag will help us when we return to the idle.
shouldResetTimingPid = true; shouldResetTimingPid = true;
} }
@ -139,7 +139,7 @@ angle_t getAdvanceCorrections(int rpm DECLARE_ENGINE_PARAMETER_SUFFIX) {
percent_t timingRawCorr = idleTimingPid.getOutput(targetRpm, rpm, percent_t timingRawCorr = idleTimingPid.getOutput(targetRpm, rpm,
/* is this the right dTime? this period is not exactly the period at which this code is invoked*/engineConfiguration->idleTimingPid.periodMs); /* is this the right dTime? this period is not exactly the period at which this code is invoked*/engineConfiguration->idleTimingPid.periodMs);
// tps idle-running falloff // tps idle-running falloff
pidTimingCorrection = interpolateClamped(0.0f, timingRawCorr, CONFIGB(idlePidDeactivationTpsThreshold), 0.0f, tps); pidTimingCorrection = interpolateClamped(0.0f, timingRawCorr, CONFIG(idlePidDeactivationTpsThreshold), 0.0f, tps);
// rpm falloff // rpm falloff
pidTimingCorrection = interpolateClamped(0.0f, pidTimingCorrection, CONFIG(idlePidFalloffDeltaRpm), 0.0f, rpmDelta - CONFIG(idleTimingPidWorkZone)); pidTimingCorrection = interpolateClamped(0.0f, pidTimingCorrection, CONFIG(idlePidFalloffDeltaRpm), 0.0f, rpmDelta - CONFIG(idleTimingPidWorkZone));
} else { } else {

View File

@ -155,15 +155,15 @@ void Engine::updateSlowSensors(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
#if EFI_ENGINE_CONTROL #if EFI_ENGINE_CONTROL
int rpm = GET_RPM(); int rpm = GET_RPM();
isEngineChartEnabled = CONFIG(isEngineChartEnabled) && rpm < CONFIG(engineSnifferRpmThreshold); isEngineChartEnabled = CONFIG(isEngineChartEnabled) && rpm < CONFIG(engineSnifferRpmThreshold);
sensorChartMode = rpm < CONFIG(sensorSnifferRpmThreshold) ? CONFIGB(sensorChartMode) : SC_OFF; sensorChartMode = rpm < CONFIG(sensorSnifferRpmThreshold) ? CONFIG(sensorChartMode) : SC_OFF;
engineState.updateSlowSensors(PASS_ENGINE_PARAMETER_SIGNATURE); engineState.updateSlowSensors(PASS_ENGINE_PARAMETER_SIGNATURE);
// todo: move this logic somewhere to sensors folder? // todo: move this logic somewhere to sensors folder?
if (CONFIG(fuelLevelSensor) != EFI_ADC_NONE) { if (CONFIG(fuelLevelSensor) != EFI_ADC_NONE) {
float fuelLevelVoltage = getVoltageDivided("fuel", engineConfiguration->fuelLevelSensor PASS_ENGINE_PARAMETER_SUFFIX); float fuelLevelVoltage = getVoltageDivided("fuel", engineConfiguration->fuelLevelSensor PASS_ENGINE_PARAMETER_SUFFIX);
sensors.fuelTankLevel = interpolateMsg("fgauge", CONFIGB(fuelLevelEmptyTankVoltage), 0, sensors.fuelTankLevel = interpolateMsg("fgauge", CONFIG(fuelLevelEmptyTankVoltage), 0,
CONFIGB(fuelLevelFullTankVoltage), 100, CONFIG(fuelLevelFullTankVoltage), 100,
fuelLevelVoltage); fuelLevelVoltage);
} }
sensors.vBatt = hasVBatt(PASS_ENGINE_PARAMETER_SIGNATURE) ? getVBatt(PASS_ENGINE_PARAMETER_SIGNATURE) : 12; sensors.vBatt = hasVBatt(PASS_ENGINE_PARAMETER_SIGNATURE) ? getVBatt(PASS_ENGINE_PARAMETER_SIGNATURE) : 12;

View File

@ -205,7 +205,7 @@ void EngineState::periodicFastCallback(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
/** /**
* *0.01 because of https://sourceforge.net/p/rusefi/tickets/153/ * *0.01 because of https://sourceforge.net/p/rusefi/tickets/153/
*/ */
if (CONFIGB(useTPSBasedVeTable)) { if (CONFIG(useTPSBasedVeTable)) {
// todo: should we have 'veTpsMap' fuel_Map3D_t variable here? // todo: should we have 'veTpsMap' fuel_Map3D_t variable here?
currentRawVE = interpolate3d<float, float>(tps, CONFIG(ignitionTpsBins), IGN_TPS_COUNT, rpm, config->veRpmBins, FUEL_RPM_COUNT, veMap.pointers); currentRawVE = interpolate3d<float, float>(tps, CONFIG(ignitionTpsBins), IGN_TPS_COUNT, rpm, config->veRpmBins, FUEL_RPM_COUNT, veMap.pointers);
} else { } else {
@ -215,7 +215,7 @@ void EngineState::periodicFastCallback(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
if (CONFIG(useSeparateVeForIdle)) { if (CONFIG(useSeparateVeForIdle)) {
float idleVe = interpolate2d("idleVe", rpm, config->idleVeBins, config->idleVe); float idleVe = interpolate2d("idleVe", rpm, config->idleVeBins, config->idleVe);
// interpolate between idle table and normal (running) table using TPS threshold // interpolate between idle table and normal (running) table using TPS threshold
currentRawVE = interpolateClamped(0.0f, idleVe, CONFIGB(idlePidDeactivationTpsThreshold), currentRawVE, tps); currentRawVE = interpolateClamped(0.0f, idleVe, CONFIG(idlePidDeactivationTpsThreshold), currentRawVE, tps);
} }
currentBaroCorrectedVE = baroCorrection * currentRawVE * PERCENT_DIV; currentBaroCorrectedVE = baroCorrection * currentRawVE * PERCENT_DIV;
targetAFR = afrMap.getValue(rpm, map); targetAFR = afrMap.getValue(rpm, map);

View File

@ -286,7 +286,7 @@ static void initTemperatureCurve(float *bins, float *values, int size, float def
void prepareVoidConfiguration(engine_configuration_s *engineConfiguration) { void prepareVoidConfiguration(engine_configuration_s *engineConfiguration) {
efiAssertVoid(OBD_PCM_Processor_Fault, engineConfiguration != NULL, "ec NULL"); efiAssertVoid(OBD_PCM_Processor_Fault, engineConfiguration != NULL, "ec NULL");
memset(engineConfiguration, 0, sizeof(engine_configuration_s)); memset(engineConfiguration, 0, sizeof(engine_configuration_s));
board_configuration_s *boardConfiguration = &engineConfiguration->bc;
// Now that GPIO_UNASSIGNED == 0 we do not really need explicit zero assignments since memset above does that // Now that GPIO_UNASSIGNED == 0 we do not really need explicit zero assignments since memset above does that
// todo: migrate 'EFI_ADC_NONE' to '0' and eliminate the need in this method altogether // todo: migrate 'EFI_ADC_NONE' to '0' and eliminate the need in this method altogether
@ -312,7 +312,7 @@ void prepareVoidConfiguration(engine_configuration_s *engineConfiguration) {
engineConfiguration->tps1_1AdcChannel = EFI_ADC_NONE; engineConfiguration->tps1_1AdcChannel = EFI_ADC_NONE;
*/ */
engineConfiguration->tps2_1AdcChannel = EFI_ADC_NONE; engineConfiguration->tps2_1AdcChannel = EFI_ADC_NONE;
engineConfiguration->bc.auxFastSensor1_adcChannel = EFI_ADC_NONE; engineConfiguration->auxFastSensor1_adcChannel = EFI_ADC_NONE;
engineConfiguration->acSwitchAdc = EFI_ADC_NONE; engineConfiguration->acSwitchAdc = EFI_ADC_NONE;
engineConfiguration->externalKnockSenseAdc = EFI_ADC_NONE; engineConfiguration->externalKnockSenseAdc = EFI_ADC_NONE;
engineConfiguration->fuelLevelSensor = EFI_ADC_NONE; engineConfiguration->fuelLevelSensor = EFI_ADC_NONE;
@ -321,7 +321,7 @@ void prepareVoidConfiguration(engine_configuration_s *engineConfiguration) {
engineConfiguration->high_fuel_pressure_sensor_1 = EFI_ADC_NONE; engineConfiguration->high_fuel_pressure_sensor_1 = EFI_ADC_NONE;
engineConfiguration->high_fuel_pressure_sensor_2 = EFI_ADC_NONE; engineConfiguration->high_fuel_pressure_sensor_2 = EFI_ADC_NONE;
boardConfiguration->clutchDownPinMode = PI_PULLUP; engineConfiguration->clutchDownPinMode = PI_PULLUP;
engineConfiguration->clutchUpPinMode = PI_PULLUP; engineConfiguration->clutchUpPinMode = PI_PULLUP;
engineConfiguration->brakePedalPinMode = PI_PULLUP; engineConfiguration->brakePedalPinMode = PI_PULLUP;
} }
@ -353,12 +353,12 @@ void setDefaultBasePins(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
// set UART pads configuration based on the board // set UART pads configuration based on the board
// needed also by bootloader code // needed also by bootloader code
boardConfiguration->useSerialPort = true; engineConfiguration->useSerialPort = true;
engineConfiguration->binarySerialTxPin = GPIOC_10; engineConfiguration->binarySerialTxPin = GPIOC_10;
engineConfiguration->binarySerialRxPin = GPIOC_11; engineConfiguration->binarySerialRxPin = GPIOC_11;
engineConfiguration->consoleSerialTxPin = GPIOC_10; engineConfiguration->consoleSerialTxPin = GPIOC_10;
engineConfiguration->consoleSerialRxPin = GPIOC_11; engineConfiguration->consoleSerialRxPin = GPIOC_11;
boardConfiguration->tunerStudioSerialSpeed = TS_DEFAULT_SPEED; engineConfiguration->tunerStudioSerialSpeed = TS_DEFAULT_SPEED;
engineConfiguration->uartConsoleSerialSpeed = 115200; engineConfiguration->uartConsoleSerialSpeed = 115200;
#if EFI_PROD_CODE #if EFI_PROD_CODE
@ -370,10 +370,10 @@ void setDefaultBasePins(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
// needed also by bootloader code // needed also by bootloader code
// at the moment bootloader does NOT really need SD card, this is a step towards future bootloader SD card usage // at the moment bootloader does NOT really need SD card, this is a step towards future bootloader SD card usage
void setDefaultSdCardParameters(DECLARE_CONFIG_PARAMETER_SIGNATURE) { void setDefaultSdCardParameters(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
boardConfiguration->is_enabled_spi_3 = true; engineConfiguration->is_enabled_spi_3 = true;
engineConfiguration->sdCardSpiDevice = SPI_DEVICE_3; engineConfiguration->sdCardSpiDevice = SPI_DEVICE_3;
boardConfiguration->sdCardCsPin = GPIOD_4; engineConfiguration->sdCardCsPin = GPIOD_4;
boardConfiguration->isSdCardEnabled = true; engineConfiguration->isSdCardEnabled = true;
#if EFI_PROD_CODE #if EFI_PROD_CODE
// call overrided board-specific SD card configuration setup, if needed (for custom boards only) // call overrided board-specific SD card configuration setup, if needed (for custom boards only)
@ -477,7 +477,7 @@ static void setDefaultWarmupFuelEnrichment(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
} }
static void setDefaultFuelCutParameters(DECLARE_ENGINE_PARAMETER_SIGNATURE) { static void setDefaultFuelCutParameters(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
boardConfiguration->coastingFuelCutEnabled = false; engineConfiguration->coastingFuelCutEnabled = false;
engineConfiguration->coastingFuelCutRpmLow = 1300; engineConfiguration->coastingFuelCutRpmLow = 1300;
engineConfiguration->coastingFuelCutRpmHigh = 1500; engineConfiguration->coastingFuelCutRpmHigh = 1500;
engineConfiguration->coastingFuelCutTps = 2; engineConfiguration->coastingFuelCutTps = 2;
@ -578,17 +578,17 @@ static void setDefaultIdleSpeedTarget(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
} }
static void setDefaultStepperIdleParameters(DECLARE_ENGINE_PARAMETER_SIGNATURE) { static void setDefaultStepperIdleParameters(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
boardConfiguration->idle.stepperDirectionPin = GPIOE_10; engineConfiguration->idle.stepperDirectionPin = GPIOE_10;
boardConfiguration->idle.stepperStepPin = GPIOE_12; engineConfiguration->idle.stepperStepPin = GPIOE_12;
engineConfiguration->stepperEnablePin = GPIOE_14; engineConfiguration->stepperEnablePin = GPIOE_14;
engineConfiguration->idleStepperReactionTime = 10; engineConfiguration->idleStepperReactionTime = 10;
engineConfiguration->idleStepperTotalSteps = 150; engineConfiguration->idleStepperTotalSteps = 150;
} }
static void setCanFrankensoDefaults(DECLARE_CONFIG_PARAMETER_SIGNATURE) { static void setCanFrankensoDefaults(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
boardConfiguration->canDeviceMode = CD_USE_CAN2; engineConfiguration->canDeviceMode = CD_USE_CAN2;
boardConfiguration->canTxPin = GPIOB_6; engineConfiguration->canTxPin = GPIOB_6;
boardConfiguration->canRxPin = GPIOB_12; engineConfiguration->canRxPin = GPIOB_12;
} }
/** /**
@ -657,14 +657,14 @@ static void setDefaultEngineConfiguration(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
engineConfiguration->canWriteEnabled = true; engineConfiguration->canWriteEnabled = true;
engineConfiguration->canNbcType = CAN_BUS_MAZDA_RX8; engineConfiguration->canNbcType = CAN_BUS_MAZDA_RX8;
boardConfiguration->sdCardPeriodMs = 50; engineConfiguration->sdCardPeriodMs = 50;
for (int i = 0; i < FSIO_COMMAND_COUNT; i++) { for (int i = 0; i < FSIO_COMMAND_COUNT; i++) {
config->fsioFormulas[i][0] = 0; config->fsioFormulas[i][0] = 0;
} }
CONFIGB(mapMinBufferLength) = 1; CONFIG(mapMinBufferLength) = 1;
engineConfiguration->idlePidRpmDeadZone = 50; engineConfiguration->idlePidRpmDeadZone = 50;
engineConfiguration->startOfCrankingPrimingPulse = 0; engineConfiguration->startOfCrankingPrimingPulse = 0;
@ -806,7 +806,7 @@ static void setDefaultEngineConfiguration(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
engineConfiguration->fuelClosedLoopCltThreshold = 70; engineConfiguration->fuelClosedLoopCltThreshold = 70;
engineConfiguration->fuelClosedLoopRpmThreshold = 900; engineConfiguration->fuelClosedLoopRpmThreshold = 900;
engineConfiguration->fuelClosedLoopTpsThreshold = 80; engineConfiguration->fuelClosedLoopTpsThreshold = 80;
boardConfiguration->fuelClosedLoopAfrLowThreshold = 10.3; engineConfiguration->fuelClosedLoopAfrLowThreshold = 10.3;
engineConfiguration->fuelClosedLoopAfrHighThreshold = 19.8; engineConfiguration->fuelClosedLoopAfrHighThreshold = 19.8;
engineConfiguration->fuelClosedLoopPid.pFactor = -0.1; engineConfiguration->fuelClosedLoopPid.pFactor = -0.1;
@ -821,16 +821,16 @@ static void setDefaultEngineConfiguration(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
engineConfiguration->idleRpmPid.minValue = 0.1; engineConfiguration->idleRpmPid.minValue = 0.1;
engineConfiguration->idleRpmPid.maxValue = 99; engineConfiguration->idleRpmPid.maxValue = 99;
boardConfiguration->idlePidDeactivationTpsThreshold = 2; engineConfiguration->idlePidDeactivationTpsThreshold = 2;
boardConfiguration->idle.solenoidFrequency = 200; engineConfiguration->idle.solenoidFrequency = 200;
// set idle_position 50 // set idle_position 50
boardConfiguration->manIdlePosition = 50; engineConfiguration->manIdlePosition = 50;
engineConfiguration->crankingIACposition = 50; engineConfiguration->crankingIACposition = 50;
// engineConfiguration->idleMode = IM_AUTO; // engineConfiguration->idleMode = IM_AUTO;
engineConfiguration->idleMode = IM_MANUAL; engineConfiguration->idleMode = IM_MANUAL;
boardConfiguration->useStepperIdle = false; engineConfiguration->useStepperIdle = false;
setDefaultStepperIdleParameters(PASS_ENGINE_PARAMETER_SIGNATURE); setDefaultStepperIdleParameters(PASS_ENGINE_PARAMETER_SIGNATURE);
@ -850,7 +850,7 @@ static void setDefaultEngineConfiguration(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
#endif #endif
// performance optimization // performance optimization
boardConfiguration->sensorChartMode = SC_OFF; engineConfiguration->sensorChartMode = SC_OFF;
engineConfiguration->storageMode = MS_AUTO; engineConfiguration->storageMode = MS_AUTO;
@ -945,13 +945,13 @@ static void setDefaultEngineConfiguration(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
engineConfiguration->knockDetectionWindowStart = 35; engineConfiguration->knockDetectionWindowStart = 35;
engineConfiguration->knockDetectionWindowEnd = 135; engineConfiguration->knockDetectionWindowEnd = 135;
boardConfiguration->fuelLevelEmptyTankVoltage = 0; engineConfiguration->fuelLevelEmptyTankVoltage = 0;
boardConfiguration->fuelLevelFullTankVoltage = 5; engineConfiguration->fuelLevelFullTankVoltage = 5;
/** /**
* this is RPM. 10000 rpm is only 166Hz, 800 rpm is 13Hz * this is RPM. 10000 rpm is only 166Hz, 800 rpm is 13Hz
*/ */
boardConfiguration->triggerSimulatorFrequency = 1200; engineConfiguration->triggerSimulatorFrequency = 1200;
engineConfiguration->alternatorPwmFrequency = 300; engineConfiguration->alternatorPwmFrequency = 300;
@ -964,24 +964,24 @@ static void setDefaultEngineConfiguration(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
engineConfiguration->vehicleSpeedCoef = 1.0f; engineConfiguration->vehicleSpeedCoef = 1.0f;
boardConfiguration->logicAnalyzerMode[0] = false; engineConfiguration->logicAnalyzerMode[0] = false;
boardConfiguration->logicAnalyzerMode[1] = false; engineConfiguration->logicAnalyzerMode[1] = false;
engineConfiguration->mapErrorDetectionTooLow = 5; engineConfiguration->mapErrorDetectionTooLow = 5;
engineConfiguration->mapErrorDetectionTooHigh = 250; engineConfiguration->mapErrorDetectionTooHigh = 250;
boardConfiguration->idleThreadPeriodMs = 100; engineConfiguration->idleThreadPeriodMs = 100;
boardConfiguration->consoleLoopPeriodMs = 200; engineConfiguration->consoleLoopPeriodMs = 200;
boardConfiguration->lcdThreadPeriodMs = 300; engineConfiguration->lcdThreadPeriodMs = 300;
boardConfiguration->generalPeriodicThreadPeriodMs = 50; engineConfiguration->generalPeriodicThreadPeriodMs = 50;
boardConfiguration->useLcdScreen = true; engineConfiguration->useLcdScreen = true;
engineConfiguration->hip9011Gain = 1; engineConfiguration->hip9011Gain = 1;
boardConfiguration->isFastAdcEnabled = true; engineConfiguration->isFastAdcEnabled = true;
boardConfiguration->isEngineControlEnabled = true; engineConfiguration->isEngineControlEnabled = true;
boardConfiguration->isVerboseAlternator = false; engineConfiguration->isVerboseAlternator = false;
engineConfiguration->engineLoadAccelLength = 6; engineConfiguration->engineLoadAccelLength = 6;
engineConfiguration->engineLoadAccelEnrichmentThreshold = 5; // kPa engineConfiguration->engineLoadAccelEnrichmentThreshold = 5; // kPa
@ -1000,7 +1000,7 @@ static void setDefaultEngineConfiguration(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
* <reboot ECU> * <reboot ECU>
* fsioinfo * fsioinfo
*/ */
boardConfiguration->fsio_setting[0] = 5000; engineConfiguration->fsio_setting[0] = 5000;
// simple warning light as default configuration // simple warning light as default configuration
// set_fsio_expression 1 "rpm > fsio_setting(1)" // set_fsio_expression 1 "rpm > fsio_setting(1)"
setFsio(0, GPIO_UNASSIGNED, RPM_ABOVE_USER_SETTING_1 PASS_CONFIG_PARAMETER_SUFFIX); setFsio(0, GPIO_UNASSIGNED, RPM_ABOVE_USER_SETTING_1 PASS_CONFIG_PARAMETER_SUFFIX);
@ -1023,36 +1023,36 @@ void setDefaultFrankensoConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
engineConfiguration->hip9011SpiDevice = SPI_DEVICE_2; engineConfiguration->hip9011SpiDevice = SPI_DEVICE_2;
engineConfiguration->cj125SpiDevice = SPI_DEVICE_2; engineConfiguration->cj125SpiDevice = SPI_DEVICE_2;
// boardConfiguration->gps_rx_pin = GPIOB_7; // engineConfiguration->gps_rx_pin = GPIOB_7;
// boardConfiguration->gps_tx_pin = GPIOB_6; // engineConfiguration->gps_tx_pin = GPIOB_6;
boardConfiguration->triggerSimulatorPins[0] = GPIOD_1; engineConfiguration->triggerSimulatorPins[0] = GPIOD_1;
boardConfiguration->triggerSimulatorPins[1] = GPIOD_2; engineConfiguration->triggerSimulatorPins[1] = GPIOD_2;
boardConfiguration->triggerInputPins[0] = GPIOC_6; engineConfiguration->triggerInputPins[0] = GPIOC_6;
boardConfiguration->triggerInputPins[1] = GPIOA_5; engineConfiguration->triggerInputPins[1] = GPIOA_5;
//boardConfiguration->logicAnalyzerPins[1] = GPIOE_5; // GPIOE_5 is a popular option (if available) //engineConfiguration->logicAnalyzerPins[1] = GPIOE_5; // GPIOE_5 is a popular option (if available)
// set this to SPI_DEVICE_3 to enable stimulation // set this to SPI_DEVICE_3 to enable stimulation
//boardConfiguration->digitalPotentiometerSpiDevice = SPI_DEVICE_3; //engineConfiguration->digitalPotentiometerSpiDevice = SPI_DEVICE_3;
boardConfiguration->digitalPotentiometerChipSelect[0] = GPIOD_7; engineConfiguration->digitalPotentiometerChipSelect[0] = GPIOD_7;
boardConfiguration->digitalPotentiometerChipSelect[1] = GPIO_UNASSIGNED; engineConfiguration->digitalPotentiometerChipSelect[1] = GPIO_UNASSIGNED;
boardConfiguration->digitalPotentiometerChipSelect[2] = GPIOD_5; engineConfiguration->digitalPotentiometerChipSelect[2] = GPIOD_5;
boardConfiguration->digitalPotentiometerChipSelect[3] = GPIO_UNASSIGNED; engineConfiguration->digitalPotentiometerChipSelect[3] = GPIO_UNASSIGNED;
boardConfiguration->spi1mosiPin = GPIOB_5; engineConfiguration->spi1mosiPin = GPIOB_5;
boardConfiguration->spi1misoPin = GPIOB_4; engineConfiguration->spi1misoPin = GPIOB_4;
boardConfiguration->spi1sckPin = GPIOB_3; // please note that this pin is also SWO/SWD - Single Wire debug Output engineConfiguration->spi1sckPin = GPIOB_3; // please note that this pin is also SWO/SWD - Single Wire debug Output
boardConfiguration->spi2mosiPin = GPIOB_15; engineConfiguration->spi2mosiPin = GPIOB_15;
boardConfiguration->spi2misoPin = GPIOB_14; engineConfiguration->spi2misoPin = GPIOB_14;
boardConfiguration->spi2sckPin = GPIOB_13; engineConfiguration->spi2sckPin = GPIOB_13;
boardConfiguration->spi3mosiPin = GPIOB_5; engineConfiguration->spi3mosiPin = GPIOB_5;
boardConfiguration->spi3misoPin = GPIOB_4; engineConfiguration->spi3misoPin = GPIOB_4;
boardConfiguration->spi3sckPin = GPIOB_3; engineConfiguration->spi3sckPin = GPIOB_3;
// set optional subsystem configs // set optional subsystem configs
#if EFI_MEMS #if EFI_MEMS
@ -1068,9 +1068,9 @@ void setDefaultFrankensoConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
setDefaultSdCardParameters(PASS_CONFIG_PARAMETER_SIGNATURE); setDefaultSdCardParameters(PASS_CONFIG_PARAMETER_SIGNATURE);
#endif /* EFI_FILE_LOGGING */ #endif /* EFI_FILE_LOGGING */
boardConfiguration->is_enabled_spi_1 = false; engineConfiguration->is_enabled_spi_1 = false;
boardConfiguration->is_enabled_spi_2 = false; engineConfiguration->is_enabled_spi_2 = false;
boardConfiguration->is_enabled_spi_3 = true; engineConfiguration->is_enabled_spi_3 = true;
} }
void resetConfigurationExt(Logging * logger, configuration_callback_t boardCallback, engine_type_e engineType DECLARE_ENGINE_PARAMETER_SUFFIX) { void resetConfigurationExt(Logging * logger, configuration_callback_t boardCallback, engine_type_e engineType DECLARE_ENGINE_PARAMETER_SUFFIX) {
@ -1373,12 +1373,12 @@ void commonFrankensoAnalogInputs(engine_configuration_s *engineConfiguration) {
} }
void setFrankenso0_1_joystick(engine_configuration_s *engineConfiguration) { void setFrankenso0_1_joystick(engine_configuration_s *engineConfiguration) {
board_configuration_s *boardConfiguration = &engineConfiguration->bc;
boardConfiguration->joystickCenterPin = GPIOC_8; engineConfiguration->joystickCenterPin = GPIOC_8;
boardConfiguration->joystickAPin = GPIOD_10; engineConfiguration->joystickAPin = GPIOD_10;
boardConfiguration->joystickBPin = GPIO_UNASSIGNED; engineConfiguration->joystickBPin = GPIO_UNASSIGNED;
boardConfiguration->joystickCPin = GPIO_UNASSIGNED; engineConfiguration->joystickCPin = GPIO_UNASSIGNED;
boardConfiguration->joystickDPin = GPIOD_11; engineConfiguration->joystickDPin = GPIOD_11;
} }
void copyTargetAfrTable(fuel_table_t const source, afr_table_t destination) { void copyTargetAfrTable(fuel_table_t const source, afr_table_t destination) {

View File

@ -344,7 +344,7 @@ float getFuelCutOffCorrection(efitick_t nowNt, int rpm DECLARE_ENGINE_PARAMETER_
float fuelCorr = 1.0f; float fuelCorr = 1.0f;
// coasting fuel cut-off correction // coasting fuel cut-off correction
if (CONFIGB(coastingFuelCutEnabled)) { if (CONFIG(coastingFuelCutEnabled)) {
percent_t tpsPos = getTPS(PASS_ENGINE_PARAMETER_SIGNATURE); percent_t tpsPos = getTPS(PASS_ENGINE_PARAMETER_SIGNATURE);
float map = getMap(PASS_ENGINE_PARAMETER_SIGNATURE); float map = getMap(PASS_ENGINE_PARAMETER_SIGNATURE);

View File

@ -68,20 +68,18 @@
#define DECLARE_ENGINE_PTR \ #define DECLARE_ENGINE_PTR \
Engine *engine = nullptr; \ Engine *engine = nullptr; \
engine_configuration_s *engineConfiguration = nullptr; \ engine_configuration_s *engineConfiguration = nullptr; \
persistent_config_s *config = nullptr; \ persistent_config_s *config = nullptr;
board_configuration_s *boardConfiguration = nullptr;
#define INJECT_ENGINE_REFERENCE(x) \ #define INJECT_ENGINE_REFERENCE(x) \
(x)->engine = engine; \ (x)->engine = engine; \
(x)->engineConfiguration = engineConfiguration; \ (x)->engineConfiguration = engineConfiguration; \
(x)->config = config; \ (x)->config = config;
(x)->boardConfiguration = boardConfiguration;
#define EXPAND_Engine \ #define EXPAND_Engine \
engine_configuration_s *engineConfiguration = engine->engineConfigurationPtr; \ engine_configuration_s *engineConfiguration = engine->engineConfigurationPtr; \
persistent_config_s *config = engine->config; \ persistent_config_s *config = engine->config; \
board_configuration_s *boardConfiguration = &engineConfiguration->bc;
#ifndef EFI_ACTIVE_CONFIGURATION_IN_FLASH #ifndef EFI_ACTIVE_CONFIGURATION_IN_FLASH
// We store a special changeable copy of configuration is RAM, so we can just compare them // We store a special changeable copy of configuration is RAM, so we can just compare them

View File

@ -254,7 +254,7 @@ bool LECalculator::processElement(LEElement *element DECLARE_ENGINE_PARAMETER_SU
float humanIndex = pop(LE_METHOD_FSIO_SETTING); float humanIndex = pop(LE_METHOD_FSIO_SETTING);
int index = (int) humanIndex - 1; int index = (int) humanIndex - 1;
if (index >= 0 && index < FSIO_COMMAND_COUNT) { if (index >= 0 && index < FSIO_COMMAND_COUNT) {
push(element->action, CONFIGB(fsio_setting)[index]); push(element->action, CONFIG(fsio_setting)[index]);
} else { } else {
push(element->action, NAN); push(element->action, NAN);
} }

View File

@ -229,7 +229,7 @@ static void setFsioOutputPin(const char *indexStr, const char *pinName) {
scheduleMsg(logger, "invalid pin name [%s]", pinName); scheduleMsg(logger, "invalid pin name [%s]", pinName);
return; return;
} }
CONFIGB(fsioOutputPins)[index] = pin; CONFIG(fsioOutputPins)[index] = pin;
scheduleMsg(logger, "FSIO output pin #%d [%s]", (index + 1), hwPortname(pin)); scheduleMsg(logger, "FSIO output pin #%d [%s]", (index + 1), hwPortname(pin));
scheduleMsg(logger, "please writeconfig and reboot for pin to take effect"); scheduleMsg(logger, "please writeconfig and reboot for pin to take effect");
showFsioInfo(); showFsioInfo();
@ -242,13 +242,13 @@ static void setFsioOutputPin(const char *indexStr, const char *pinName) {
* index is between zero and LE_COMMAND_LENGTH-1 * index is between zero and LE_COMMAND_LENGTH-1
*/ */
void setFsioExt(int index, brain_pin_e pin, const char * formula, int pwmFrequency DECLARE_CONFIG_PARAMETER_SUFFIX) { void setFsioExt(int index, brain_pin_e pin, const char * formula, int pwmFrequency DECLARE_CONFIG_PARAMETER_SUFFIX) {
CONFIGB(fsioOutputPins)[index] = pin; CONFIG(fsioOutputPins)[index] = pin;
int len = strlen(formula); int len = strlen(formula);
if (len >= LE_COMMAND_LENGTH) { if (len >= LE_COMMAND_LENGTH) {
return; return;
} }
strcpy(config->fsioFormulas[index], formula); strcpy(config->fsioFormulas[index], formula);
CONFIGB(fsioFrequency)[index] = pwmFrequency; CONFIG(fsioFrequency)[index] = pwmFrequency;
} }
void setFsio(int index, brain_pin_e pin, const char * exp DECLARE_CONFIG_PARAMETER_SUFFIX) { void setFsio(int index, brain_pin_e pin, const char * exp DECLARE_CONFIG_PARAMETER_SUFFIX) {
@ -260,7 +260,7 @@ void applyFsioConfiguration(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
for (int i = 0; i < FSIO_COMMAND_COUNT; i++) { for (int i = 0; i < FSIO_COMMAND_COUNT; i++) {
const char *formula = config->fsioFormulas[i]; const char *formula = config->fsioFormulas[i];
LEElement *logic = userPool.parseExpression(formula); LEElement *logic = userPool.parseExpression(formula);
brain_pin_e brainPin = CONFIGB(fsioOutputPins)[i]; brain_pin_e brainPin = CONFIG(fsioOutputPins)[i];
if (brainPin != GPIO_UNASSIGNED && logic == NULL) { if (brainPin != GPIO_UNASSIGNED && logic == NULL) {
warning(CUSTOM_FSIO_PARSING, "parsing [%s]", formula); warning(CUSTOM_FSIO_PARSING, "parsing [%s]", formula);
} }
@ -321,7 +321,7 @@ static const char *getGpioPinName(int index) {
float getFsioOutputValue(int index DECLARE_ENGINE_PARAMETER_SUFFIX) { float getFsioOutputValue(int index DECLARE_ENGINE_PARAMETER_SUFFIX) {
if (state.fsioLogics[index] == NULL) { if (state.fsioLogics[index] == NULL) {
warning(CUSTOM_NO_FSIO, "no FSIO for #%d %s", index + 1, hwPortname(CONFIGB(fsioOutputPins)[index])); warning(CUSTOM_NO_FSIO, "no FSIO for #%d %s", index + 1, hwPortname(CONFIG(fsioOutputPins)[index]));
return NAN; return NAN;
} else { } else {
return calc.getValue2(engine->fsioState.fsioLastValue[index], state.fsioLogics[index] PASS_ENGINE_PARAMETER_SUFFIX); return calc.getValue2(engine->fsioState.fsioLastValue[index], state.fsioLogics[index] PASS_ENGINE_PARAMETER_SUFFIX);
@ -332,12 +332,12 @@ float getFsioOutputValue(int index DECLARE_ENGINE_PARAMETER_SUFFIX) {
* @param index from zero for (FSIO_COMMAND_COUNT - 1) * @param index from zero for (FSIO_COMMAND_COUNT - 1)
*/ */
static void handleFsio(int index DECLARE_ENGINE_PARAMETER_SUFFIX) { static void handleFsio(int index DECLARE_ENGINE_PARAMETER_SUFFIX) {
if (CONFIGB(fsioOutputPins)[index] == GPIO_UNASSIGNED) { if (CONFIG(fsioOutputPins)[index] == GPIO_UNASSIGNED) {
engine->fsioState.fsioLastValue[index] = NAN; engine->fsioState.fsioLastValue[index] = NAN;
return; return;
} }
bool isPwmMode = CONFIGB(fsioFrequency)[index] != NO_PWM; bool isPwmMode = CONFIG(fsioFrequency)[index] != NO_PWM;
float fvalue = getFsioOutputValue(index PASS_ENGINE_PARAMETER_SUFFIX); float fvalue = getFsioOutputValue(index PASS_ENGINE_PARAMETER_SUFFIX);
engine->fsioState.fsioLastValue[index] = fvalue; engine->fsioState.fsioLastValue[index] = fvalue;
@ -410,11 +410,11 @@ static void setFsioFrequency(int index, int frequency) {
scheduleMsg(logger, "invalid FSIO index: %d", index); scheduleMsg(logger, "invalid FSIO index: %d", index);
return; return;
} }
CONFIGB(fsioFrequency)[index] = frequency; CONFIG(fsioFrequency)[index] = frequency;
if (frequency == 0) { if (frequency == 0) {
scheduleMsg(logger, "FSIO output #%d@%s set to on/off mode", index + 1, hwPortname(CONFIGB(fsioOutputPins)[index])); scheduleMsg(logger, "FSIO output #%d@%s set to on/off mode", index + 1, hwPortname(CONFIG(fsioOutputPins)[index]));
} else { } else {
scheduleMsg(logger, "Setting FSIO frequency %dHz on #%d@%s", frequency, index + 1, hwPortname(CONFIGB(fsioOutputPins)[index])); scheduleMsg(logger, "Setting FSIO frequency %dHz on #%d@%s", frequency, index + 1, hwPortname(CONFIG(fsioOutputPins)[index]));
} }
} }
#endif /* EFI_PROD_CODE */ #endif /* EFI_PROD_CODE */
@ -449,23 +449,23 @@ void runFsio(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
} }
#if EFI_FUEL_PUMP #if EFI_FUEL_PUMP
if (CONFIGB(fuelPumpPin) != GPIO_UNASSIGNED) { if (CONFIG(fuelPumpPin) != GPIO_UNASSIGNED) {
setPinState("pump", &enginePins.fuelPumpRelay, fuelPumpLogic PASS_ENGINE_PARAMETER_SUFFIX); setPinState("pump", &enginePins.fuelPumpRelay, fuelPumpLogic PASS_ENGINE_PARAMETER_SUFFIX);
} }
#endif /* EFI_FUEL_PUMP */ #endif /* EFI_FUEL_PUMP */
#if EFI_MAIN_RELAY_CONTROL #if EFI_MAIN_RELAY_CONTROL
if (CONFIGB(mainRelayPin) != GPIO_UNASSIGNED) if (CONFIG(mainRelayPin) != GPIO_UNASSIGNED)
setPinState("main_relay", &enginePins.mainRelay, mainRelayLogic PASS_ENGINE_PARAMETER_SUFFIX); setPinState("main_relay", &enginePins.mainRelay, mainRelayLogic PASS_ENGINE_PARAMETER_SUFFIX);
#else /* EFI_MAIN_RELAY_CONTROL */ #else /* EFI_MAIN_RELAY_CONTROL */
/** /**
* main relay is always on if ECU is on, that's a good enough initial implementation * main relay is always on if ECU is on, that's a good enough initial implementation
*/ */
if (CONFIGB(mainRelayPin) != GPIO_UNASSIGNED) if (CONFIG(mainRelayPin) != GPIO_UNASSIGNED)
enginePins.mainRelay.setValue(true); enginePins.mainRelay.setValue(true);
#endif /* EFI_MAIN_RELAY_CONTROL */ #endif /* EFI_MAIN_RELAY_CONTROL */
if (CONFIGB(starterRelayPin) != GPIO_UNASSIGNED) if (CONFIG(starterRelayPin) != GPIO_UNASSIGNED)
setPinState("starter_relay", &enginePins.starterRelay, starterRelayLogic PASS_ENGINE_PARAMETER_SUFFIX); setPinState("starter_relay", &enginePins.starterRelay, starterRelayLogic PASS_ENGINE_PARAMETER_SUFFIX);
/** /**
@ -475,15 +475,15 @@ void runFsio(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
*/ */
enginePins.o2heater.setValue(engine->rpmCalculator.isRunning(PASS_ENGINE_PARAMETER_SIGNATURE)); enginePins.o2heater.setValue(engine->rpmCalculator.isRunning(PASS_ENGINE_PARAMETER_SIGNATURE));
if (CONFIGB(acRelayPin) != GPIO_UNASSIGNED) { if (CONFIG(acRelayPin) != GPIO_UNASSIGNED) {
setPinState("A/C", &enginePins.acRelay, acRelayLogic PASS_ENGINE_PARAMETER_SUFFIX); setPinState("A/C", &enginePins.acRelay, acRelayLogic PASS_ENGINE_PARAMETER_SUFFIX);
} }
// if (CONFIGB(alternatorControlPin) != GPIO_UNASSIGNED) { // if (CONFIG(alternatorControlPin) != GPIO_UNASSIGNED) {
// setPinState("alternator", &enginePins.alternatorField, alternatorLogic, engine PASS_ENGINE_PARAMETER_SUFFIX); // setPinState("alternator", &enginePins.alternatorField, alternatorLogic, engine PASS_ENGINE_PARAMETER_SUFFIX);
// } // }
if (CONFIGB(fanPin) != GPIO_UNASSIGNED) { if (CONFIG(fanPin) != GPIO_UNASSIGNED) {
setPinState("fan", &enginePins.fanRelay, radiatorFanLogic PASS_ENGINE_PARAMETER_SUFFIX); setPinState("fan", &enginePins.fanRelay, radiatorFanLogic PASS_ENGINE_PARAMETER_SUFFIX);
} }
@ -573,14 +573,14 @@ static void showFsioInfo(void) {
* is the fact that the target audience is more software developers * is the fact that the target audience is more software developers
*/ */
scheduleMsg(logger, "FSIO #%d [%s] at %s@%dHz value=%.2f", (i + 1), exp, scheduleMsg(logger, "FSIO #%d [%s] at %s@%dHz value=%.2f", (i + 1), exp,
hwPortname(CONFIGB(fsioOutputPins)[i]), CONFIGB(fsioFrequency)[i], hwPortname(CONFIG(fsioOutputPins)[i]), CONFIG(fsioFrequency)[i],
engine->fsioState.fsioLastValue[i]); engine->fsioState.fsioLastValue[i]);
// scheduleMsg(logger, "user-defined #%d value=%.2f", i, engine->engineConfigurationPtr2->fsioLastValue[i]); // scheduleMsg(logger, "user-defined #%d value=%.2f", i, engine->engineConfigurationPtr2->fsioLastValue[i]);
showFsio(NULL, state.fsioLogics[i]); showFsio(NULL, state.fsioLogics[i]);
} }
} }
for (int i = 0; i < FSIO_COMMAND_COUNT; i++) { for (int i = 0; i < FSIO_COMMAND_COUNT; i++) {
float v = CONFIGB(fsio_setting)[i]; float v = CONFIG(fsio_setting)[i];
if (!cisnan(v)) { if (!cisnan(v)) {
scheduleMsg(logger, "user property #%d: %.2f", i + 1, v); scheduleMsg(logger, "user property #%d: %.2f", i + 1, v);
} }
@ -604,7 +604,7 @@ static void setFsioSetting(float humanIndexF, float value) {
scheduleMsg(logger, "invalid FSIO index: %d", (int)humanIndexF); scheduleMsg(logger, "invalid FSIO index: %d", (int)humanIndexF);
return; return;
} }
engineConfiguration->bc.fsio_setting[index] = value; engineConfiguration->fsio_setting[index] = value;
showFsioInfo(); showFsioInfo();
#endif #endif
} }
@ -674,20 +674,20 @@ void initFsioImpl(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX) {
alternatorLogic = sysPool.parseExpression(ALTERNATOR_LOGIC); alternatorLogic = sysPool.parseExpression(ALTERNATOR_LOGIC);
#if EFI_MAIN_RELAY_CONTROL #if EFI_MAIN_RELAY_CONTROL
if (CONFIGB(mainRelayPin) != GPIO_UNASSIGNED) if (CONFIG(mainRelayPin) != GPIO_UNASSIGNED)
mainRelayLogic = sysPool.parseExpression(MAIN_RELAY_LOGIC); mainRelayLogic = sysPool.parseExpression(MAIN_RELAY_LOGIC);
#endif /* EFI_MAIN_RELAY_CONTROL */ #endif /* EFI_MAIN_RELAY_CONTROL */
if (CONFIGB(starterRelayPin) != GPIO_UNASSIGNED) if (CONFIG(starterRelayPin) != GPIO_UNASSIGNED)
starterRelayLogic = sysPool.parseExpression(STARTER_RELAY_LOGIC); starterRelayLogic = sysPool.parseExpression(STARTER_RELAY_LOGIC);
#if EFI_PROD_CODE #if EFI_PROD_CODE
for (int i = 0; i < FSIO_COMMAND_COUNT; i++) { for (int i = 0; i < FSIO_COMMAND_COUNT; i++) {
brain_pin_e brainPin = CONFIGB(fsioOutputPins)[i]; brain_pin_e brainPin = CONFIG(fsioOutputPins)[i];
if (brainPin != GPIO_UNASSIGNED) { if (brainPin != GPIO_UNASSIGNED) {
int frequency = CONFIGB(fsioFrequency)[i]; int frequency = CONFIG(fsioFrequency)[i];
if (frequency == 0) { if (frequency == 0) {
enginePins.fsioOutputs[i].initPin(getGpioPinName(i), CONFIGB(fsioOutputPins)[i], &DEFAULT_OUTPUT); enginePins.fsioOutputs[i].initPin(getGpioPinName(i), CONFIG(fsioOutputPins)[i], &DEFAULT_OUTPUT);
} else { } else {
startSimplePwmExt(&fsioPwm[i], "FSIOpwm", startSimplePwmExt(&fsioPwm[i], "FSIOpwm",
&engine->executor, &engine->executor,
@ -739,24 +739,24 @@ extern EnginePins enginePins;
// "Limp-mode" implementation for some RAM-limited configs without FSIO // "Limp-mode" implementation for some RAM-limited configs without FSIO
void runHardcodedFsio(DECLARE_ENGINE_PARAMETER_SIGNATURE) { void runHardcodedFsio(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
// see MAIN_RELAY_LOGIC // see MAIN_RELAY_LOGIC
if (CONFIGB(mainRelayPin) != GPIO_UNASSIGNED) { if (CONFIG(mainRelayPin) != GPIO_UNASSIGNED) {
enginePins.mainRelay.setValue((getTimeNowSeconds() < 2) || (getVBatt(PASS_ENGINE_PARAMETER_SIGNATURE) > 5) || engine->isInShutdownMode()); enginePins.mainRelay.setValue((getTimeNowSeconds() < 2) || (getVBatt(PASS_ENGINE_PARAMETER_SIGNATURE) > 5) || engine->isInShutdownMode());
} }
// see STARTER_RELAY_LOGIC // see STARTER_RELAY_LOGIC
if (CONFIGB(starterRelayPin) != GPIO_UNASSIGNED) { if (CONFIG(starterRelayPin) != GPIO_UNASSIGNED) {
enginePins.starterRelay.setValue(engine->rpmCalculator.getRpm() < engineConfiguration->cranking.rpm); enginePins.starterRelay.setValue(engine->rpmCalculator.getRpm() < engineConfiguration->cranking.rpm);
} }
// see FAN_CONTROL_LOGIC // see FAN_CONTROL_LOGIC
if (CONFIGB(fanPin) != GPIO_UNASSIGNED) { if (CONFIG(fanPin) != GPIO_UNASSIGNED) {
enginePins.fanRelay.setValue((enginePins.fanRelay.getLogicValue() && (getCoolantTemperature() > engineConfiguration->fanOffTemperature)) || enginePins.fanRelay.setValue((enginePins.fanRelay.getLogicValue() && (getCoolantTemperature() > engineConfiguration->fanOffTemperature)) ||
(getCoolantTemperature() > engineConfiguration->fanOnTemperature) || engine->isCltBroken); (getCoolantTemperature() > engineConfiguration->fanOnTemperature) || engine->isCltBroken);
} }
// see AC_RELAY_LOGIC // see AC_RELAY_LOGIC
if (CONFIGB(acRelayPin) != GPIO_UNASSIGNED) { if (CONFIG(acRelayPin) != GPIO_UNASSIGNED) {
enginePins.acRelay.setValue(getAcToggle(PASS_ENGINE_PARAMETER_SIGNATURE) && engine->rpmCalculator.getRpm() > 850); enginePins.acRelay.setValue(getAcToggle(PASS_ENGINE_PARAMETER_SIGNATURE) && engine->rpmCalculator.getRpm() > 850);
} }
// see FUEL_PUMP_LOGIC // see FUEL_PUMP_LOGIC
if (CONFIGB(fuelPumpPin) != GPIO_UNASSIGNED) { if (CONFIG(fuelPumpPin) != GPIO_UNASSIGNED) {
enginePins.fuelPumpRelay.setValue((getTimeNowSeconds() < engineConfiguration->startUpFuelPumpDuration) || (engine->rpmCalculator.getRpm() > 0)); enginePins.fuelPumpRelay.setValue((getTimeNowSeconds() < engineConfiguration->startUpFuelPumpDuration) || (engine->rpmCalculator.getRpm() > 0));
} }

View File

@ -157,7 +157,7 @@ class PeriodicSlowController : public PeriodicTimerController {
int getPeriodMs() override { int getPeriodMs() override {
// we need at least protection from zero value while resetting configuration // we need at least protection from zero value while resetting configuration
int periodMs = maxI(50, CONFIGB(generalPeriodicThreadPeriodMs)); int periodMs = maxI(50, CONFIG(generalPeriodicThreadPeriodMs));
return periodMs; return periodMs;
} }
}; };
@ -389,7 +389,7 @@ static void printAnalogChannelInfoExt(const char *name, adc_channel_e hwChannel,
} }
if (fastAdc.isHwUsed(hwChannel)) { if (fastAdc.isHwUsed(hwChannel)) {
scheduleMsg(&logger, "fast enabled=%s", boolToString(CONFIGB(isFastAdcEnabled))); scheduleMsg(&logger, "fast enabled=%s", boolToString(CONFIG(isFastAdcEnabled)));
} }
float voltage = adcVoltage * dividerCoeff; float voltage = adcVoltage * dividerCoeff;
@ -769,7 +769,7 @@ void initEngineContoller(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX)
initEgoAveraging(PASS_ENGINE_PARAMETER_SIGNATURE); initEgoAveraging(PASS_ENGINE_PARAMETER_SIGNATURE);
#if EFI_ENGINE_CONTROL && EFI_SHAFT_POSITION_INPUT #if EFI_ENGINE_CONTROL && EFI_SHAFT_POSITION_INPUT
if (CONFIGB(isEngineControlEnabled)) { if (CONFIG(isEngineControlEnabled)) {
/** /**
* This method initialized the main listener which actually runs injectors & ignition * This method initialized the main listener which actually runs injectors & ignition
*/ */

View File

@ -342,7 +342,7 @@ static void fuelClosedLoopCorrection(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
if (GET_RPM_VALUE < CONFIG(fuelClosedLoopRpmThreshold) || if (GET_RPM_VALUE < CONFIG(fuelClosedLoopRpmThreshold) ||
getCoolantTemperature() < CONFIG(fuelClosedLoopCltThreshold) || getCoolantTemperature() < CONFIG(fuelClosedLoopCltThreshold) ||
getTPS(PASS_ENGINE_PARAMETER_SIGNATURE) > CONFIG(fuelClosedLoopTpsThreshold) || getTPS(PASS_ENGINE_PARAMETER_SIGNATURE) > CONFIG(fuelClosedLoopTpsThreshold) ||
ENGINE(sensors.currentAfr) < CONFIGB(fuelClosedLoopAfrLowThreshold) || ENGINE(sensors.currentAfr) < CONFIG(fuelClosedLoopAfrLowThreshold) ||
ENGINE(sensors.currentAfr) > engineConfiguration->fuelClosedLoopAfrHighThreshold) { ENGINE(sensors.currentAfr) > engineConfiguration->fuelClosedLoopAfrHighThreshold) {
engine->engineState.running.pidCorrection = 0; engine->engineState.running.pidCorrection = 0;
fuelPid.reset(); fuelPid.reset();
@ -443,7 +443,7 @@ void mainTriggerCallback(trigger_event_e ckpSignalType, uint32_t trgEventIndex D
efiAssertVoid(CUSTOM_STACK_6629, getCurrentRemainingStack() > 128, "lowstck#2"); efiAssertVoid(CUSTOM_STACK_6629, getCurrentRemainingStack() > 128, "lowstck#2");
#if EFI_CDM_INTEGRATION #if EFI_CDM_INTEGRATION
if (trgEventIndex == 0 && CONFIGB(cdmInputPin) != GPIO_UNASSIGNED) { if (trgEventIndex == 0 && CONFIG(cdmInputPin) != GPIO_UNASSIGNED) {
int cdmKnockValue = getCurrentCdmValue(engine->triggerCentral.triggerState.getTotalRevolutionCounter()); int cdmKnockValue = getCurrentCdmValue(engine->triggerCentral.triggerState.getTotalRevolutionCounter());
engine->knockLogic(cdmKnockValue); engine->knockLogic(cdmKnockValue);
} }

View File

@ -211,7 +211,7 @@ static void endAveraging(void *arg) {
static void applyMapMinBufferLength(DECLARE_ENGINE_PARAMETER_SIGNATURE) { static void applyMapMinBufferLength(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
// check range // check range
mapMinBufferLength = maxI(minI(CONFIGB(mapMinBufferLength), MAX_MAP_BUFFER_LENGTH), 1); mapMinBufferLength = maxI(minI(CONFIG(mapMinBufferLength), MAX_MAP_BUFFER_LENGTH), 1);
// reset index // reset index
averagedMapBufIdx = 0; averagedMapBufIdx = 0;
// fill with maximum values // fill with maximum values
@ -279,14 +279,14 @@ static void mapAveragingTriggerCallback(trigger_event_e ckpEventType,
return; return;
} }
if (CONFIGB(mapMinBufferLength) != mapMinBufferLength) { if (CONFIG(mapMinBufferLength) != mapMinBufferLength) {
applyMapMinBufferLength(PASS_ENGINE_PARAMETER_SIGNATURE); applyMapMinBufferLength(PASS_ENGINE_PARAMETER_SIGNATURE);
} }
measurementsPerRevolution = measurementsPerRevolutionCounter; measurementsPerRevolution = measurementsPerRevolutionCounter;
measurementsPerRevolutionCounter = 0; measurementsPerRevolutionCounter = 0;
int samplingCount = CONFIGB(measureMapOnlyInOneCylinder) ? 1 : engineConfiguration->specs.cylindersCount; int samplingCount = CONFIG(measureMapOnlyInOneCylinder) ? 1 : engineConfiguration->specs.cylindersCount;
for (int i = 0; i < samplingCount; i++) { for (int i = 0; i < samplingCount; i++) {
angle_t samplingStart = ENGINE(engineState.mapAveragingStart[i]); angle_t samplingStart = ENGINE(engineState.mapAveragingStart[i]);

View File

@ -201,7 +201,7 @@ void RpmCalculator::setStopSpinning(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
} }
void RpmCalculator::setSpinningUp(efitime_t nowNt DECLARE_ENGINE_PARAMETER_SUFFIX) { void RpmCalculator::setSpinningUp(efitime_t nowNt DECLARE_ENGINE_PARAMETER_SUFFIX) {
if (!CONFIGB(isFasterEngineSpinUpEnabled)) if (!CONFIG(isFasterEngineSpinUpEnabled))
return; return;
// Only a completely stopped and non-spinning engine can enter the spinning-up state. // Only a completely stopped and non-spinning engine can enter the spinning-up state.
if (isStopped(PASS_ENGINE_PARAMETER_SIGNATURE) && !isSpinning) { if (isStopped(PASS_ENGINE_PARAMETER_SIGNATURE) && !isSpinning) {

View File

@ -219,7 +219,7 @@ static void showLine(lcd_line_e line, int screenY) {
#if EFI_FILE_LOGGING #if EFI_FILE_LOGGING
{ {
char sdState; char sdState;
if (CONFIGB(isSdCardEnabled)) { if (CONFIG(isSdCardEnabled)) {
sdState = isSdCardAlive() ? 'L' : 'n'; sdState = isSdCardAlive() ? 'L' : 'n';
} else { } else {
sdState = 'D'; sdState = 'D';

View File

@ -114,7 +114,7 @@ static void testMil(void) {
#endif /* TEST_MIL_CODE */ #endif /* TEST_MIL_CODE */
bool isMilEnabled() { bool isMilEnabled() {
return CONFIGB(malfunctionIndicatorPin) != GPIO_UNASSIGNED; return CONFIG(malfunctionIndicatorPin) != GPIO_UNASSIGNED;
} }
void initMalfunctionIndicator(void) { void initMalfunctionIndicator(void) {

View File

@ -41,11 +41,11 @@ static void tachSignalCallback(trigger_event_e ckpSignalType,
} }
void initTachometer(void) { void initTachometer(void) {
if (CONFIGB(tachOutputPin) == GPIO_UNASSIGNED) { if (CONFIG(tachOutputPin) == GPIO_UNASSIGNED) {
return; return;
} }
enginePins.tachOut.initPin("analog tach output", CONFIGB(tachOutputPin), &CONFIGB(tachOutputPinMode)); enginePins.tachOut.initPin("analog tach output", CONFIG(tachOutputPin), &CONFIG(tachOutputPinMode));
#if EFI_SHAFT_POSITION_INPUT #if EFI_SHAFT_POSITION_INPUT
addTriggerEventListener(tachSignalCallback, "tach", engine); addTriggerEventListener(tachSignalCallback, "tach", engine);

View File

@ -246,8 +246,6 @@
#define baroSensor_offset_hex 248 #define baroSensor_offset_hex 248
#define baroSensor_type_offset 592 #define baroSensor_type_offset 592
#define baroSensor_type_offset_hex 250 #define baroSensor_type_offset_hex 250
#define bc_offset 600
#define bc_offset_hex 258
#define binarySerialRxPin_offset 1815 #define binarySerialRxPin_offset 1815
#define binarySerialRxPin_offset_hex 717 #define binarySerialRxPin_offset_hex 717
#define binarySerialTxPin_offset 1814 #define binarySerialTxPin_offset 1814

View File

@ -28,7 +28,7 @@
#define EXTERN_CONFIG \ #define EXTERN_CONFIG \
extern engine_configuration_s *engineConfiguration; \ extern engine_configuration_s *engineConfiguration; \
extern board_configuration_s *boardConfiguration; \ extern engine_configuration_s *engineConfiguration; \
extern engine_configuration_s & activeConfiguration; \ extern engine_configuration_s & activeConfiguration; \
extern persistent_config_container_s persistentState; \ extern persistent_config_container_s persistentState; \
extern persistent_config_s *config; \ extern persistent_config_s *config; \
@ -64,7 +64,6 @@
* access in unit tests * access in unit tests
*/ */
#define CONFIG(x) persistentState.persistentConfiguration.engineConfiguration.x #define CONFIG(x) persistentState.persistentConfiguration.engineConfiguration.x
#define CONFIGB(x) persistentState.persistentConfiguration.engineConfiguration.bc.x
#define ENGINE(x) ___engine.x #define ENGINE(x) ___engine.x
#define DEFINE_CONFIG_PARAM(x, y) #define DEFINE_CONFIG_PARAM(x, y)

View File

@ -154,7 +154,7 @@ static void doRunFuel(int humanIndex, const char *delayStr, const char * onTimeS
scheduleMsg(logger, "Invalid index: %d", humanIndex); scheduleMsg(logger, "Invalid index: %d", humanIndex);
return; return;
} }
brain_pin_e b = CONFIGB(injectionPins)[humanIndex - 1]; brain_pin_e b = CONFIG(injectionPins)[humanIndex - 1];
pinbench(delayStr, onTimeStr, offTimeStr, countStr, &enginePins.injectors[humanIndex - 1], b); pinbench(delayStr, onTimeStr, offTimeStr, countStr, &enginePins.injectors[humanIndex - 1], b);
} }
@ -169,7 +169,7 @@ static void fuelbench2(const char *delayStr, const char *indexStr, const char *
} }
static void fanBenchExt(const char *durationMs) { static void fanBenchExt(const char *durationMs) {
pinbench("0", durationMs, "100", "1", &enginePins.fanRelay, CONFIGB(fanPin)); pinbench("0", durationMs, "100", "1", &enginePins.fanRelay, CONFIG(fanPin));
} }
void fanBench(void) { void fanBench(void) {
@ -180,15 +180,15 @@ void fanBench(void) {
* we are blinking for 16 seconds so that one can click the button and walk around to see the light blinking * we are blinking for 16 seconds so that one can click the button and walk around to see the light blinking
*/ */
void milBench(void) { void milBench(void) {
pinbench("0", "500", "500", "16", &enginePins.checkEnginePin, CONFIGB(malfunctionIndicatorPin)); pinbench("0", "500", "500", "16", &enginePins.checkEnginePin, CONFIG(malfunctionIndicatorPin));
} }
void fuelPumpBenchExt(const char *durationMs) { void fuelPumpBenchExt(const char *durationMs) {
pinbench("0", durationMs, "100", "1", &enginePins.fuelPumpRelay, CONFIGB(fuelPumpPin)); pinbench("0", durationMs, "100", "1", &enginePins.fuelPumpRelay, CONFIG(fuelPumpPin));
} }
void acRelayBench(void) { void acRelayBench(void) {
pinbench("0", "1000", "100", "1", &enginePins.acRelay, CONFIGB(acRelayPin)); pinbench("0", "1000", "100", "1", &enginePins.acRelay, CONFIG(acRelayPin));
} }
void fuelPumpBench(void) { void fuelPumpBench(void) {
@ -206,7 +206,7 @@ static void doRunSpark(int humanIndex, const char *delayStr, const char * onTime
scheduleMsg(logger, "Invalid index: %d", humanIndex); scheduleMsg(logger, "Invalid index: %d", humanIndex);
return; return;
} }
brain_pin_e b = CONFIGB(ignitionPins)[humanIndex - 1]; brain_pin_e b = CONFIG(ignitionPins)[humanIndex - 1];
pinbench(delayStr, onTimeStr, offTimeStr, countStr, &enginePins.coils[humanIndex - 1], b); pinbench(delayStr, onTimeStr, offTimeStr, countStr, &enginePins.coils[humanIndex - 1], b);
} }

View File

@ -18,9 +18,9 @@
*/ */
#if EFI_UNIT_TEST #if EFI_UNIT_TEST
#define DECLARE_GLOBAL_SIGNATURE Engine *engine, engine_configuration_s *___engineConfiguration, persistent_config_s *config, board_configuration_s *boardConfiguration #define DECLARE_GLOBAL_SIGNATURE Engine *engine, engine_configuration_s *___engineConfiguration, persistent_config_s *config
#define DECLARE_GLOBAL_SUFFIX , DECLARE_GLOBAL_SIGNATURE #define DECLARE_GLOBAL_SUFFIX , DECLARE_GLOBAL_SIGNATURE
#define PASS_GLOBAL_SIGNATURE engine, ___engineConfiguration, config, boardConfiguration #define PASS_GLOBAL_SIGNATURE engine, ___engineConfiguration, config
#define PASS_GLOBAL_SUFFIX , PASS_GLOBAL_SIGNATURE #define PASS_GLOBAL_SUFFIX , PASS_GLOBAL_SIGNATURE
#define CONFIG_ACCESS_FOR_CONFIG_HEADER_ONLY(x) ___engineConfiguration->x #define CONFIG_ACCESS_FOR_CONFIG_HEADER_ONLY(x) ___engineConfiguration->x
#else /* EFI_UNIT_TEST */ #else /* EFI_UNIT_TEST */

View File

@ -28,7 +28,6 @@
#include "trigger_central.h" #include "trigger_central.h"
#include "engine_controller.h" #include "engine_controller.h"
persistent_config_container_s persistentState CCM_OPTIONAL; persistent_config_container_s persistentState CCM_OPTIONAL;
persistent_config_s *config = &persistentState.persistentConfiguration; persistent_config_s *config = &persistentState.persistentConfiguration;
@ -39,6 +38,5 @@ persistent_config_s *config = &persistentState.persistentConfiguration;
* would be a smaller evil. Whatever is needed should be passed into methods/modules/files as an explicit parameter. * would be a smaller evil. Whatever is needed should be passed into methods/modules/files as an explicit parameter.
*/ */
engine_configuration_s *engineConfiguration = &persistentState.persistentConfiguration.engineConfiguration; engine_configuration_s *engineConfiguration = &persistentState.persistentConfiguration.engineConfiguration;
board_configuration_s *boardConfiguration = &persistentState.persistentConfiguration.engineConfiguration.bc;
#endif /* EFI_UNIT_TEST */ #endif /* EFI_UNIT_TEST */

View File

@ -49,7 +49,7 @@ static float lastAfr = stoichAfr;
void initEgoAveraging(DECLARE_ENGINE_PARAMETER_SIGNATURE) { void initEgoAveraging(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
// Our averaging is intended for use only with Narrow EGOs. // Our averaging is intended for use only with Narrow EGOs.
if (CONFIGB(afr_type) == ES_NarrowBand) { if (CONFIG(afr_type) == ES_NarrowBand) {
totalEgoCnt = prevEgoCnt = 0; totalEgoCnt = prevEgoCnt = 0;
egoAfrBuf.clear(); egoAfrBuf.clear();
useAveraging = true; useAveraging = true;
@ -96,7 +96,7 @@ void initEgoAveraging(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
bool hasAfrSensor(DECLARE_ENGINE_PARAMETER_SIGNATURE) { bool hasAfrSensor(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
#if EFI_CJ125 && HAL_USE_SPI #if EFI_CJ125 && HAL_USE_SPI
if (CONFIGB(isCJ125Enabled)) { if (CONFIG(isCJ125Enabled)) {
return cjHasAfrSensor(PASS_ENGINE_PARAMETER_SIGNATURE); return cjHasAfrSensor(PASS_ENGINE_PARAMETER_SIGNATURE);
} }
#endif /* EFI_CJ125 && HAL_USE_SPI */ #endif /* EFI_CJ125 && HAL_USE_SPI */
@ -105,7 +105,7 @@ bool hasAfrSensor(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
float getAfr(DECLARE_ENGINE_PARAMETER_SIGNATURE) { float getAfr(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
#if EFI_CJ125 && HAL_USE_SPI #if EFI_CJ125 && HAL_USE_SPI
if (CONFIGB(isCJ125Enabled)) { if (CONFIG(isCJ125Enabled)) {
return cjGetAfr(PASS_ENGINE_PARAMETER_SIGNATURE); return cjGetAfr(PASS_ENGINE_PARAMETER_SIGNATURE);
} }
#endif /* EFI_CJ125 && HAL_USE_SPI */ #endif /* EFI_CJ125 && HAL_USE_SPI */
@ -113,7 +113,7 @@ float getAfr(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
float volts = getVoltageDivided("ego", sensor->hwChannel PASS_ENGINE_PARAMETER_SUFFIX); float volts = getVoltageDivided("ego", sensor->hwChannel PASS_ENGINE_PARAMETER_SUFFIX);
if (CONFIGB(afr_type) == ES_NarrowBand) { if (CONFIG(afr_type) == ES_NarrowBand) {
float afr = interpolate2d("narrow", volts, engineConfiguration->narrowToWideOxygenBins, engineConfiguration->narrowToWideOxygen); float afr = interpolate2d("narrow", volts, engineConfiguration->narrowToWideOxygenBins, engineConfiguration->narrowToWideOxygen);
#ifdef EFI_NARROW_EGO_AVERAGING #ifdef EFI_NARROW_EGO_AVERAGING
if (useAveraging) if (useAveraging)
@ -173,6 +173,6 @@ static void initEgoSensor(afr_sensor_s *sensor, ego_sensor_e type) {
} }
void setEgoSensor(ego_sensor_e type DECLARE_CONFIG_PARAMETER_SUFFIX) { void setEgoSensor(ego_sensor_e type DECLARE_CONFIG_PARAMETER_SUFFIX) {
CONFIGB(afr_type) = type; CONFIG(afr_type) = type;
initEgoSensor(&engineConfiguration->afr, type); initEgoSensor(&engineConfiguration->afr, type);
} }

View File

@ -148,7 +148,7 @@ float getMapByVoltage(float voltage DECLARE_ENGINE_PARAMETER_SUFFIX) {
*/ */
float getRawMap(DECLARE_ENGINE_PARAMETER_SIGNATURE) { float getRawMap(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
if (engineConfiguration->hasFrequencyReportingMapSensor) { if (engineConfiguration->hasFrequencyReportingMapSensor) {
return interpolateMsg("rmap", CONFIGB(mapFrequency0Kpa), 0, CONFIGB(mapFrequency100Kpa), 100, mapFreq); return interpolateMsg("rmap", CONFIG(mapFrequency0Kpa), 0, CONFIG(mapFrequency100Kpa), 100, mapFreq);
} }
float voltage = getVoltageDivided("map", engineConfiguration->map.sensor.hwChannel PASS_ENGINE_PARAMETER_SUFFIX); float voltage = getVoltageDivided("map", engineConfiguration->map.sensor.hwChannel PASS_ENGINE_PARAMETER_SUFFIX);

View File

@ -81,46 +81,46 @@ void printFloatArray(const char *prefix, float array[], int size) {
scheduleLogging(&logger); scheduleLogging(&logger);
} }
void printSpiState(Logging *logger, board_configuration_s *boardConfiguration) { void printSpiState(Logging *logger, const engine_configuration_s *engineConfiguration) {
scheduleMsg(logger, "spi 1=%s/2=%s/3=%s", boolToString(boardConfiguration->is_enabled_spi_1), scheduleMsg(logger, "spi 1=%s/2=%s/3=%s", boolToString(engineConfiguration->is_enabled_spi_1),
boolToString(boardConfiguration->is_enabled_spi_2), boolToString(boardConfiguration->is_enabled_spi_3)); boolToString(engineConfiguration->is_enabled_spi_2), boolToString(engineConfiguration->is_enabled_spi_3));
} }
extern board_configuration_s *boardConfiguration; extern engine_configuration_s *engineConfiguration;
static void printOutputs(const engine_configuration_s *engineConfiguration) { static void printOutputs(const engine_configuration_s *engineConfiguration) {
scheduleMsg(&logger, "injectionPins: mode %s", getPin_output_mode_e(boardConfiguration->injectionPinMode)); scheduleMsg(&logger, "injectionPins: mode %s", getPin_output_mode_e(engineConfiguration->injectionPinMode));
for (int i = 0; i < engineConfiguration->specs.cylindersCount; i++) { for (int i = 0; i < engineConfiguration->specs.cylindersCount; i++) {
brain_pin_e brainPin = boardConfiguration->injectionPins[i]; brain_pin_e brainPin = engineConfiguration->injectionPins[i];
scheduleMsg(&logger, "injection #%d @ %s", (1 + i), hwPortname(brainPin)); scheduleMsg(&logger, "injection #%d @ %s", (1 + i), hwPortname(brainPin));
} }
scheduleMsg(&logger, "ignitionPins: mode %s", getPin_output_mode_e(boardConfiguration->ignitionPinMode)); scheduleMsg(&logger, "ignitionPins: mode %s", getPin_output_mode_e(engineConfiguration->ignitionPinMode));
for (int i = 0; i < engineConfiguration->specs.cylindersCount; i++) { for (int i = 0; i < engineConfiguration->specs.cylindersCount; i++) {
brain_pin_e brainPin = boardConfiguration->ignitionPins[i]; brain_pin_e brainPin = engineConfiguration->ignitionPins[i];
scheduleMsg(&logger, "ignition #%d @ %s", (1 + i), hwPortname(brainPin)); scheduleMsg(&logger, "ignition #%d @ %s", (1 + i), hwPortname(brainPin));
} }
scheduleMsg(&logger, "idlePin: mode %s @ %s freq=%d", getPin_output_mode_e(boardConfiguration->idle.solenoidPinMode), scheduleMsg(&logger, "idlePin: mode %s @ %s freq=%d", getPin_output_mode_e(engineConfiguration->idle.solenoidPinMode),
hwPortname(boardConfiguration->idle.solenoidPin), boardConfiguration->idle.solenoidFrequency); hwPortname(engineConfiguration->idle.solenoidPin), engineConfiguration->idle.solenoidFrequency);
scheduleMsg(&logger, "malfunctionIndicator: %s mode=%s", hwPortname(boardConfiguration->malfunctionIndicatorPin), scheduleMsg(&logger, "malfunctionIndicator: %s mode=%s", hwPortname(engineConfiguration->malfunctionIndicatorPin),
getPin_output_mode_e(boardConfiguration->malfunctionIndicatorPinMode)); getPin_output_mode_e(engineConfiguration->malfunctionIndicatorPinMode));
scheduleMsg(&logger, "fuelPumpPin: mode %s @ %s", getPin_output_mode_e(boardConfiguration->fuelPumpPinMode), scheduleMsg(&logger, "fuelPumpPin: mode %s @ %s", getPin_output_mode_e(engineConfiguration->fuelPumpPinMode),
hwPortname(boardConfiguration->fuelPumpPin)); hwPortname(engineConfiguration->fuelPumpPin));
scheduleMsg(&logger, "fanPin: mode %s @ %s", getPin_output_mode_e(boardConfiguration->fanPinMode), scheduleMsg(&logger, "fanPin: mode %s @ %s", getPin_output_mode_e(engineConfiguration->fanPinMode),
hwPortname(boardConfiguration->fanPin)); hwPortname(engineConfiguration->fanPin));
scheduleMsg(&logger, "mainRelay: mode %s @ %s", getPin_output_mode_e(boardConfiguration->mainRelayPinMode), scheduleMsg(&logger, "mainRelay: mode %s @ %s", getPin_output_mode_e(engineConfiguration->mainRelayPinMode),
hwPortname(boardConfiguration->mainRelayPin)); hwPortname(engineConfiguration->mainRelayPin));
scheduleMsg(&logger, "starterRelay: mode %s @ %s", getPin_output_mode_e(boardConfiguration->starterRelayPinMode), scheduleMsg(&logger, "starterRelay: mode %s @ %s", getPin_output_mode_e(engineConfiguration->starterRelayPinMode),
hwPortname(boardConfiguration->starterRelayPin)); hwPortname(engineConfiguration->starterRelayPin));
scheduleMsg(&logger, "alternator field: mode %s @ %s", scheduleMsg(&logger, "alternator field: mode %s @ %s",
getPin_output_mode_e(boardConfiguration->alternatorControlPinMode), getPin_output_mode_e(engineConfiguration->alternatorControlPinMode),
hwPortname(boardConfiguration->alternatorControlPin)); hwPortname(engineConfiguration->alternatorControlPin));
} }
@ -275,7 +275,7 @@ void printConfiguration(const engine_configuration_s *engineConfiguration) {
boolToString(engineConfiguration->isMapAveragingEnabled), boolToString(engineConfiguration->isMapAveragingEnabled),
boolToString(engineConfiguration->isTunerStudioEnabled), boolToString(engineConfiguration->isTunerStudioEnabled),
boolToString(engineConfiguration->isWaveAnalyzerEnabled), boolToString(engineConfiguration->isWaveAnalyzerEnabled),
boolToString(boardConfiguration->isFastAdcEnabled)); boolToString(engineConfiguration->isFastAdcEnabled));
scheduleMsg(&logger, "isManualSpinningMode=%s/isCylinderCleanupEnabled=%s", scheduleMsg(&logger, "isManualSpinningMode=%s/isCylinderCleanupEnabled=%s",
boolToString(engineConfiguration->isManualSpinningMode), boolToString(engineConfiguration->isManualSpinningMode),
@ -283,20 +283,20 @@ void printConfiguration(const engine_configuration_s *engineConfiguration) {
scheduleMsg(&logger, "clutchUp@%s: %s", hwPortname(engineConfiguration->clutchUpPin), scheduleMsg(&logger, "clutchUp@%s: %s", hwPortname(engineConfiguration->clutchUpPin),
boolToString(engine->clutchUpState)); boolToString(engine->clutchUpState));
scheduleMsg(&logger, "clutchDown@%s: %s", hwPortname(boardConfiguration->clutchDownPin), scheduleMsg(&logger, "clutchDown@%s: %s", hwPortname(engineConfiguration->clutchDownPin),
boolToString(engine->clutchDownState)); boolToString(engine->clutchDownState));
scheduleMsg(&logger, "nesting=%d", maxNesting); scheduleMsg(&logger, "nesting=%d", maxNesting);
scheduleMsg(&logger, "digitalPotentiometerSpiDevice %d", boardConfiguration->digitalPotentiometerSpiDevice); scheduleMsg(&logger, "digitalPotentiometerSpiDevice %d", engineConfiguration->digitalPotentiometerSpiDevice);
for (int i = 0; i < DIGIPOT_COUNT; i++) { for (int i = 0; i < DIGIPOT_COUNT; i++) {
scheduleMsg(&logger, "digitalPotentiometer CS%d %s", i, scheduleMsg(&logger, "digitalPotentiometer CS%d %s", i,
hwPortname(boardConfiguration->digitalPotentiometerChipSelect[i])); hwPortname(engineConfiguration->digitalPotentiometerChipSelect[i]));
} }
#if EFI_PROD_CODE #if EFI_PROD_CODE
printSpiState(&logger, boardConfiguration); printSpiState(&logger, engineConfiguration);
#endif /* EFI_PROD_CODE */ #endif /* EFI_PROD_CODE */
} }
@ -334,22 +334,22 @@ void setEngineType(int value) {
} }
static void setIdleSolenoidFrequency(int value) { static void setIdleSolenoidFrequency(int value) {
boardConfiguration->idle.solenoidFrequency = value; engineConfiguration->idle.solenoidFrequency = value;
incrementGlobalConfigurationVersion(PASS_ENGINE_PARAMETER_SIGNATURE); incrementGlobalConfigurationVersion(PASS_ENGINE_PARAMETER_SIGNATURE);
} }
static void setInjectionPinMode(int value) { static void setInjectionPinMode(int value) {
boardConfiguration->injectionPinMode = (pin_output_mode_e) value; engineConfiguration->injectionPinMode = (pin_output_mode_e) value;
doPrintConfiguration(); doPrintConfiguration();
} }
static void setIgnitionPinMode(int value) { static void setIgnitionPinMode(int value) {
boardConfiguration->ignitionPinMode = (pin_output_mode_e) value; engineConfiguration->ignitionPinMode = (pin_output_mode_e) value;
doPrintConfiguration(); doPrintConfiguration();
} }
static void setIdlePinMode(int value) { static void setIdlePinMode(int value) {
boardConfiguration->idle.solenoidPinMode = (pin_output_mode_e) value; engineConfiguration->idle.solenoidPinMode = (pin_output_mode_e) value;
doPrintConfiguration(); doPrintConfiguration();
} }
@ -366,17 +366,17 @@ static void setIgnitionOffset(float value) {
} }
static void setFuelPumpPinMode(int value) { static void setFuelPumpPinMode(int value) {
boardConfiguration->fuelPumpPinMode = (pin_output_mode_e) value; engineConfiguration->fuelPumpPinMode = (pin_output_mode_e) value;
doPrintConfiguration(); doPrintConfiguration();
} }
static void setMalfunctionIndicatorPinMode(int value) { static void setMalfunctionIndicatorPinMode(int value) {
boardConfiguration->malfunctionIndicatorPinMode = (pin_output_mode_e) value; engineConfiguration->malfunctionIndicatorPinMode = (pin_output_mode_e) value;
doPrintConfiguration(); doPrintConfiguration();
} }
static void setSensorChartMode(int value) { static void setSensorChartMode(int value) {
boardConfiguration->sensorChartMode = (sensor_chart_e) value; engineConfiguration->sensorChartMode = (sensor_chart_e) value;
doPrintConfiguration(); doPrintConfiguration();
} }
@ -446,10 +446,10 @@ static void printTemperatureInfo(void) {
} }
scheduleMsg(&logger, "fan=%s @ %s", boolToString(enginePins.fanRelay.getLogicValue()), scheduleMsg(&logger, "fan=%s @ %s", boolToString(enginePins.fanRelay.getLogicValue()),
hwPortname(boardConfiguration->fanPin)); hwPortname(engineConfiguration->fanPin));
scheduleMsg(&logger, "A/C relay=%s @ %s", boolToString(enginePins.acRelay.getLogicValue()), scheduleMsg(&logger, "A/C relay=%s @ %s", boolToString(enginePins.acRelay.getLogicValue()),
hwPortname(boardConfiguration->acRelayPin)); hwPortname(engineConfiguration->acRelayPin));
#endif /* EFI_ANALOG_SENSORS */ #endif /* EFI_ANALOG_SENSORS */
} }
@ -651,11 +651,11 @@ static void setWholeFuelMapCmd(float value) {
#if EFI_PROD_CODE #if EFI_PROD_CODE
static void setEgtSpi(int spi) { static void setEgtSpi(int spi) {
boardConfiguration->max31855spiDevice = (spi_device_e) spi; engineConfiguration->max31855spiDevice = (spi_device_e) spi;
} }
static void setPotSpi(int spi) { static void setPotSpi(int spi) {
boardConfiguration->digitalPotentiometerSpiDevice = (spi_device_e) spi; engineConfiguration->digitalPotentiometerSpiDevice = (spi_device_e) spi;
} }
/** /**
@ -675,7 +675,7 @@ static void setIgnitionPin(const char *indexStr, const char *pinName) {
return; return;
} }
scheduleMsg(&logger, "setting ignition pin[%d] to %s please save&restart", index, hwPortname(pin)); scheduleMsg(&logger, "setting ignition pin[%d] to %s please save&restart", index, hwPortname(pin));
boardConfiguration->ignitionPins[index] = pin; engineConfiguration->ignitionPins[index] = pin;
incrementGlobalConfigurationVersion(PASS_ENGINE_PARAMETER_SIGNATURE); incrementGlobalConfigurationVersion(PASS_ENGINE_PARAMETER_SIGNATURE);
} }
@ -692,27 +692,27 @@ static void setIndividualPin(const char *pinName, brain_pin_e *targetPin, const
// set_idle_pin none // set_idle_pin none
static void setIdlePin(const char *pinName) { static void setIdlePin(const char *pinName) {
setIndividualPin(pinName, &boardConfiguration->idle.solenoidPin, "idle"); setIndividualPin(pinName, &engineConfiguration->idle.solenoidPin, "idle");
} }
static void setMainRelayPin(const char *pinName) { static void setMainRelayPin(const char *pinName) {
setIndividualPin(pinName, &boardConfiguration->mainRelayPin, "main relay"); setIndividualPin(pinName, &engineConfiguration->mainRelayPin, "main relay");
} }
static void setStarterRelayPin(const char *pinName) { static void setStarterRelayPin(const char *pinName) {
setIndividualPin(pinName, &boardConfiguration->starterRelayPin, "starter relay"); setIndividualPin(pinName, &engineConfiguration->starterRelayPin, "starter relay");
} }
static void setAlternatorPin(const char *pinName) { static void setAlternatorPin(const char *pinName) {
setIndividualPin(pinName, &boardConfiguration->alternatorControlPin, "alternator"); setIndividualPin(pinName, &engineConfiguration->alternatorControlPin, "alternator");
} }
static void setACRelayPin(const char *pinName) { static void setACRelayPin(const char *pinName) {
setIndividualPin(pinName, &boardConfiguration->acRelayPin, "A/C"); setIndividualPin(pinName, &engineConfiguration->acRelayPin, "A/C");
} }
static void setFuelPumpPin(const char *pinName) { static void setFuelPumpPin(const char *pinName) {
setIndividualPin(pinName, &boardConfiguration->fuelPumpPin, "fuelPump"); setIndividualPin(pinName, &engineConfiguration->fuelPumpPin, "fuelPump");
} }
static void setInjectionPin(const char *indexStr, const char *pinName) { static void setInjectionPin(const char *indexStr, const char *pinName) {
@ -726,7 +726,7 @@ static void setInjectionPin(const char *indexStr, const char *pinName) {
return; return;
} }
scheduleMsg(&logger, "setting injection pin[%d] to %s please save&restart", index, hwPortname(pin)); scheduleMsg(&logger, "setting injection pin[%d] to %s please save&restart", index, hwPortname(pin));
boardConfiguration->injectionPins[index] = pin; engineConfiguration->injectionPins[index] = pin;
incrementGlobalConfigurationVersion(PASS_ENGINE_PARAMETER_SIGNATURE); incrementGlobalConfigurationVersion(PASS_ENGINE_PARAMETER_SIGNATURE);
} }
@ -747,7 +747,7 @@ static void setTriggerInputPin(const char *indexStr, const char *pinName) {
return; return;
} }
scheduleMsg(&logger, "setting trigger pin[%d] to %s please save&restart", index, hwPortname(pin)); scheduleMsg(&logger, "setting trigger pin[%d] to %s please save&restart", index, hwPortname(pin));
boardConfiguration->triggerInputPins[index] = pin; engineConfiguration->triggerInputPins[index] = pin;
incrementGlobalConfigurationVersion(PASS_ENGINE_PARAMETER_SIGNATURE); incrementGlobalConfigurationVersion(PASS_ENGINE_PARAMETER_SIGNATURE);
} }
@ -760,7 +760,7 @@ static void setTriggerSimulatorMode(const char *indexStr, const char *modeCode)
if (absI(mode) == ERROR_CODE) { if (absI(mode) == ERROR_CODE) {
return; return;
} }
boardConfiguration->triggerSimulatorPinModes[index] = (pin_output_mode_e) mode; engineConfiguration->triggerSimulatorPinModes[index] = (pin_output_mode_e) mode;
} }
static void setEgtCSPin(const char *indexStr, const char *pinName) { static void setEgtCSPin(const char *indexStr, const char *pinName) {
@ -773,7 +773,7 @@ static void setEgtCSPin(const char *indexStr, const char *pinName) {
return; return;
} }
scheduleMsg(&logger, "setting EGT CS pin[%d] to %s please save&restart", index, hwPortname(pin)); scheduleMsg(&logger, "setting EGT CS pin[%d] to %s please save&restart", index, hwPortname(pin));
boardConfiguration->max31855_cs[index] = pin; engineConfiguration->max31855_cs[index] = pin;
incrementGlobalConfigurationVersion(PASS_ENGINE_PARAMETER_SIGNATURE); incrementGlobalConfigurationVersion(PASS_ENGINE_PARAMETER_SIGNATURE);
} }
@ -787,7 +787,7 @@ static void setTriggerSimulatorPin(const char *indexStr, const char *pinName) {
return; return;
} }
scheduleMsg(&logger, "setting trigger simulator pin[%d] to %s please save&restart", index, hwPortname(pin)); scheduleMsg(&logger, "setting trigger simulator pin[%d] to %s please save&restart", index, hwPortname(pin));
boardConfiguration->triggerSimulatorPins[index] = pin; engineConfiguration->triggerSimulatorPins[index] = pin;
incrementGlobalConfigurationVersion(PASS_ENGINE_PARAMETER_SIGNATURE); incrementGlobalConfigurationVersion(PASS_ENGINE_PARAMETER_SIGNATURE);
} }
@ -838,7 +838,7 @@ static void setLogicInputPin(const char *indexStr, const char *pinName) {
return; return;
} }
scheduleMsg(&logger, "setting logic input pin[%d] to %s please save&restart", index, hwPortname(pin)); scheduleMsg(&logger, "setting logic input pin[%d] to %s please save&restart", index, hwPortname(pin));
boardConfiguration->logicAnalyzerPins[index] = pin; engineConfiguration->logicAnalyzerPins[index] = pin;
} }
static void showPinFunction(const char *pinName) { static void showPinFunction(const char *pinName) {
@ -883,24 +883,24 @@ static void setFuelMap(const char * rpmStr, const char *loadStr, const char *val
static void setSpiMode(int index, bool mode) { static void setSpiMode(int index, bool mode) {
switch (index) { switch (index) {
case 1: case 1:
boardConfiguration->is_enabled_spi_1 = mode; engineConfiguration->is_enabled_spi_1 = mode;
break; break;
case 2: case 2:
boardConfiguration->is_enabled_spi_2 = mode; engineConfiguration->is_enabled_spi_2 = mode;
break; break;
case 3: case 3:
boardConfiguration->is_enabled_spi_3 = mode; engineConfiguration->is_enabled_spi_3 = mode;
break; break;
default: default:
scheduleMsg(&logger, "invalid spi index %d", index); scheduleMsg(&logger, "invalid spi index %d", index);
return; return;
} }
printSpiState(&logger, boardConfiguration); printSpiState(&logger, engineConfiguration);
} }
static void enableOrDisable(const char *param, bool isEnabled) { static void enableOrDisable(const char *param, bool isEnabled) {
if (strEqualCaseInsensitive(param, "fastadc")) { if (strEqualCaseInsensitive(param, "fastadc")) {
boardConfiguration->isFastAdcEnabled = isEnabled; engineConfiguration->isFastAdcEnabled = isEnabled;
} else if (strEqualCaseInsensitive(param, CMD_TRIGGER_HW_INPUT)) { } else if (strEqualCaseInsensitive(param, CMD_TRIGGER_HW_INPUT)) {
engine->hwTriggerInputEnabled = isEnabled; engine->hwTriggerInputEnabled = isEnabled;
} else if (strEqualCaseInsensitive(param, "etb_auto")) { } else if (strEqualCaseInsensitive(param, "etb_auto")) {
@ -908,11 +908,11 @@ static void enableOrDisable(const char *param, bool isEnabled) {
} else if (strEqualCaseInsensitive(param, "cranking_constant_dwell")) { } else if (strEqualCaseInsensitive(param, "cranking_constant_dwell")) {
engineConfiguration->useConstantDwellDuringCranking = isEnabled; engineConfiguration->useConstantDwellDuringCranking = isEnabled;
} else if (strEqualCaseInsensitive(param, "cj125")) { } else if (strEqualCaseInsensitive(param, "cj125")) {
boardConfiguration->isCJ125Enabled = isEnabled; engineConfiguration->isCJ125Enabled = isEnabled;
} else if (strEqualCaseInsensitive(param, "engine_sniffer")) { } else if (strEqualCaseInsensitive(param, "engine_sniffer")) {
engineConfiguration->isEngineChartEnabled = isEnabled; engineConfiguration->isEngineChartEnabled = isEnabled;
} else if (strEqualCaseInsensitive(param, "step1limimter")) { } else if (strEqualCaseInsensitive(param, "step1limimter")) {
boardConfiguration->enabledStep1Limiter = isEnabled; engineConfiguration->enabledStep1Limiter = isEnabled;
#if EFI_PROD_CODE #if EFI_PROD_CODE
} else if (strEqualCaseInsensitive(param, "auto_idle")) { } else if (strEqualCaseInsensitive(param, "auto_idle")) {
#if EFI_IDLE_CONTROL #if EFI_IDLE_CONTROL
@ -920,9 +920,9 @@ static void enableOrDisable(const char *param, bool isEnabled) {
#endif /* EFI_IDLE_CONTROL */ #endif /* EFI_IDLE_CONTROL */
#endif /* EFI_PROD_CODE */ #endif /* EFI_PROD_CODE */
} else if (strEqualCaseInsensitive(param, "serial")) { } else if (strEqualCaseInsensitive(param, "serial")) {
boardConfiguration->useSerialPort = isEnabled; engineConfiguration->useSerialPort = isEnabled;
} else if (strEqualCaseInsensitive(param, "stepperidle")) { } else if (strEqualCaseInsensitive(param, "stepperidle")) {
boardConfiguration->useStepperIdle = isEnabled; engineConfiguration->useStepperIdle = isEnabled;
} else if (strEqualCaseInsensitive(param, "trigger_only_front")) { } else if (strEqualCaseInsensitive(param, "trigger_only_front")) {
engineConfiguration->useOnlyRisingEdgeForTrigger = isEnabled; engineConfiguration->useOnlyRisingEdgeForTrigger = isEnabled;
incrementGlobalConfigurationVersion(PASS_ENGINE_PARAMETER_SIGNATURE); incrementGlobalConfigurationVersion(PASS_ENGINE_PARAMETER_SIGNATURE);
@ -936,7 +936,7 @@ static void enableOrDisable(const char *param, bool isEnabled) {
engineConfiguration->twoWireBatchIgnition = isEnabled; engineConfiguration->twoWireBatchIgnition = isEnabled;
incrementGlobalConfigurationVersion(PASS_ENGINE_PARAMETER_SIGNATURE); incrementGlobalConfigurationVersion(PASS_ENGINE_PARAMETER_SIGNATURE);
} else if (strEqualCaseInsensitive(param, "HIP9011")) { } else if (strEqualCaseInsensitive(param, "HIP9011")) {
boardConfiguration->isHip9011Enabled = isEnabled; engineConfiguration->isHip9011Enabled = isEnabled;
} else if (strEqualCaseInsensitive(param, "verbose_etb")) { } else if (strEqualCaseInsensitive(param, "verbose_etb")) {
engineConfiguration->isVerboseETB = isEnabled; engineConfiguration->isVerboseETB = isEnabled;
} else if (strEqualCaseInsensitive(param, "verbose_idle")) { } else if (strEqualCaseInsensitive(param, "verbose_idle")) {
@ -950,15 +950,15 @@ static void enableOrDisable(const char *param, bool isEnabled) {
} else if (strEqualCaseInsensitive(param, "auxdebug4")) { } else if (strEqualCaseInsensitive(param, "auxdebug4")) {
engineConfiguration->isVerboseAuxPid4 = isEnabled; engineConfiguration->isVerboseAuxPid4 = isEnabled;
} else if (strEqualCaseInsensitive(param, "altdebug")) { } else if (strEqualCaseInsensitive(param, "altdebug")) {
boardConfiguration->isVerboseAlternator = isEnabled; engineConfiguration->isVerboseAlternator = isEnabled;
} else if (strEqualCaseInsensitive(param, "tpic_advanced_mode")) { } else if (strEqualCaseInsensitive(param, "tpic_advanced_mode")) {
boardConfiguration->useTpicAdvancedMode = isEnabled; engineConfiguration->useTpicAdvancedMode = isEnabled;
} else if (strEqualCaseInsensitive(param, "knockdebug")) { } else if (strEqualCaseInsensitive(param, "knockdebug")) {
engine->knockDebug = isEnabled; engine->knockDebug = isEnabled;
} else if (strEqualCaseInsensitive(param, "altcontrol")) { } else if (strEqualCaseInsensitive(param, "altcontrol")) {
engineConfiguration->isAlternatorControlEnabled = isEnabled; engineConfiguration->isAlternatorControlEnabled = isEnabled;
} else if (strEqualCaseInsensitive(param, "sd")) { } else if (strEqualCaseInsensitive(param, "sd")) {
boardConfiguration->isSdCardEnabled = isEnabled; engineConfiguration->isSdCardEnabled = isEnabled;
} else if (strEqualCaseInsensitive(param, "test_mode")) { } else if (strEqualCaseInsensitive(param, "test_mode")) {
engine->isTestMode = isEnabled; engine->isTestMode = isEnabled;
} else if (strEqualCaseInsensitive(param, "can_read")) { } else if (strEqualCaseInsensitive(param, "can_read")) {
@ -974,7 +974,7 @@ static void enableOrDisable(const char *param, bool isEnabled) {
} else if (strEqualCaseInsensitive(param, "self_stimulation")) { } else if (strEqualCaseInsensitive(param, "self_stimulation")) {
engineConfiguration->directSelfStimulation = isEnabled; engineConfiguration->directSelfStimulation = isEnabled;
} else if (strEqualCaseInsensitive(param, "engine_control")) { } else if (strEqualCaseInsensitive(param, "engine_control")) {
boardConfiguration->isEngineControlEnabled = isEnabled; engineConfiguration->isEngineControlEnabled = isEnabled;
} else if (strEqualCaseInsensitive(param, "map_avg")) { } else if (strEqualCaseInsensitive(param, "map_avg")) {
engineConfiguration->isMapAveragingEnabled = isEnabled; engineConfiguration->isMapAveragingEnabled = isEnabled;
} else if (strEqualCaseInsensitive(param, "tunerstudio")) { } else if (strEqualCaseInsensitive(param, "tunerstudio")) {
@ -1086,7 +1086,7 @@ const plain_get_integer_s getI_plain[] = {
const plain_get_float_s getF_plain[] = { const plain_get_float_s getF_plain[] = {
{"adcVcc", &engineConfiguration->adcVcc}, {"adcVcc", &engineConfiguration->adcVcc},
{"cranking_dwell", &engineConfiguration->ignitionDwellForCrankingMs}, {"cranking_dwell", &engineConfiguration->ignitionDwellForCrankingMs},
{"idle_position", &boardConfiguration->manIdlePosition}, {"idle_position", &engineConfiguration->manIdlePosition},
{"ignition_offset", &engineConfiguration->ignitionOffset}, {"ignition_offset", &engineConfiguration->ignitionOffset},
{"injection_offset", &engineConfiguration->extraInjectionOffset}, {"injection_offset", &engineConfiguration->extraInjectionOffset},
{"global_trigger_offset_angle", &engineConfiguration->globalTriggerAngleOffset}, {"global_trigger_offset_angle", &engineConfiguration->globalTriggerAngleOffset},
@ -1126,7 +1126,7 @@ static void getValue(const char *paramStr) {
if (strEqualCaseInsensitive(paramStr, "isCJ125Enabled")) { if (strEqualCaseInsensitive(paramStr, "isCJ125Enabled")) {
scheduleMsg(&logger, "isCJ125Enabled=%d", boardConfiguration->isCJ125Enabled); scheduleMsg(&logger, "isCJ125Enabled=%d", engineConfiguration->isCJ125Enabled);
#if EFI_PROD_CODE #if EFI_PROD_CODE
} else if (strEqualCaseInsensitive(paramStr, "bor")) { } else if (strEqualCaseInsensitive(paramStr, "bor")) {
showBor(); showBor();
@ -1142,7 +1142,7 @@ static void getValue(const char *paramStr) {
} else if (strEqualCaseInsensitive(paramStr, "global_trigger_offset_angle")) { } else if (strEqualCaseInsensitive(paramStr, "global_trigger_offset_angle")) {
scheduleMsg(&logger, "global_trigger_offset=%.2f", engineConfiguration->globalTriggerAngleOffset); scheduleMsg(&logger, "global_trigger_offset=%.2f", engineConfiguration->globalTriggerAngleOffset);
} else if (strEqualCaseInsensitive(paramStr, "isHip9011Enabled")) { } else if (strEqualCaseInsensitive(paramStr, "isHip9011Enabled")) {
scheduleMsg(&logger, "isHip9011Enabled=%d", boardConfiguration->isHip9011Enabled); scheduleMsg(&logger, "isHip9011Enabled=%d", engineConfiguration->isHip9011Enabled);
} }
#if EFI_RTC #if EFI_RTC

View File

@ -12,7 +12,7 @@
#include "engine.h" #include "engine.h"
void initSettings(void); void initSettings(void);
void printSpiState(Logging *logger, board_configuration_s *boardConfiguration); void printSpiState(Logging *logger, const engine_configuration_s *engineConfiguration);
void printConfiguration(const engine_configuration_s *engineConfiguration); void printConfiguration(const engine_configuration_s *engineConfiguration);
void scheduleStopEngine(void); void scheduleStopEngine(void);
void setCallFromPitStop(int durationMs); void setCallFromPitStop(int durationMs);

View File

@ -126,25 +126,25 @@ void EnginePins::unregisterPins() {
unregisterEtbPins(); unregisterEtbPins();
#endif /* EFI_ELECTRONIC_THROTTLE_BODY */ #endif /* EFI_ELECTRONIC_THROTTLE_BODY */
#if EFI_PROD_CODE #if EFI_PROD_CODE
unregisterOutputIfPinOrModeChanged(fuelPumpRelay, bc.fuelPumpPin, bc.fuelPumpPinMode); unregisterOutputIfPinOrModeChanged(fuelPumpRelay, fuelPumpPin, fuelPumpPinMode);
unregisterOutputIfPinOrModeChanged(fanRelay, bc.fanPin, bc.fanPinMode); unregisterOutputIfPinOrModeChanged(fanRelay, fanPin, fanPinMode);
unregisterOutputIfPinOrModeChanged(acRelay, bc.acRelayPin, bc.acRelayPinMode); unregisterOutputIfPinOrModeChanged(acRelay, acRelayPin, acRelayPinMode);
unregisterOutputIfPinOrModeChanged(hipCs, bc.hip9011CsPin, bc.hip9011CsPinMode); unregisterOutputIfPinOrModeChanged(hipCs, hip9011CsPin, hip9011CsPinMode);
unregisterOutputIfPinOrModeChanged(triggerDecoderErrorPin, bc.triggerErrorPin, bc.triggerErrorPinMode); unregisterOutputIfPinOrModeChanged(triggerDecoderErrorPin, triggerErrorPin, triggerErrorPinMode);
unregisterOutputIfPinOrModeChanged(checkEnginePin, bc.malfunctionIndicatorPin, bc.malfunctionIndicatorPinMode); unregisterOutputIfPinOrModeChanged(checkEnginePin, malfunctionIndicatorPin, malfunctionIndicatorPinMode);
unregisterOutputIfPinOrModeChanged(dizzyOutput, dizzySparkOutputPin, dizzySparkOutputPinMode); unregisterOutputIfPinOrModeChanged(dizzyOutput, dizzySparkOutputPin, dizzySparkOutputPinMode);
unregisterOutputIfPinOrModeChanged(tachOut, bc.tachOutputPin, bc.tachOutputPinMode); unregisterOutputIfPinOrModeChanged(tachOut, tachOutputPin, tachOutputPinMode);
unregisterOutputIfPinOrModeChanged(idleSolenoidPin, bc.idle.solenoidPin, bc.idle.solenoidPinMode); unregisterOutputIfPinOrModeChanged(idleSolenoidPin, idle.solenoidPin, idle.solenoidPinMode);
unregisterOutputIfPinChanged(sdCsPin, bc.sdCardCsPin); unregisterOutputIfPinChanged(sdCsPin, sdCardCsPin);
unregisterOutputIfPinChanged(accelerometerCs, LIS302DLCsPin); unregisterOutputIfPinChanged(accelerometerCs, LIS302DLCsPin);
for (int i = 0;i < FSIO_COMMAND_COUNT;i++) { for (int i = 0;i < FSIO_COMMAND_COUNT;i++) {
unregisterOutputIfPinChanged(fsioOutputs[i], bc.fsioOutputPins[i]); unregisterOutputIfPinChanged(fsioOutputs[i], fsioOutputPins[i]);
} }
unregisterOutputIfPinOrModeChanged(alternatorPin, bc.alternatorControlPin, bc.alternatorControlPinMode); unregisterOutputIfPinOrModeChanged(alternatorPin, alternatorControlPin, alternatorControlPinMode);
unregisterOutputIfPinOrModeChanged(mainRelay, bc.mainRelayPin, bc.mainRelayPinMode); unregisterOutputIfPinOrModeChanged(mainRelay, mainRelayPin, mainRelayPinMode);
unregisterOutputIfPinOrModeChanged(starterRelay, bc.starterRelayPin, bc.starterRelayPinMode); unregisterOutputIfPinOrModeChanged(starterRelay, starterRelayPin, starterRelayPinMode);
#endif /* EFI_PROD_CODE */ #endif /* EFI_PROD_CODE */
} }
@ -161,7 +161,7 @@ void EnginePins::reset() {
void EnginePins::stopIgnitionPins(void) { void EnginePins::stopIgnitionPins(void) {
#if EFI_PROD_CODE #if EFI_PROD_CODE
for (int i = 0; i < IGNITION_PIN_COUNT; i++) { for (int i = 0; i < IGNITION_PIN_COUNT; i++) {
unregisterOutputIfPinOrModeChanged(enginePins.coils[i], bc.ignitionPins[i], bc.ignitionPinMode); unregisterOutputIfPinOrModeChanged(enginePins.coils[i], ignitionPins[i], ignitionPinMode);
} }
#endif /* EFI_PROD_CODE */ #endif /* EFI_PROD_CODE */
} }
@ -169,7 +169,7 @@ void EnginePins::stopIgnitionPins(void) {
void EnginePins::stopInjectionPins(void) { void EnginePins::stopInjectionPins(void) {
#if EFI_PROD_CODE #if EFI_PROD_CODE
for (int i = 0; i < INJECTION_PIN_COUNT; i++) { for (int i = 0; i < INJECTION_PIN_COUNT; i++) {
unregisterOutputIfPinOrModeChanged(enginePins.injectors[i], bc.injectionPins[i], bc.injectionPinMode); unregisterOutputIfPinOrModeChanged(enginePins.injectors[i], injectionPins[i], injectionPinMode);
} }
#endif /* EFI_PROD_CODE */ #endif /* EFI_PROD_CODE */
} }
@ -187,8 +187,8 @@ void EnginePins::startIgnitionPins(void) {
#if EFI_PROD_CODE #if EFI_PROD_CODE
for (int i = 0; i < engineConfiguration->specs.cylindersCount; i++) { for (int i = 0; i < engineConfiguration->specs.cylindersCount; i++) {
NamedOutputPin *output = &enginePins.coils[i]; NamedOutputPin *output = &enginePins.coils[i];
if (isPinOrModeChanged(bc.ignitionPins[i], bc.ignitionPinMode)) { if (isPinOrModeChanged(ignitionPins[i], ignitionPinMode)) {
output->initPin(output->name, CONFIGB(ignitionPins)[i], &CONFIGB(ignitionPinMode)); output->initPin(output->name, CONFIG(ignitionPins)[i], &CONFIG(ignitionPinMode));
} }
} }
if (isPinOrModeChanged(dizzySparkOutputPin, dizzySparkOutputPinMode)) { if (isPinOrModeChanged(dizzySparkOutputPin, dizzySparkOutputPinMode)) {
@ -204,9 +204,9 @@ void EnginePins::startInjectionPins(void) {
// todo: should we move this code closer to the injection logic? // todo: should we move this code closer to the injection logic?
for (int i = 0; i < engineConfiguration->specs.cylindersCount; i++) { for (int i = 0; i < engineConfiguration->specs.cylindersCount; i++) {
NamedOutputPin *output = &enginePins.injectors[i]; NamedOutputPin *output = &enginePins.injectors[i];
if (isPinOrModeChanged(bc.injectionPins[i], bc.injectionPinMode)) { if (isPinOrModeChanged(injectionPins[i], injectionPinMode)) {
output->initPin(output->name, CONFIGB(injectionPins)[i], output->initPin(output->name, CONFIG(injectionPins)[i],
&CONFIGB(injectionPinMode)); &CONFIG(injectionPinMode));
} }
} }
#endif /* EFI_PROD_CODE */ #endif /* EFI_PROD_CODE */
@ -368,18 +368,18 @@ void initOutputPins(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
// memset(&outputs, 0, sizeof(outputs)); // memset(&outputs, 0, sizeof(outputs));
#if HAL_USE_SPI #if HAL_USE_SPI
enginePins.sdCsPin.initPin("spi CS5", CONFIGB(sdCardCsPin)); enginePins.sdCsPin.initPin("spi CS5", CONFIG(sdCardCsPin));
#endif /* HAL_USE_SPI */ #endif /* HAL_USE_SPI */
// todo: should we move this code closer to the fuel pump logic? // todo: should we move this code closer to the fuel pump logic?
enginePins.fuelPumpRelay.initPin("fuel pump relay", CONFIGB(fuelPumpPin), &CONFIGB(fuelPumpPinMode)); enginePins.fuelPumpRelay.initPin("fuel pump relay", CONFIG(fuelPumpPin), &CONFIG(fuelPumpPinMode));
enginePins.mainRelay.initPin("main relay", CONFIGB(mainRelayPin), &CONFIGB(mainRelayPinMode)); enginePins.mainRelay.initPin("main relay", CONFIG(mainRelayPin), &CONFIG(mainRelayPinMode));
enginePins.starterRelay.initPin("starter relay", CONFIGB(starterRelayPin), &CONFIGB(starterRelayPinMode)); enginePins.starterRelay.initPin("starter relay", CONFIG(starterRelayPin), &CONFIG(starterRelayPinMode));
enginePins.fanRelay.initPin("fan relay", CONFIGB(fanPin), &CONFIGB(fanPinMode)); enginePins.fanRelay.initPin("fan relay", CONFIG(fanPin), &CONFIG(fanPinMode));
enginePins.o2heater.initPin("o2 heater", CONFIGB(o2heaterPin)); enginePins.o2heater.initPin("o2 heater", CONFIG(o2heaterPin));
enginePins.acRelay.initPin("A/C relay", CONFIGB(acRelayPin), &CONFIGB(acRelayPinMode)); enginePins.acRelay.initPin("A/C relay", CONFIG(acRelayPin), &CONFIG(acRelayPinMode));
// digit 1 // digit 1
/* /*

View File

@ -4,10 +4,10 @@
* *
* *
* @date Sep 26, 2014 * @date Sep 26, 2014
* @author Andrey Belomutskiy, (c) 2012-2017 * @author Andrey Belomutskiy, (c) 2012-2019
*/ */
#ifndef efi_gpio_H_
#define efi_gpio_H_ #pragma once
#include "global.h" #include "global.h"
#include "io_pins.h" #include "io_pins.h"
@ -191,5 +191,3 @@ const char *portname(ioportid_t GPIOx);
brain_pin_e parseBrainPin(const char *str); brain_pin_e parseBrainPin(const char *str);
const char *hwPortname(brain_pin_e brainPin); const char *hwPortname(brain_pin_e brainPin);
#endif /* efi_gpio_H_ */

View File

@ -100,7 +100,7 @@ void hwHandleVvtCamSignal(trigger_value_e front DECLARE_ENGINE_PARAMETER_SUFFIX)
addEngineSnifferEvent(PROTOCOL_VVT_NAME, front == TV_RISE ? PROTOCOL_ES_UP : PROTOCOL_ES_DOWN); addEngineSnifferEvent(PROTOCOL_VVT_NAME, front == TV_RISE ? PROTOCOL_ES_UP : PROTOCOL_ES_DOWN);
if (CONFIGB(vvtCamSensorUseRise) ^ (front != TV_FALL)) { if (CONFIG(vvtCamSensorUseRise) ^ (front != TV_FALL)) {
return; return;
} }
@ -126,7 +126,7 @@ void hwHandleVvtCamSignal(trigger_value_e front DECLARE_ENGINE_PARAMETER_SUFFIX)
if (engineConfiguration->verboseTriggerSynchDetails) { if (engineConfiguration->verboseTriggerSynchDetails) {
scheduleMsg(logger, "vvt ratio %.2f", ratio); scheduleMsg(logger, "vvt ratio %.2f", ratio);
} }
if (ratio < CONFIGB(miataNb2VVTRatioFrom) || ratio > CONFIGB(miataNb2VVTRatioTo)) { if (ratio < CONFIG(miataNb2VVTRatioFrom) || ratio > CONFIG(miataNb2VVTRatioTo)) {
return; return;
} }
if (engineConfiguration->verboseTriggerSynchDetails) { if (engineConfiguration->verboseTriggerSynchDetails) {
@ -210,7 +210,7 @@ void hwHandleShaftSignal(trigger_event_e signal) {
// for effective noise filtering, we need both signal edges, // for effective noise filtering, we need both signal edges,
// so we pass them to handleShaftSignal() and defer this test // so we pass them to handleShaftSignal() and defer this test
if (!CONFIGB(useNoiselessTriggerDecoder)) { if (!CONFIG(useNoiselessTriggerDecoder)) {
if (!isUsefulSignal(signal PASS_ENGINE_PARAMETER_SUFFIX)) { if (!isUsefulSignal(signal PASS_ENGINE_PARAMETER_SUFFIX)) {
return; return;
} }
@ -333,7 +333,7 @@ void TriggerCentral::handleShaftSignal(trigger_event_e signal DECLARE_ENGINE_PAR
nowNt = getTimeNowNt(); nowNt = getTimeNowNt();
// This code gathers some statistics on signals and compares accumulated periods to filter interference // This code gathers some statistics on signals and compares accumulated periods to filter interference
if (CONFIGB(useNoiselessTriggerDecoder)) { if (CONFIG(useNoiselessTriggerDecoder)) {
if (!noiseFilter(nowNt, signal PASS_ENGINE_PARAMETER_SUFFIX)) { if (!noiseFilter(nowNt, signal PASS_ENGINE_PARAMETER_SUFFIX)) {
return; return;
} }
@ -469,7 +469,7 @@ void printAllTriggers() {
Engine *engine = &e; Engine *engine = &e;
persistent_config_s *config = &pc; persistent_config_s *config = &pc;
engine_configuration_s *engineConfiguration = &pc.engineConfiguration; engine_configuration_s *engineConfiguration = &pc.engineConfiguration;
board_configuration_s *boardConfiguration = &engineConfiguration->bc;
engineConfiguration->trigger.type = tt; engineConfiguration->trigger.type = tt;
engineConfiguration->ambiguousOperationMode = FOUR_STROKE_CAM_SENSOR; engineConfiguration->ambiguousOperationMode = FOUR_STROKE_CAM_SENSOR;
@ -604,27 +604,27 @@ void triggerInfo(void) {
} }
scheduleMsg(logger, "primary trigger input: %s", hwPortname(CONFIGB(triggerInputPins)[0])); scheduleMsg(logger, "primary trigger input: %s", hwPortname(CONFIG(triggerInputPins)[0]));
scheduleMsg(logger, "primary trigger simulator: %s %s freq=%d", scheduleMsg(logger, "primary trigger simulator: %s %s freq=%d",
hwPortname(CONFIGB(triggerSimulatorPins)[0]), hwPortname(CONFIG(triggerSimulatorPins)[0]),
getPin_output_mode_e(CONFIGB(triggerSimulatorPinModes)[0]), getPin_output_mode_e(CONFIG(triggerSimulatorPinModes)[0]),
CONFIGB(triggerSimulatorFrequency)); CONFIG(triggerSimulatorFrequency));
if (ts->needSecondTriggerInput) { if (ts->needSecondTriggerInput) {
scheduleMsg(logger, "secondary trigger input: %s", hwPortname(CONFIGB(triggerInputPins)[1])); scheduleMsg(logger, "secondary trigger input: %s", hwPortname(CONFIG(triggerInputPins)[1]));
#if EFI_EMULATE_POSITION_SENSORS #if EFI_EMULATE_POSITION_SENSORS
scheduleMsg(logger, "secondary trigger simulator: %s %s phase=%d", scheduleMsg(logger, "secondary trigger simulator: %s %s phase=%d",
hwPortname(CONFIGB(triggerSimulatorPins)[1]), hwPortname(CONFIG(triggerSimulatorPins)[1]),
getPin_output_mode_e(CONFIGB(triggerSimulatorPinModes)[1]), triggerSignal.safe.phaseIndex); getPin_output_mode_e(CONFIG(triggerSimulatorPinModes)[1]), triggerSignal.safe.phaseIndex);
#endif /* EFI_EMULATE_POSITION_SENSORS */ #endif /* EFI_EMULATE_POSITION_SENSORS */
} }
// scheduleMsg(logger, "3rd trigger simulator: %s %s", hwPortname(CONFIGB(triggerSimulatorPins)[2]), // scheduleMsg(logger, "3rd trigger simulator: %s %s", hwPortname(CONFIG(triggerSimulatorPins)[2]),
// getPin_output_mode_e(CONFIGB(triggerSimulatorPinModes)[2])); // getPin_output_mode_e(CONFIG(triggerSimulatorPinModes)[2]));
scheduleMsg(logger, "trigger error extra LED: %s %s", hwPortname(CONFIGB(triggerErrorPin)), scheduleMsg(logger, "trigger error extra LED: %s %s", hwPortname(CONFIG(triggerErrorPin)),
getPin_output_mode_e(CONFIGB(triggerErrorPinMode))); getPin_output_mode_e(CONFIG(triggerErrorPinMode)));
scheduleMsg(logger, "primary logic input: %s", hwPortname(CONFIGB(logicAnalyzerPins)[0])); scheduleMsg(logger, "primary logic input: %s", hwPortname(CONFIG(logicAnalyzerPins)[0]));
scheduleMsg(logger, "secondary logic input: %s", hwPortname(CONFIGB(logicAnalyzerPins)[1])); scheduleMsg(logger, "secondary logic input: %s", hwPortname(CONFIG(logicAnalyzerPins)[1]));
scheduleMsg(logger, "zeroTestTime=%d maxSchedulingPrecisionLoss=%d", engine->m.zeroTestTime, maxSchedulingPrecisionLoss); scheduleMsg(logger, "zeroTestTime=%d maxSchedulingPrecisionLoss=%d", engine->m.zeroTestTime, maxSchedulingPrecisionLoss);
@ -685,15 +685,15 @@ void onConfigurationChangeTriggerCallback(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
isConfigurationChanged(globalTriggerAngleOffset) || isConfigurationChanged(globalTriggerAngleOffset) ||
isConfigurationChanged(trigger.customTotalToothCount) || isConfigurationChanged(trigger.customTotalToothCount) ||
isConfigurationChanged(trigger.customSkippedToothCount) || isConfigurationChanged(trigger.customSkippedToothCount) ||
isConfigurationChanged(bc.triggerInputPins[0]) || isConfigurationChanged(triggerInputPins[0]) ||
isConfigurationChanged(bc.triggerInputPins[1]) || isConfigurationChanged(triggerInputPins[1]) ||
isConfigurationChanged(bc.triggerInputPins[2]) || isConfigurationChanged(triggerInputPins[2]) ||
isConfigurationChanged(vvtMode) || isConfigurationChanged(vvtMode) ||
isConfigurationChanged(bc.vvtCamSensorUseRise) || isConfigurationChanged(vvtCamSensorUseRise) ||
isConfigurationChanged(vvtOffset) || isConfigurationChanged(vvtOffset) ||
isConfigurationChanged(vvtDisplayInverted) || isConfigurationChanged(vvtDisplayInverted) ||
isConfigurationChanged(bc.miataNb2VVTRatioFrom) || isConfigurationChanged(miataNb2VVTRatioFrom) ||
isConfigurationChanged(bc.miataNb2VVTRatioTo) || isConfigurationChanged(miataNb2VVTRatioTo) ||
isConfigurationChanged(nbVvtIndex); isConfigurationChanged(nbVvtIndex);
if (changed) { if (changed) {
assertEngineReference(); assertEngineReference();

View File

@ -260,7 +260,7 @@ void TriggerStateWithRunningStatistics::runtimeStatistics(efitime_t nowNt DECLAR
#if EFI_SENSOR_CHART #if EFI_SENSOR_CHART
angle_t currentAngle = TRIGGER_WAVEFORM(eventAngles[currentCycle.current_index]); angle_t currentAngle = TRIGGER_WAVEFORM(eventAngles[currentCycle.current_index]);
if (CONFIGB(sensorChartMode) == SC_DETAILED_RPM) { if (CONFIG(sensorChartMode) == SC_DETAILED_RPM) {
scAddData(currentAngle, instantRpm); scAddData(currentAngle, instantRpm);
} else { } else {
scAddData(currentAngle, instantRpm / instantRpmValue[prevIndex]); scAddData(currentAngle, instantRpm / instantRpmValue[prevIndex]);
@ -767,8 +767,8 @@ void TriggerState::runtimeStatistics(efitime_t nowNt DECLARE_ENGINE_PARAMETER_SU
void initTriggerDecoder(DECLARE_ENGINE_PARAMETER_SIGNATURE) { void initTriggerDecoder(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
#if EFI_GPIO_HARDWARE #if EFI_GPIO_HARDWARE
enginePins.triggerDecoderErrorPin.initPin("trg_err", CONFIGB(triggerErrorPin), enginePins.triggerDecoderErrorPin.initPin("trg_err", CONFIG(triggerErrorPin),
&CONFIGB(triggerErrorPinMode)); &CONFIG(triggerErrorPinMode));
#endif /* EFI_GPIO_HARDWARE */ #endif /* EFI_GPIO_HARDWARE */
} }

View File

@ -95,7 +95,7 @@ extern WaveChart waveChart;
#endif /* EFI_ENGINE_SNIFFER */ #endif /* EFI_ENGINE_SNIFFER */
void setTriggerEmulatorRPM(int rpm DECLARE_ENGINE_PARAMETER_SUFFIX) { void setTriggerEmulatorRPM(int rpm DECLARE_ENGINE_PARAMETER_SUFFIX) {
engineConfiguration->bc.triggerSimulatorFrequency = rpm; engineConfiguration->triggerSimulatorFrequency = rpm;
/** /**
* All we need to do here is to change the periodMs * All we need to do here is to change the periodMs
* togglePwmState() would see that the periodMs has changed and act accordingly * togglePwmState() would see that the periodMs has changed and act accordingly
@ -165,7 +165,7 @@ void initTriggerEmulatorLogic(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUF
logger = sharedLogger; logger = sharedLogger;
TriggerWaveform *s = &engine->triggerCentral.triggerShape; TriggerWaveform *s = &engine->triggerCentral.triggerShape;
setTriggerEmulatorRPM(engineConfiguration->bc.triggerSimulatorFrequency PASS_ENGINE_PARAMETER_SUFFIX); setTriggerEmulatorRPM(engineConfiguration->triggerSimulatorFrequency PASS_ENGINE_PARAMETER_SUFFIX);
pin_state_t *pinStates[PWM_PHASE_MAX_WAVE_PER_PWM] = { pin_state_t *pinStates[PWM_PHASE_MAX_WAVE_PER_PWM] = {
s->wave.channels[0].pinStates, s->wave.channels[0].pinStates,
s->wave.channels[1].pinStates, s->wave.channels[1].pinStates,

View File

@ -97,19 +97,19 @@ static void setPotValue1(int value) {
void initPotentiometers(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX) { void initPotentiometers(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX) {
logger = sharedLogger; logger = sharedLogger;
#if EFI_POTENTIOMETER #if EFI_POTENTIOMETER
if (CONFIGB(digitalPotentiometerSpiDevice) == SPI_NONE) { if (CONFIG(digitalPotentiometerSpiDevice) == SPI_NONE) {
scheduleMsg(logger, "digiPot spi disabled"); scheduleMsg(logger, "digiPot spi disabled");
return; return;
} }
turnOnSpi(CONFIGB(digitalPotentiometerSpiDevice)); turnOnSpi(CONFIG(digitalPotentiometerSpiDevice));
for (int i = 0; i < DIGIPOT_COUNT; i++) { for (int i = 0; i < DIGIPOT_COUNT; i++) {
brain_pin_e csPin = CONFIGB(digitalPotentiometerChipSelect)[i]; brain_pin_e csPin = CONFIG(digitalPotentiometerChipSelect)[i];
if (csPin == GPIO_UNASSIGNED) { if (csPin == GPIO_UNASSIGNED) {
continue; continue;
} }
SPIDriver *driver = getSpiDevice(CONFIGB(digitalPotentiometerSpiDevice)); SPIDriver *driver = getSpiDevice(CONFIG(digitalPotentiometerSpiDevice));
if (driver == NULL) { if (driver == NULL) {
// error already reported // error already reported
return; return;

View File

@ -101,12 +101,12 @@ static void waIcuPeriodCallback(WaveReader *reader) {
} }
static void initWave(const char *name, int index) { static void initWave(const char *name, int index) {
brain_pin_e brainPin = CONFIGB(logicAnalyzerPins)[index]; brain_pin_e brainPin = CONFIG(logicAnalyzerPins)[index];
if (brainPin == GPIO_UNASSIGNED) if (brainPin == GPIO_UNASSIGNED)
return; return;
bool mode = CONFIGB(logicAnalyzerMode)[index]; bool mode = CONFIG(logicAnalyzerMode)[index];
waveReaderCount++; waveReaderCount++;
efiAssertVoid(CUSTOM_ERR_6655, index < MAX_ICU_COUNT, "too many ICUs"); efiAssertVoid(CUSTOM_ERR_6655, index < MAX_ICU_COUNT, "too many ICUs");

View File

@ -29,11 +29,11 @@ static OutputPin emulatorOutputs[3];
EXTERN_ENGINE; EXTERN_ENGINE;
void onConfigurationChangeRpmEmulatorCallback(engine_configuration_s *previousConfiguration) { void onConfigurationChangeRpmEmulatorCallback(engine_configuration_s *previousConfiguration) {
if (engineConfiguration->bc.triggerSimulatorFrequency == if (engineConfiguration->triggerSimulatorFrequency ==
previousConfiguration->bc.triggerSimulatorFrequency) { previousConfiguration->triggerSimulatorFrequency) {
return; return;
} }
setTriggerEmulatorRPM(engineConfiguration->bc.triggerSimulatorFrequency); setTriggerEmulatorRPM(engineConfiguration->triggerSimulatorFrequency);
} }
void initTriggerEmulator(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX) { void initTriggerEmulator(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX) {
@ -48,14 +48,14 @@ void initTriggerEmulator(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX)
#if EFI_PROD_CODE #if EFI_PROD_CODE
// todo: refactor, make this a loop // todo: refactor, make this a loop
triggerSignal.outputPins[0]->initPin("trg emulator ch1", CONFIGB(triggerSimulatorPins)[0], triggerSignal.outputPins[0]->initPin("trg emulator ch1", CONFIG(triggerSimulatorPins)[0],
&CONFIGB(triggerSimulatorPinModes)[0]); &CONFIG(triggerSimulatorPinModes)[0]);
triggerSignal.outputPins[1]->initPin("trg emulator ch2", CONFIGB(triggerSimulatorPins)[1], triggerSignal.outputPins[1]->initPin("trg emulator ch2", CONFIG(triggerSimulatorPins)[1],
&CONFIGB(triggerSimulatorPinModes)[1]); &CONFIG(triggerSimulatorPinModes)[1]);
triggerSignal.outputPins[2]->initPin("trg emulator ch3", CONFIGB(triggerSimulatorPins)[2], triggerSignal.outputPins[2]->initPin("trg emulator ch3", CONFIG(triggerSimulatorPins)[2],
&CONFIGB(triggerSimulatorPinModes)[2]); &CONFIG(triggerSimulatorPinModes)[2]);
#endif /* EFI_PROD_CODE */ #endif /* EFI_PROD_CODE */
initTriggerEmulatorLogic(sharedLogger); initTriggerEmulatorLogic(sharedLogger);

View File

@ -514,9 +514,9 @@ static void configureInputs(void) {
addChannel("IAT", engineConfiguration->iat.adcChannel, ADC_SLOW); addChannel("IAT", engineConfiguration->iat.adcChannel, ADC_SLOW);
addChannel("AUXT#1", engineConfiguration->auxTempSensor1.adcChannel, ADC_SLOW); addChannel("AUXT#1", engineConfiguration->auxTempSensor1.adcChannel, ADC_SLOW);
addChannel("AUXT#2", engineConfiguration->auxTempSensor2.adcChannel, ADC_SLOW); addChannel("AUXT#2", engineConfiguration->auxTempSensor2.adcChannel, ADC_SLOW);
if (engineConfiguration->bc.auxFastSensor1_adcChannel != EFI_ADC_0) { if (engineConfiguration->auxFastSensor1_adcChannel != EFI_ADC_0) {
// allow EFI_ADC_0 next time we have an incompatible configuration change // allow EFI_ADC_0 next time we have an incompatible configuration change
addChannel("AUXF#1", engineConfiguration->bc.auxFastSensor1_adcChannel, ADC_FAST); addChannel("AUXF#1", engineConfiguration->auxFastSensor1_adcChannel, ADC_FAST);
} }
addChannel("AFR", engineConfiguration->afr.hwChannel, ADC_SLOW); addChannel("AFR", engineConfiguration->afr.hwChannel, ADC_SLOW);
addChannel("OilP", engineConfiguration->oilPressure.hwChannel, ADC_SLOW); addChannel("OilP", engineConfiguration->oilPressure.hwChannel, ADC_SLOW);
@ -526,7 +526,7 @@ static void configureInputs(void) {
if (engineConfiguration->high_fuel_pressure_sensor_2 != INCOMPATIBLE_CONFIG_CHANGE) if (engineConfiguration->high_fuel_pressure_sensor_2 != INCOMPATIBLE_CONFIG_CHANGE)
addChannel("HFP2", engineConfiguration->high_fuel_pressure_sensor_2, ADC_SLOW); addChannel("HFP2", engineConfiguration->high_fuel_pressure_sensor_2, ADC_SLOW);
if (CONFIGB(isCJ125Enabled)) { if (CONFIG(isCJ125Enabled)) {
addChannel("cj125ur", engineConfiguration->cj125ur, ADC_SLOW); addChannel("cj125ur", engineConfiguration->cj125ur, ADC_SLOW);
addChannel("cj125ua", engineConfiguration->cj125ua, ADC_SLOW); addChannel("cj125ua", engineConfiguration->cj125ua, ADC_SLOW);
} }
@ -583,7 +583,7 @@ void initAdcInputs() {
// Start the slow ADC thread // Start the slow ADC thread
slowAdcController.Start(); slowAdcController.Start();
if (CONFIGB(isFastAdcEnabled)) { if (CONFIG(isFastAdcEnabled)) {
fastAdc.init(); fastAdc.init();
/* /*
* Initializes the PWM driver. * Initializes the PWM driver.

View File

@ -112,8 +112,8 @@ void commonTxInit(int eid) {
* send CAN message from txmsg buffer * send CAN message from txmsg buffer
*/ */
static void sendCanMessage2(int size) { static void sendCanMessage2(int size) {
CANDriver *device = detectCanDevice(CONFIGB(canRxPin), CANDriver *device = detectCanDevice(CONFIG(canRxPin),
CONFIGB(canTxPin)); CONFIG(canTxPin));
if (device == NULL) { if (device == NULL) {
warning(CUSTOM_ERR_CAN_CONFIGURATION, "CAN configuration issue"); warning(CUSTOM_ERR_CAN_CONFIGURATION, "CAN configuration issue");
return; return;
@ -242,8 +242,8 @@ static void canInfoNBCBroadcast(can_nbc_e typeOfNBC) {
} }
static void canRead(void) { static void canRead(void) {
CANDriver *device = detectCanDevice(CONFIGB(canRxPin), CANDriver *device = detectCanDevice(CONFIG(canRxPin),
CONFIGB(canTxPin)); CONFIG(canTxPin));
if (device == NULL) { if (device == NULL) {
warning(CUSTOM_ERR_CAN_CONFIGURATION, "CAN configuration issue"); warning(CUSTOM_ERR_CAN_CONFIGURATION, "CAN configuration issue");
return; return;
@ -291,8 +291,8 @@ static void canInfo(void) {
return; return;
} }
scheduleMsg(&logger, "CAN TX %s", hwPortname(CONFIGB(canTxPin))); scheduleMsg(&logger, "CAN TX %s", hwPortname(CONFIG(canTxPin)));
scheduleMsg(&logger, "CAN RX %s", hwPortname(CONFIGB(canRxPin))); scheduleMsg(&logger, "CAN RX %s", hwPortname(CONFIG(canRxPin)));
scheduleMsg(&logger, "type=%d canReadEnabled=%s canWriteEnabled=%s period=%d", engineConfiguration->canNbcType, scheduleMsg(&logger, "type=%d canReadEnabled=%s canWriteEnabled=%s period=%d", engineConfiguration->canNbcType,
boolToString(engineConfiguration->canReadEnabled), boolToString(engineConfiguration->canWriteEnabled), boolToString(engineConfiguration->canReadEnabled), boolToString(engineConfiguration->canWriteEnabled),
engineConfiguration->canSleepPeriodMs); engineConfiguration->canSleepPeriodMs);
@ -314,28 +314,28 @@ void postCanState(TunerStudioOutputChannels *tsOutputChannels) {
#endif /* EFI_TUNER_STUDIO */ #endif /* EFI_TUNER_STUDIO */
void enableFrankensoCan(DECLARE_ENGINE_PARAMETER_SIGNATURE) { void enableFrankensoCan(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
CONFIGB(canTxPin) = GPIOB_6; CONFIG(canTxPin) = GPIOB_6;
CONFIGB(canRxPin) = GPIOB_12; CONFIG(canRxPin) = GPIOB_12;
engineConfiguration->canReadEnabled = false; engineConfiguration->canReadEnabled = false;
} }
void stopCanPins(DECLARE_ENGINE_PARAMETER_SIGNATURE) { void stopCanPins(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
brain_pin_markUnused(activeConfiguration.bc.canTxPin); brain_pin_markUnused(activeConfiguration.canTxPin);
brain_pin_markUnused(activeConfiguration.bc.canRxPin); brain_pin_markUnused(activeConfiguration.canRxPin);
} }
void startCanPins(DECLARE_ENGINE_PARAMETER_SIGNATURE) { void startCanPins(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
efiSetPadMode("CAN TX", CONFIGB(canTxPin), PAL_MODE_ALTERNATE(EFI_CAN_TX_AF)); efiSetPadMode("CAN TX", CONFIG(canTxPin), PAL_MODE_ALTERNATE(EFI_CAN_TX_AF));
efiSetPadMode("CAN RX", CONFIGB(canRxPin), PAL_MODE_ALTERNATE(EFI_CAN_RX_AF)); efiSetPadMode("CAN RX", CONFIG(canRxPin), PAL_MODE_ALTERNATE(EFI_CAN_RX_AF));
} }
void initCan(void) { void initCan(void) {
isCanEnabled = (CONFIGB(canTxPin) != GPIO_UNASSIGNED) && (CONFIGB(canRxPin) != GPIO_UNASSIGNED); isCanEnabled = (CONFIG(canTxPin) != GPIO_UNASSIGNED) && (CONFIG(canRxPin) != GPIO_UNASSIGNED);
if (isCanEnabled) { if (isCanEnabled) {
if (!isValidCanTxPin(CONFIGB(canTxPin))) if (!isValidCanTxPin(CONFIG(canTxPin)))
firmwareError(CUSTOM_OBD_70, "invalid CAN TX %s", hwPortname(CONFIGB(canTxPin))); firmwareError(CUSTOM_OBD_70, "invalid CAN TX %s", hwPortname(CONFIG(canTxPin)));
if (!isValidCanRxPin(CONFIGB(canRxPin))) if (!isValidCanRxPin(CONFIG(canRxPin)))
firmwareError(CUSTOM_OBD_70, "invalid CAN RX %s", hwPortname(CONFIGB(canRxPin))); firmwareError(CUSTOM_OBD_70, "invalid CAN RX %s", hwPortname(CONFIG(canRxPin)));
} }
addConsoleAction("caninfo", canInfo); addConsoleAction("caninfo", canInfo);

View File

@ -74,16 +74,16 @@ static void extIonCallback(void *arg) {
} }
void cdmIonInit(void) { void cdmIonInit(void) {
if (CONFIGB(cdmInputPin) == GPIO_UNASSIGNED) { if (CONFIG(cdmInputPin) == GPIO_UNASSIGNED) {
return; return;
} }
int pin = (int)CONFIGB(cdmInputPin); int pin = (int)CONFIG(cdmInputPin);
if (pin <= 0 || pin > (int)GPIO_UNASSIGNED) { if (pin <= 0 || pin > (int)GPIO_UNASSIGNED) {
// todo: remove this protection once we migrate to new mandatory configuration // todo: remove this protection once we migrate to new mandatory configuration
return; return;
} }
efiExtiEnablePin("ion", CONFIGB(cdmInputPin), PAL_EVENT_MODE_RISING_EDGE, extIonCallback, NULL); efiExtiEnablePin("ion", CONFIG(cdmInputPin), PAL_EVENT_MODE_RISING_EDGE, extIonCallback, NULL);
} }
#endif /* EFI_CDM_INTEGRATION */ #endif /* EFI_CDM_INTEGRATION */

View File

@ -103,15 +103,15 @@ void unlockSpi(void) {
chMtxUnlock(&spiMtx); chMtxUnlock(&spiMtx);
} }
static void initSpiModules(board_configuration_s *boardConfiguration) { static void initSpiModules(engine_configuration_s *engineConfiguration) {
UNUSED(boardConfiguration); UNUSED(engineConfiguration);
if (CONFIGB(is_enabled_spi_1)) { if (CONFIG(is_enabled_spi_1)) {
turnOnSpi(SPI_DEVICE_1); turnOnSpi(SPI_DEVICE_1);
} }
if (CONFIGB(is_enabled_spi_2)) { if (CONFIG(is_enabled_spi_2)) {
turnOnSpi(SPI_DEVICE_2); turnOnSpi(SPI_DEVICE_2);
} }
if (CONFIGB(is_enabled_spi_3)) { if (CONFIG(is_enabled_spi_3)) {
turnOnSpi(SPI_DEVICE_3); turnOnSpi(SPI_DEVICE_3);
} }
} }
@ -217,7 +217,7 @@ void adc_callback_fast(ADCDriver *adcp, adcsample_t *buffer, size_t n) {
#if EFI_SENSOR_CHART #if EFI_SENSOR_CHART
if (ENGINE(sensorChartMode) == SC_AUX_FAST1) { if (ENGINE(sensorChartMode) == SC_AUX_FAST1) {
float voltage = getAdcValue("fAux1", engineConfiguration->bc.auxFastSensor1_adcChannel); float voltage = getAdcValue("fAux1", engineConfiguration->auxFastSensor1_adcChannel);
scAddData(getCrankshaftAngleNt(getTimeNowNt() PASS_ENGINE_PARAMETER_SUFFIX), voltage); scAddData(getCrankshaftAngleNt(getTimeNowNt() PASS_ENGINE_PARAMETER_SUFFIX), voltage);
} }
#endif /* EFI_SENSOR_CHART */ #endif /* EFI_SENSOR_CHART */
@ -226,7 +226,7 @@ void adc_callback_fast(ADCDriver *adcp, adcsample_t *buffer, size_t n) {
mapAveragingAdcCallback(fastAdc.samples[fastMapSampleIndex]); mapAveragingAdcCallback(fastAdc.samples[fastMapSampleIndex]);
#endif /* EFI_MAP_AVERAGING */ #endif /* EFI_MAP_AVERAGING */
#if EFI_HIP_9011 #if EFI_HIP_9011
if (CONFIGB(isHip9011Enabled)) { if (CONFIG(isHip9011Enabled)) {
hipAdcCallback(fastAdc.samples[hipSampleIndex]); hipAdcCallback(fastAdc.samples[hipSampleIndex]);
} }
#endif /* EFI_HIP_9011 */ #endif /* EFI_HIP_9011 */
@ -327,13 +327,13 @@ void applyNewHardwareSettings(void) {
stopAuxPins(); stopAuxPins();
#endif /* EFI_AUX_PID */ #endif /* EFI_AUX_PID */
if (isConfigurationChanged(bc.is_enabled_spi_1)) if (isConfigurationChanged(is_enabled_spi_1))
stopSpi(SPI_DEVICE_1); stopSpi(SPI_DEVICE_1);
if (isConfigurationChanged(bc.is_enabled_spi_2)) if (isConfigurationChanged(is_enabled_spi_2))
stopSpi(SPI_DEVICE_2); stopSpi(SPI_DEVICE_2);
if (isConfigurationChanged(bc.is_enabled_spi_3)) if (isConfigurationChanged(is_enabled_spi_3))
stopSpi(SPI_DEVICE_3); stopSpi(SPI_DEVICE_3);
#if EFI_HD44780_LCD #if EFI_HD44780_LCD
@ -407,7 +407,7 @@ void initHardware(Logging *l) {
sharedLogger = l; sharedLogger = l;
engine_configuration_s *engineConfiguration = engine->engineConfigurationPtr; engine_configuration_s *engineConfiguration = engine->engineConfigurationPtr;
efiAssertVoid(CUSTOM_EC_NULL, engineConfiguration!=NULL, "engineConfiguration"); efiAssertVoid(CUSTOM_EC_NULL, engineConfiguration!=NULL, "engineConfiguration");
board_configuration_s *boardConfiguration = &engineConfiguration->bc;
printMsg(sharedLogger, "initHardware()"); printMsg(sharedLogger, "initHardware()");
// todo: enable protection. it's disabled because it takes // todo: enable protection. it's disabled because it takes
@ -487,7 +487,7 @@ void initHardware(Logging *l) {
initRtc(); initRtc();
#if HAL_USE_SPI #if HAL_USE_SPI
initSpiModules(boardConfiguration); initSpiModules(engineConfiguration);
#endif /* HAL_USE_SPI */ #endif /* HAL_USE_SPI */
// initSmartGpio depends on 'initSpiModules' // initSmartGpio depends on 'initSpiModules'
initSmartGpio(PASS_ENGINE_PARAMETER_SIGNATURE); initSmartGpio(PASS_ENGINE_PARAMETER_SIGNATURE);
@ -500,7 +500,7 @@ void initHardware(Logging *l) {
#endif /* EFI_MC33816 */ #endif /* EFI_MC33816 */
#if EFI_MAX_31855 #if EFI_MAX_31855
initMax31855(sharedLogger, CONFIGB(max31855spiDevice), CONFIGB(max31855_cs)); initMax31855(sharedLogger, CONFIG(max31855spiDevice), CONFIG(max31855_cs));
#endif /* EFI_MAX_31855 */ #endif /* EFI_MAX_31855 */
#if EFI_CAN_SUPPORT #if EFI_CAN_SUPPORT

View File

@ -132,14 +132,14 @@ EXTERN_ENGINE
static char hipPinNameBuffer[16]; static char hipPinNameBuffer[16];
static void showHipInfo(void) { static void showHipInfo(void) {
if (!CONFIGB(isHip9011Enabled)) { if (!CONFIG(isHip9011Enabled)) {
scheduleMsg(logger, "hip9011 driver not active"); scheduleMsg(logger, "hip9011 driver not active");
return; return;
} }
printSpiState(logger, boardConfiguration); printSpiState(logger, engineConfiguration);
scheduleMsg(logger, "enabled=%s state=%s bore=%.2fmm freq=%.2fkHz PaSDO=%d", scheduleMsg(logger, "enabled=%s state=%s bore=%.2fmm freq=%.2fkHz PaSDO=%d",
boolToString(CONFIGB(isHip9011Enabled)), boolToString(CONFIG(isHip9011Enabled)),
getHip_state_e(instance.state), getHip_state_e(instance.state),
engineConfiguration->cylinderBore, getHIP9011Band(PASS_HIP_PARAMS), engineConfiguration->cylinderBore, getHIP9011Band(PASS_HIP_PARAMS),
engineConfiguration->hip9011PrescalerAndSDO); engineConfiguration->hip9011PrescalerAndSDO);
@ -155,11 +155,11 @@ static void showHipInfo(void) {
const char * msg = instance.invalidHip9011ResponsesCount > 0 ? "NOT GOOD" : "ok"; const char * msg = instance.invalidHip9011ResponsesCount > 0 ? "NOT GOOD" : "ok";
scheduleMsg(logger, "spi=%s IntHold@%s/%d response count=%d incorrect response=%d %s", scheduleMsg(logger, "spi=%s IntHold@%s/%d response count=%d incorrect response=%d %s",
getSpi_device_e(engineConfiguration->hip9011SpiDevice), getSpi_device_e(engineConfiguration->hip9011SpiDevice),
hwPortname(CONFIGB(hip9011IntHoldPin)), hwPortname(CONFIG(hip9011IntHoldPin)),
CONFIGB(hip9011IntHoldPinMode), CONFIG(hip9011IntHoldPinMode),
instance.correctResponsesCount, instance.invalidHip9011ResponsesCount, instance.correctResponsesCount, instance.invalidHip9011ResponsesCount,
msg); msg);
scheduleMsg(logger, "CS@%s updateCount=%d", hwPortname(CONFIGB(hip9011CsPin)), instance.settingUpdateCount); scheduleMsg(logger, "CS@%s updateCount=%d", hwPortname(CONFIG(hip9011CsPin)), instance.settingUpdateCount);
#if EFI_PROD_CODE #if EFI_PROD_CODE
scheduleMsg(logger, "hip %.2fv/last=%.2f@%s/max=%.2f adv=%d", scheduleMsg(logger, "hip %.2fv/last=%.2f@%s/max=%.2f adv=%d",
@ -167,7 +167,7 @@ static void showHipInfo(void) {
getVoltage("hipinfo", engineConfiguration->hipOutputChannel), getVoltage("hipinfo", engineConfiguration->hipOutputChannel),
getPinNameByAdcChannel("hip", engineConfiguration->hipOutputChannel, pinNameBuffer), getPinNameByAdcChannel("hip", engineConfiguration->hipOutputChannel, pinNameBuffer),
hipValueMax, hipValueMax,
CONFIGB(useTpicAdvancedMode)); CONFIG(useTpicAdvancedMode));
scheduleMsg(logger, "mosi=%s", hwPortname(getMosiPin(engineConfiguration->hip9011SpiDevice))); scheduleMsg(logger, "mosi=%s", hwPortname(getMosiPin(engineConfiguration->hip9011SpiDevice)));
scheduleMsg(logger, "miso=%s", hwPortname(getMisoPin(engineConfiguration->hip9011SpiDevice))); scheduleMsg(logger, "miso=%s", hwPortname(getMisoPin(engineConfiguration->hip9011SpiDevice)));
scheduleMsg(logger, "sck=%s", hwPortname(getSckPin(engineConfiguration->hip9011SpiDevice))); scheduleMsg(logger, "sck=%s", hwPortname(getSckPin(engineConfiguration->hip9011SpiDevice)));
@ -184,22 +184,22 @@ void setHip9011FrankensoPinout(void) {
/** /**
* SPI on PB13/14/15 * SPI on PB13/14/15
*/ */
// CONFIGB(hip9011CsPin) = GPIOD_0; // rev 0.1 // CONFIG(hip9011CsPin) = GPIOD_0; // rev 0.1
CONFIGB(isHip9011Enabled) = true; CONFIG(isHip9011Enabled) = true;
engineConfiguration->hip9011PrescalerAndSDO = _8MHZ_PRESCALER; // 8MHz chip engineConfiguration->hip9011PrescalerAndSDO = _8MHZ_PRESCALER; // 8MHz chip
CONFIGB(is_enabled_spi_2) = true; CONFIG(is_enabled_spi_2) = true;
// todo: convert this to rusEfi, hardware-independent enum // todo: convert this to rusEfi, hardware-independent enum
#if EFI_PROD_CODE #if EFI_PROD_CODE
#ifdef EFI_HIP_CS_PIN #ifdef EFI_HIP_CS_PIN
CONFIGB(hip9011CsPin) = EFI_HIP_CS_PIN; CONFIG(hip9011CsPin) = EFI_HIP_CS_PIN;
#else #else
CONFIGB(hip9011CsPin) = GPIOB_0; // rev 0.4 CONFIG(hip9011CsPin) = GPIOB_0; // rev 0.4
#endif #endif
CONFIGB(hip9011CsPinMode) = OM_OPENDRAIN; CONFIG(hip9011CsPinMode) = OM_OPENDRAIN;
CONFIGB(hip9011IntHoldPin) = GPIOB_11; CONFIG(hip9011IntHoldPin) = GPIOB_11;
CONFIGB(hip9011IntHoldPinMode) = OM_OPENDRAIN; CONFIG(hip9011IntHoldPinMode) = OM_OPENDRAIN;
engineConfiguration->spi2SckMode = PO_OPENDRAIN; // 4 engineConfiguration->spi2SckMode = PO_OPENDRAIN; // 4
engineConfiguration->spi2MosiMode = PO_OPENDRAIN; // 4 engineConfiguration->spi2MosiMode = PO_OPENDRAIN; // 4
@ -211,7 +211,7 @@ void setHip9011FrankensoPinout(void) {
engineConfiguration->maxKnockSubDeg = 20; engineConfiguration->maxKnockSubDeg = 20;
if (!CONFIGB(useTpicAdvancedMode)) { if (!CONFIG(useTpicAdvancedMode)) {
engineConfiguration->hipOutputChannel = EFI_ADC_10; // PC0 engineConfiguration->hipOutputChannel = EFI_ADC_10; // PC0
} }
} }
@ -341,7 +341,7 @@ static void hipStartupCode(void) {
warning(CUSTOM_OBD_KNOCK_PROCESSOR, "TPIC/HIP does not respond"); warning(CUSTOM_OBD_KNOCK_PROCESSOR, "TPIC/HIP does not respond");
} }
if (CONFIGB(useTpicAdvancedMode)) { if (CONFIG(useTpicAdvancedMode)) {
// enable advanced mode for digital integrator output // enable advanced mode for digital integrator output
instance.hardware->sendSyncCommand(SET_ADVANCED_MODE); instance.hardware->sendSyncCommand(SET_ADVANCED_MODE);
} }
@ -384,20 +384,20 @@ static msg_t hipThread(void *arg) {
void stopHip9001_pins() { void stopHip9001_pins() {
#if EFI_PROD_CODE #if EFI_PROD_CODE
brain_pin_markUnused(activeConfiguration.bc.hip9011IntHoldPin); brain_pin_markUnused(activeConfiguration.hip9011IntHoldPin);
brain_pin_markUnused(activeConfiguration.bc.hip9011CsPin); brain_pin_markUnused(activeConfiguration.hip9011CsPin);
#endif /* EFI_PROD_CODE */ #endif /* EFI_PROD_CODE */
} }
void startHip9001_pins() { void startHip9001_pins() {
intHold.initPin("hip int/hold", CONFIGB(hip9011IntHoldPin), &CONFIGB(hip9011IntHoldPinMode)); intHold.initPin("hip int/hold", CONFIG(hip9011IntHoldPin), &CONFIG(hip9011IntHoldPinMode));
enginePins.hipCs.initPin("hip CS", CONFIGB(hip9011CsPin), &CONFIGB(hip9011CsPinMode)); enginePins.hipCs.initPin("hip CS", CONFIG(hip9011CsPin), &CONFIG(hip9011CsPinMode));
} }
void initHip9011(Logging *sharedLogger) { void initHip9011(Logging *sharedLogger) {
logger = sharedLogger; logger = sharedLogger;
addConsoleAction("hipinfo", showHipInfo); addConsoleAction("hipinfo", showHipInfo);
if (!CONFIGB(isHip9011Enabled)) if (!CONFIG(isHip9011Enabled))
return; return;
@ -410,8 +410,8 @@ void initHip9011(Logging *sharedLogger) {
return; return;
} }
hipSpiCfg.ssport = getHwPort("hip", CONFIGB(hip9011CsPin)); hipSpiCfg.ssport = getHwPort("hip", CONFIG(hip9011CsPin));
hipSpiCfg.sspad = getHwPin("hip", CONFIGB(hip9011CsPin)); hipSpiCfg.sspad = getHwPin("hip", CONFIG(hip9011CsPin));
#endif /* EFI_PROD_CODE */ #endif /* EFI_PROD_CODE */
startHip9001_pins(); startHip9001_pins();

View File

@ -83,18 +83,18 @@ static void writePad(const char *msg, brain_pin_e pin, int bit) {
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
static void lcd_HD44780_write(uint8_t data) { static void lcd_HD44780_write(uint8_t data) {
if (engineConfiguration->displayMode == DM_HD44780) { if (engineConfiguration->displayMode == DM_HD44780) {
writePad("lcd", CONFIGB(HD44780_db7), writePad("lcd", CONFIG(HD44780_db7),
data & 0x80 ? 1 : 0); data & 0x80 ? 1 : 0);
writePad("lcd", CONFIGB(HD44780_db6), writePad("lcd", CONFIG(HD44780_db6),
data & 0x40 ? 1 : 0); data & 0x40 ? 1 : 0);
writePad("lcd", CONFIGB(HD44780_db5), writePad("lcd", CONFIG(HD44780_db5),
data & 0x20 ? 1 : 0); data & 0x20 ? 1 : 0);
writePad("lcd", CONFIGB(HD44780_db4), writePad("lcd", CONFIG(HD44780_db4),
data & 0x10 ? 1 : 0); data & 0x10 ? 1 : 0);
writePad("lcd", CONFIGB(HD44780_e), 1); // En high writePad("lcd", CONFIG(HD44780_e), 1); // En high
lcdSleep(10); // enable pulse must be >450ns lcdSleep(10); // enable pulse must be >450ns
writePad("lcd", CONFIGB(HD44780_e), 0); // En low writePad("lcd", CONFIG(HD44780_e), 0); // En low
lcdSleep(40); // commands need > 37us to settle lcdSleep(40); // commands need > 37us to settle
} else { } else {
@ -124,7 +124,7 @@ static void lcd_HD44780_write(uint8_t data) {
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void lcd_HD44780_write_command(uint8_t data) { void lcd_HD44780_write_command(uint8_t data) {
palClearPad(getHwPort("lcd", CONFIGB(HD44780_rs)), getHwPin("lcd", CONFIGB(HD44780_rs))); palClearPad(getHwPort("lcd", CONFIG(HD44780_rs)), getHwPin("lcd", CONFIG(HD44780_rs)));
lcd_HD44780_write(data); lcd_HD44780_write(data);
lcd_HD44780_write(data << 4); lcd_HD44780_write(data << 4);
@ -132,13 +132,13 @@ void lcd_HD44780_write_command(uint8_t data) {
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void lcd_HD44780_write_data(uint8_t data) { void lcd_HD44780_write_data(uint8_t data) {
palSetPad(getHwPort("lcd", CONFIGB(HD44780_rs)), getHwPin("lcd", CONFIGB(HD44780_rs))); palSetPad(getHwPort("lcd", CONFIG(HD44780_rs)), getHwPin("lcd", CONFIG(HD44780_rs)));
lcd_HD44780_write(data); lcd_HD44780_write(data);
lcd_HD44780_write(data << 4); lcd_HD44780_write(data << 4);
currentColumn++; currentColumn++;
palClearPad(getHwPort("lcd", CONFIGB(HD44780_rs)), getHwPin("lcd", CONFIGB(HD44780_rs))); palClearPad(getHwPort("lcd", CONFIG(HD44780_rs)), getHwPin("lcd", CONFIG(HD44780_rs)));
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@ -170,41 +170,41 @@ void lcd_HD44780_print_string(const char* string) {
lcd_HD44780_print_char(*string++); lcd_HD44780_print_char(*string++);
} }
//getHwPin(CONFIGB(HD44780_db7)) //getHwPin(CONFIG(HD44780_db7))
static void lcdInfo(DECLARE_ENGINE_PARAMETER_SIGNATURE) { static void lcdInfo(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
scheduleMsg(logger, "HD44780 RS=%s", hwPortname(CONFIGB(HD44780_rs))); scheduleMsg(logger, "HD44780 RS=%s", hwPortname(CONFIG(HD44780_rs)));
scheduleMsg(logger, "HD44780 E=%s", hwPortname(CONFIGB(HD44780_e))); scheduleMsg(logger, "HD44780 E=%s", hwPortname(CONFIG(HD44780_e)));
scheduleMsg(logger, "HD44780 D4=%s", hwPortname(CONFIGB(HD44780_db4))); scheduleMsg(logger, "HD44780 D4=%s", hwPortname(CONFIG(HD44780_db4)));
scheduleMsg(logger, "HD44780 D5=%s", hwPortname(CONFIGB(HD44780_db5))); scheduleMsg(logger, "HD44780 D5=%s", hwPortname(CONFIG(HD44780_db5)));
scheduleMsg(logger, "HD44780 D6=%s", hwPortname(CONFIGB(HD44780_db6))); scheduleMsg(logger, "HD44780 D6=%s", hwPortname(CONFIG(HD44780_db6)));
scheduleMsg(logger, "HD44780 D7=%s", hwPortname(CONFIGB(HD44780_db7))); scheduleMsg(logger, "HD44780 D7=%s", hwPortname(CONFIG(HD44780_db7)));
} }
void stopHD44780_pins() { void stopHD44780_pins() {
brain_pin_markUnused(activeConfiguration.bc.HD44780_rs); brain_pin_markUnused(activeConfiguration.HD44780_rs);
brain_pin_markUnused(activeConfiguration.bc.HD44780_e); brain_pin_markUnused(activeConfiguration.HD44780_e);
brain_pin_markUnused(activeConfiguration.bc.HD44780_db4); brain_pin_markUnused(activeConfiguration.HD44780_db4);
brain_pin_markUnused(activeConfiguration.bc.HD44780_db5); brain_pin_markUnused(activeConfiguration.HD44780_db5);
brain_pin_markUnused(activeConfiguration.bc.HD44780_db6); brain_pin_markUnused(activeConfiguration.HD44780_db6);
brain_pin_markUnused(activeConfiguration.bc.HD44780_db7); brain_pin_markUnused(activeConfiguration.HD44780_db7);
} }
void startHD44780_pins() { void startHD44780_pins() {
if (engineConfiguration->displayMode == DM_HD44780) { if (engineConfiguration->displayMode == DM_HD44780) {
// initialize hardware lines // initialize hardware lines
efiSetPadMode("lcd RS", CONFIGB(HD44780_rs), PAL_MODE_OUTPUT_PUSHPULL); efiSetPadMode("lcd RS", CONFIG(HD44780_rs), PAL_MODE_OUTPUT_PUSHPULL);
efiSetPadMode("lcd E", CONFIGB(HD44780_e), PAL_MODE_OUTPUT_PUSHPULL); efiSetPadMode("lcd E", CONFIG(HD44780_e), PAL_MODE_OUTPUT_PUSHPULL);
efiSetPadMode("lcd DB4", CONFIGB(HD44780_db4), PAL_MODE_OUTPUT_PUSHPULL); efiSetPadMode("lcd DB4", CONFIG(HD44780_db4), PAL_MODE_OUTPUT_PUSHPULL);
efiSetPadMode("lcd DB5", CONFIGB(HD44780_db5), PAL_MODE_OUTPUT_PUSHPULL); efiSetPadMode("lcd DB5", CONFIG(HD44780_db5), PAL_MODE_OUTPUT_PUSHPULL);
efiSetPadMode("lcd DB6", CONFIGB(HD44780_db6), PAL_MODE_OUTPUT_PUSHPULL); efiSetPadMode("lcd DB6", CONFIG(HD44780_db6), PAL_MODE_OUTPUT_PUSHPULL);
efiSetPadMode("lcd DB7", CONFIGB(HD44780_db7), PAL_MODE_OUTPUT_PUSHPULL); efiSetPadMode("lcd DB7", CONFIG(HD44780_db7), PAL_MODE_OUTPUT_PUSHPULL);
// and zero values // and zero values
palWritePad(getHwPort("lcd", CONFIGB(HD44780_rs)), getHwPin("lcd", CONFIGB(HD44780_rs)), 0); palWritePad(getHwPort("lcd", CONFIG(HD44780_rs)), getHwPin("lcd", CONFIG(HD44780_rs)), 0);
palWritePad(getHwPort("lcd", CONFIGB(HD44780_e)), getHwPin("lcd", CONFIGB(HD44780_e)), 0); palWritePad(getHwPort("lcd", CONFIG(HD44780_e)), getHwPin("lcd", CONFIG(HD44780_e)), 0);
palWritePad(getHwPort("lcd", CONFIGB(HD44780_db4)), getHwPin("lcd", CONFIGB(HD44780_db4)), 0); palWritePad(getHwPort("lcd", CONFIG(HD44780_db4)), getHwPin("lcd", CONFIG(HD44780_db4)), 0);
palWritePad(getHwPort("lcd", CONFIGB(HD44780_db5)), getHwPin("lcd", CONFIGB(HD44780_db5)), 0); palWritePad(getHwPort("lcd", CONFIG(HD44780_db5)), getHwPin("lcd", CONFIG(HD44780_db5)), 0);
palWritePad(getHwPort("lcd", CONFIGB(HD44780_db6)), getHwPin("lcd", CONFIGB(HD44780_db6)), 0); palWritePad(getHwPort("lcd", CONFIG(HD44780_db6)), getHwPin("lcd", CONFIG(HD44780_db6)), 0);
palWritePad(getHwPort("lcd", CONFIGB(HD44780_db7)), getHwPin("lcd", CONFIGB(HD44780_db7)), 0); palWritePad(getHwPort("lcd", CONFIG(HD44780_db7)), getHwPin("lcd", CONFIG(HD44780_db7)), 0);
} }
} }

View File

@ -37,13 +37,13 @@ EXTERN_ENGINE;
static void showEgtInfo(void) { static void showEgtInfo(void) {
#if EFI_PROD_CODE #if EFI_PROD_CODE
printSpiState(logger, boardConfiguration); printSpiState(logger, engineConfiguration);
scheduleMsg(logger, "EGT spi: %d", CONFIGB(max31855spiDevice)); scheduleMsg(logger, "EGT spi: %d", CONFIG(max31855spiDevice));
for (int i = 0; i < EGT_CHANNEL_COUNT; i++) { for (int i = 0; i < EGT_CHANNEL_COUNT; i++) {
if (CONFIGB(max31855_cs)[i] != GPIO_UNASSIGNED) { if (CONFIG(max31855_cs)[i] != GPIO_UNASSIGNED) {
scheduleMsg(logger, "%d ETG @ %s", i, hwPortname(CONFIGB(max31855_cs)[i])); scheduleMsg(logger, "%d ETG @ %s", i, hwPortname(CONFIG(max31855_cs)[i]));
} }
} }
#endif #endif

View File

@ -127,7 +127,7 @@ static int logFileIndex = 1;
static char logName[_MAX_FILLER + 20]; static char logName[_MAX_FILLER + 20];
static void printMmcPinout(void) { static void printMmcPinout(void) {
scheduleMsg(&logger, "MMC CS %s", hwPortname(CONFIGB(sdCardCsPin))); scheduleMsg(&logger, "MMC CS %s", hwPortname(CONFIG(sdCardCsPin)));
// todo: we need to figure out the right SPI pinout, not just SPI2 // todo: we need to figure out the right SPI pinout, not just SPI2
// scheduleMsg(&logger, "MMC SCK %s:%d", portname(EFI_SPI2_SCK_PORT), EFI_SPI2_SCK_PIN); // scheduleMsg(&logger, "MMC SCK %s:%d", portname(EFI_SPI2_SCK_PORT), EFI_SPI2_SCK_PIN);
// scheduleMsg(&logger, "MMC MISO %s:%d", portname(EFI_SPI2_MISO_PORT), EFI_SPI2_MISO_PIN); // scheduleMsg(&logger, "MMC MISO %s:%d", portname(EFI_SPI2_MISO_PORT), EFI_SPI2_MISO_PIN);
@ -136,7 +136,7 @@ static void printMmcPinout(void) {
static void sdStatistics(void) { static void sdStatistics(void) {
printMmcPinout(); printMmcPinout();
scheduleMsg(&logger, "SD enabled=%s status=%s", boolToString(CONFIGB(isSdCardEnabled)), scheduleMsg(&logger, "SD enabled=%s status=%s", boolToString(CONFIG(isSdCardEnabled)),
sdStatus); sdStatus);
if (isSdCardAlive()) { if (isSdCardAlive()) {
scheduleMsg(&logger, "filename=%s size=%d", logName, totalLoggedBytes); scheduleMsg(&logger, "filename=%s size=%d", logName, totalLoggedBytes);
@ -462,8 +462,8 @@ static THD_FUNCTION(MMCmonThread, arg) {
chThdSleepMilliseconds(100); chThdSleepMilliseconds(100);
} }
if (boardConfiguration->sdCardPeriodMs > 0) { if (engineConfiguration->sdCardPeriodMs > 0) {
chThdSleepMilliseconds(boardConfiguration->sdCardPeriodMs); chThdSleepMilliseconds(engineConfiguration->sdCardPeriodMs);
} }
} }
} }
@ -475,13 +475,13 @@ bool isSdCardAlive(void) {
void initMmcCard(void) { void initMmcCard(void) {
logName[0] = 0; logName[0] = 0;
addConsoleAction("sdinfo", sdStatistics); addConsoleAction("sdinfo", sdStatistics);
if (!CONFIGB(isSdCardEnabled)) { if (!CONFIG(isSdCardEnabled)) {
return; return;
} }
// todo: reuse initSpiCs method? // todo: reuse initSpiCs method?
hs_spicfg.ssport = ls_spicfg.ssport = getHwPort("mmc", CONFIGB(sdCardCsPin)); hs_spicfg.ssport = ls_spicfg.ssport = getHwPort("mmc", CONFIG(sdCardCsPin));
hs_spicfg.sspad = ls_spicfg.sspad = getHwPin("mmc", CONFIGB(sdCardCsPin)); hs_spicfg.sspad = ls_spicfg.sspad = getHwPin("mmc", CONFIG(sdCardCsPin));
mmccfg.spip = getSpiDevice(engineConfiguration->sdCardSpiDevice); mmccfg.spip = getSpiDevice(engineConfiguration->sdCardSpiDevice);
/** /**

View File

@ -46,8 +46,8 @@ float getCurrentSpeed(void) {
EXTERN_ENGINE; EXTERN_ENGINE;
static void printGpsInfo(DECLARE_ENGINE_PARAMETER_SIGNATURE) { static void printGpsInfo(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
scheduleMsg(&logging, "GPS RX %s", hwPortname(CONFIGB(gps_rx_pin))); scheduleMsg(&logging, "GPS RX %s", hwPortname(CONFIG(gps_rx_pin)));
scheduleMsg(&logging, "GPS TX %s", hwPortname(CONFIGB(gps_tx_pin))); scheduleMsg(&logging, "GPS TX %s", hwPortname(CONFIG(gps_tx_pin)));
scheduleMsg(&logging, "m=%d,e=%d: vehicle speed = %.2f\r\n", gpsMesagesCount, uartErrors, getCurrentSpeed()); scheduleMsg(&logging, "m=%d,e=%d: vehicle speed = %.2f\r\n", gpsMesagesCount, uartErrors, getCurrentSpeed());
@ -101,8 +101,8 @@ static THD_FUNCTION(GpsThreadEntryPoint, arg) {
} }
static bool isGpsEnabled() { static bool isGpsEnabled() {
return CONFIGB(gps_rx_pin) != GPIO_UNASSIGNED || return CONFIG(gps_rx_pin) != GPIO_UNASSIGNED ||
CONFIGB(gps_tx_pin) != GPIO_UNASSIGNED; CONFIG(gps_tx_pin) != GPIO_UNASSIGNED;
} }
void initGps(void) { void initGps(void) {
@ -112,8 +112,8 @@ void initGps(void) {
sdStart(GPS_SERIAL_DEVICE, &GPSserialConfig); sdStart(GPS_SERIAL_DEVICE, &GPSserialConfig);
// GPS we have USART1: PB7 -> USART1_RX and PB6 -> USART1_TX // GPS we have USART1: PB7 -> USART1_RX and PB6 -> USART1_TX
efiSetPadMode("GPS tx", CONFIGB(gps_tx_pin), PAL_MODE_ALTERNATE(7)); efiSetPadMode("GPS tx", CONFIG(gps_tx_pin), PAL_MODE_ALTERNATE(7));
efiSetPadMode("GPS rx", CONFIGB(gps_rx_pin), PAL_MODE_ALTERNATE(7)); efiSetPadMode("GPS rx", CONFIG(gps_rx_pin), PAL_MODE_ALTERNATE(7));
// todo: add a thread which would save location. If the GPS 5Hz - we should save the location each 200 ms // todo: add a thread which would save location. If the GPS 5Hz - we should save the location each 200 ms
chThdCreateStatic(gpsThreadStack, sizeof(gpsThreadStack), LOWPRIO, (tfunc_t)(void*) GpsThreadEntryPoint, NULL); chThdCreateStatic(gpsThreadStack, sizeof(gpsThreadStack), LOWPRIO, (tfunc_t)(void*) GpsThreadEntryPoint, NULL);

View File

@ -77,11 +77,11 @@ static int getSpiAf(SPIDriver *driver) {
brain_pin_e getMisoPin(spi_device_e device) { brain_pin_e getMisoPin(spi_device_e device) {
switch(device) { switch(device) {
case SPI_DEVICE_1: case SPI_DEVICE_1:
return CONFIGB(spi1misoPin); return CONFIG(spi1misoPin);
case SPI_DEVICE_2: case SPI_DEVICE_2:
return CONFIGB(spi2misoPin); return CONFIG(spi2misoPin);
case SPI_DEVICE_3: case SPI_DEVICE_3:
return CONFIGB(spi3misoPin); return CONFIG(spi3misoPin);
default: default:
break; break;
} }
@ -91,11 +91,11 @@ brain_pin_e getMisoPin(spi_device_e device) {
brain_pin_e getMosiPin(spi_device_e device) { brain_pin_e getMosiPin(spi_device_e device) {
switch(device) { switch(device) {
case SPI_DEVICE_1: case SPI_DEVICE_1:
return CONFIGB(spi1mosiPin); return CONFIG(spi1mosiPin);
case SPI_DEVICE_2: case SPI_DEVICE_2:
return CONFIGB(spi2mosiPin); return CONFIG(spi2mosiPin);
case SPI_DEVICE_3: case SPI_DEVICE_3:
return CONFIGB(spi3mosiPin); return CONFIG(spi3mosiPin);
default: default:
break; break;
} }
@ -105,11 +105,11 @@ brain_pin_e getMosiPin(spi_device_e device) {
brain_pin_e getSckPin(spi_device_e device) { brain_pin_e getSckPin(spi_device_e device) {
switch(device) { switch(device) {
case SPI_DEVICE_1: case SPI_DEVICE_1:
return CONFIGB(spi1sckPin); return CONFIG(spi1sckPin);
case SPI_DEVICE_2: case SPI_DEVICE_2:
return CONFIGB(spi2sckPin); return CONFIG(spi2sckPin);
case SPI_DEVICE_3: case SPI_DEVICE_3:
return CONFIGB(spi3sckPin); return CONFIG(spi3sckPin);
default: default:
break; break;
} }

View File

@ -241,11 +241,11 @@ static int getSpiAf(SPIDriver *driver) {
brain_pin_e getMisoPin(spi_device_e device) { brain_pin_e getMisoPin(spi_device_e device) {
switch(device) { switch(device) {
case SPI_DEVICE_1: case SPI_DEVICE_1:
return CONFIGB(spi1misoPin); return CONFIG(spi1misoPin);
case SPI_DEVICE_2: case SPI_DEVICE_2:
return CONFIGB(spi2misoPin); return CONFIG(spi2misoPin);
case SPI_DEVICE_3: case SPI_DEVICE_3:
return CONFIGB(spi3misoPin); return CONFIG(spi3misoPin);
default: default:
break; break;
} }
@ -255,11 +255,11 @@ brain_pin_e getMisoPin(spi_device_e device) {
brain_pin_e getMosiPin(spi_device_e device) { brain_pin_e getMosiPin(spi_device_e device) {
switch(device) { switch(device) {
case SPI_DEVICE_1: case SPI_DEVICE_1:
return CONFIGB(spi1mosiPin); return CONFIG(spi1mosiPin);
case SPI_DEVICE_2: case SPI_DEVICE_2:
return CONFIGB(spi2mosiPin); return CONFIG(spi2mosiPin);
case SPI_DEVICE_3: case SPI_DEVICE_3:
return CONFIGB(spi3mosiPin); return CONFIG(spi3mosiPin);
default: default:
break; break;
} }
@ -269,11 +269,11 @@ brain_pin_e getMosiPin(spi_device_e device) {
brain_pin_e getSckPin(spi_device_e device) { brain_pin_e getSckPin(spi_device_e device) {
switch(device) { switch(device) {
case SPI_DEVICE_1: case SPI_DEVICE_1:
return CONFIGB(spi1sckPin); return CONFIG(spi1sckPin);
case SPI_DEVICE_2: case SPI_DEVICE_2:
return CONFIGB(spi2sckPin); return CONFIG(spi2sckPin);
case SPI_DEVICE_3: case SPI_DEVICE_3:
return CONFIGB(spi3sckPin); return CONFIG(spi3sckPin);
default: default:
break; break;
} }

View File

@ -236,11 +236,11 @@ static int getSpiAf(SPIDriver *driver) {
brain_pin_e getMisoPin(spi_device_e device) { brain_pin_e getMisoPin(spi_device_e device) {
switch(device) { switch(device) {
case SPI_DEVICE_1: case SPI_DEVICE_1:
return CONFIGB(spi1misoPin); return CONFIG(spi1misoPin);
case SPI_DEVICE_2: case SPI_DEVICE_2:
return CONFIGB(spi2misoPin); return CONFIG(spi2misoPin);
case SPI_DEVICE_3: case SPI_DEVICE_3:
return CONFIGB(spi3misoPin); return CONFIG(spi3misoPin);
default: default:
break; break;
} }
@ -250,11 +250,11 @@ brain_pin_e getMisoPin(spi_device_e device) {
brain_pin_e getMosiPin(spi_device_e device) { brain_pin_e getMosiPin(spi_device_e device) {
switch(device) { switch(device) {
case SPI_DEVICE_1: case SPI_DEVICE_1:
return CONFIGB(spi1mosiPin); return CONFIG(spi1mosiPin);
case SPI_DEVICE_2: case SPI_DEVICE_2:
return CONFIGB(spi2mosiPin); return CONFIG(spi2mosiPin);
case SPI_DEVICE_3: case SPI_DEVICE_3:
return CONFIGB(spi3mosiPin); return CONFIG(spi3mosiPin);
default: default:
break; break;
} }
@ -264,11 +264,11 @@ brain_pin_e getMosiPin(spi_device_e device) {
brain_pin_e getSckPin(spi_device_e device) { brain_pin_e getSckPin(spi_device_e device) {
switch(device) { switch(device) {
case SPI_DEVICE_1: case SPI_DEVICE_1:
return CONFIGB(spi1sckPin); return CONFIG(spi1sckPin);
case SPI_DEVICE_2: case SPI_DEVICE_2:
return CONFIGB(spi2sckPin); return CONFIG(spi2sckPin);
case SPI_DEVICE_3: case SPI_DEVICE_3:
return CONFIGB(spi3sckPin); return CONFIG(spi3sckPin);
default: default:
break; break;
} }

View File

@ -44,12 +44,12 @@ static const SPIConfig accelerometerCfg = {
void configureAccelerometerPins(DECLARE_ENGINE_PARAMETER_SIGNATURE) { void configureAccelerometerPins(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
// engineConfiguration->LIS302DLCsPin = GPIOE_3; // we have a conflict with VVT output on Miata // engineConfiguration->LIS302DLCsPin = GPIOE_3; // we have a conflict with VVT output on Miata
// CONFIGB(is_enabled_spi_1) = true; // we have a conflict with PA5 input pin // CONFIG(is_enabled_spi_1) = true; // we have a conflict with PA5 input pin
// stm32f4discovery defaults // stm32f4discovery defaults
CONFIGB(spi1mosiPin) = GPIOA_7; CONFIG(spi1mosiPin) = GPIOA_7;
CONFIGB(spi1misoPin) = GPIOA_6; CONFIG(spi1misoPin) = GPIOA_6;
CONFIGB(spi1sckPin) = GPIOA_5; CONFIG(spi1sckPin) = GPIOA_5;
} }
@ -76,7 +76,7 @@ void initAccelerometer(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
if (engineConfiguration->LIS302DLCsPin == GPIO_UNASSIGNED) if (engineConfiguration->LIS302DLCsPin == GPIO_UNASSIGNED)
return; // not used return; // not used
if (!CONFIGB(is_enabled_spi_1)) if (!CONFIG(is_enabled_spi_1))
return; // temporary return; // temporary
#if HAL_USE_SPI #if HAL_USE_SPI
driver = getSpiDevice(engineConfiguration->accelerometerSpiDevice); driver = getSpiDevice(engineConfiguration->accelerometerSpiDevice);
@ -90,8 +90,8 @@ void initAccelerometer(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
initSpiCs((SPIConfig *)driver->config, engineConfiguration->LIS302DLCsPin); initSpiCs((SPIConfig *)driver->config, engineConfiguration->LIS302DLCsPin);
// memsCs.initPin("LIS302 CS", engineConfiguration->LIS302DLCsPin); // memsCs.initPin("LIS302 CS", engineConfiguration->LIS302DLCsPin);
// memsCfg.ssport = getHwPort("mmc", CONFIGB(sdCardCsPin)); // memsCfg.ssport = getHwPort("mmc", CONFIG(sdCardCsPin));
// memsCfg.sspad = getHwPin("mmc", CONFIGB(sdCardCsPin)); // memsCfg.sspad = getHwPin("mmc", CONFIG(sdCardCsPin));
/* LIS302DL initialization.*/ /* LIS302DL initialization.*/

View File

@ -266,7 +266,7 @@ static void cjCalibrate(void) {
} }
static void cjStart(DECLARE_ENGINE_PARAMETER_SIGNATURE) { static void cjStart(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
if (!CONFIGB(isCJ125Enabled)) { if (!CONFIG(isCJ125Enabled)) {
scheduleMsg(logger, "cj125 is disabled."); scheduleMsg(logger, "cj125 is disabled.");
return; return;
} }
@ -313,35 +313,35 @@ void CJ125::setError(cj125_error_e errCode DECLARE_ENGINE_PARAMETER_SUFFIX) {
// engineConfiguration->spi2SckMode = PAL_STM32_OTYPE_OPENDRAIN; // 4 // engineConfiguration->spi2SckMode = PAL_STM32_OTYPE_OPENDRAIN; // 4
// engineConfiguration->spi2MosiMode = PAL_STM32_OTYPE_OPENDRAIN; // 4 // engineConfiguration->spi2MosiMode = PAL_STM32_OTYPE_OPENDRAIN; // 4
// engineConfiguration->spi2MisoMode = PAL_STM32_PUDR_PULLUP; // 32 // engineConfiguration->spi2MisoMode = PAL_STM32_PUDR_PULLUP; // 32
// CONFIGB(cj125CsPin) = GPIOA_15; // CONFIG(cj125CsPin) = GPIOA_15;
// engineConfiguration->cj125CsPinMode = OM_OPENDRAIN; // engineConfiguration->cj125CsPinMode = OM_OPENDRAIN;
void cj125defaultPinout(DECLARE_ENGINE_PARAMETER_SIGNATURE) { void cj125defaultPinout(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
engineConfiguration->cj125ua = EFI_ADC_13; // PC3 engineConfiguration->cj125ua = EFI_ADC_13; // PC3
engineConfiguration->cj125ur = EFI_ADC_4; // PA4 engineConfiguration->cj125ur = EFI_ADC_4; // PA4
CONFIGB(wboHeaterPin) = GPIOC_13; CONFIG(wboHeaterPin) = GPIOC_13;
CONFIGB(isCJ125Enabled) = false; CONFIG(isCJ125Enabled) = false;
CONFIGB(spi2mosiPin) = GPIOB_15; CONFIG(spi2mosiPin) = GPIOB_15;
CONFIGB(spi2misoPin) = GPIOB_14; CONFIG(spi2misoPin) = GPIOB_14;
CONFIGB(spi2sckPin) = GPIOB_13; CONFIG(spi2sckPin) = GPIOB_13;
CONFIGB(cj125CsPin) = GPIOB_0; CONFIG(cj125CsPin) = GPIOB_0;
CONFIGB(isCJ125Enabled) = true; CONFIG(isCJ125Enabled) = true;
CONFIGB(is_enabled_spi_2) = true; CONFIG(is_enabled_spi_2) = true;
} }
static void cjStartSpi(DECLARE_ENGINE_PARAMETER_SIGNATURE) { static void cjStartSpi(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
globalInstance.cj125Cs.initPin("cj125 CS", CONFIGB(cj125CsPin), globalInstance.cj125Cs.initPin("cj125 CS", CONFIG(cj125CsPin),
&engineConfiguration->cj125CsPinMode); &engineConfiguration->cj125CsPinMode);
// Idle CS pin - SPI CS is high when idle // Idle CS pin - SPI CS is high when idle
globalInstance.cj125Cs.setValue(true); globalInstance.cj125Cs.setValue(true);
cj125spicfg.cr1 += getSpiPrescaler(_150KHz, engineConfiguration->cj125SpiDevice); cj125spicfg.cr1 += getSpiPrescaler(_150KHz, engineConfiguration->cj125SpiDevice);
cj125spicfg.ssport = getHwPort("cj125", CONFIGB(cj125CsPin)); cj125spicfg.ssport = getHwPort("cj125", CONFIG(cj125CsPin));
cj125spicfg.sspad = getHwPin("cj125", CONFIGB(cj125CsPin)); cj125spicfg.sspad = getHwPin("cj125", CONFIG(cj125CsPin));
driver = getSpiDevice(engineConfiguration->cj125SpiDevice); driver = getSpiDevice(engineConfiguration->cj125SpiDevice);
if (driver == NULL) { if (driver == NULL) {
// error already reported // error already reported
@ -463,7 +463,7 @@ static msg_t cjThread(void)
#if ! EFI_UNIT_TEST #if ! EFI_UNIT_TEST
static bool cjCheckConfig(void) { static bool cjCheckConfig(void) {
if (!CONFIGB(isCJ125Enabled)) { if (!CONFIG(isCJ125Enabled)) {
scheduleMsg(logger, "cj125 is disabled. Failed!"); scheduleMsg(logger, "cj125 is disabled. Failed!");
return false; return false;
} }
@ -518,7 +518,7 @@ float cjGetAfr(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
} }
bool cjHasAfrSensor(DECLARE_ENGINE_PARAMETER_SIGNATURE) { bool cjHasAfrSensor(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
if (!CONFIGB(isCJ125Enabled)) if (!CONFIG(isCJ125Enabled))
return false; return false;
return globalInstance.isValidState(); return globalInstance.isValidState();
} }
@ -543,7 +543,7 @@ void initCJ125(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX) {
globalInstance.spi = &spi; globalInstance.spi = &spi;
globalInstance.logger = sharedLogger; globalInstance.logger = sharedLogger;
if (!CONFIGB(isCJ125Enabled)) { if (!CONFIG(isCJ125Enabled)) {
globalInstance.errorCode = CJ125_ERROR_DISABLED; globalInstance.errorCode = CJ125_ERROR_DISABLED;
return; return;
} }
@ -555,7 +555,7 @@ void initCJ125(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX) {
return; return;
} }
if (CONFIGB(wboHeaterPin) == GPIO_UNASSIGNED) { if (CONFIG(wboHeaterPin) == GPIO_UNASSIGNED) {
scheduleMsg(logger, "cj125 init error! wboHeaterPin is required."); scheduleMsg(logger, "cj125 init error! wboHeaterPin is required.");
warning(CUSTOM_CJ125_1, "cj heater"); warning(CUSTOM_CJ125_1, "cj heater");
globalInstance.errorCode = CJ125_ERROR_DISABLED; globalInstance.errorCode = CJ125_ERROR_DISABLED;

View File

@ -43,7 +43,7 @@ void CJ125::StartHeaterControl(pwm_gen_callback *stateChangeCallback DECLARE_ENG
// todo: use custom pin state method, turn pin off while not running // todo: use custom pin state method, turn pin off while not running
startSimplePwmExt(&wboHeaterControl, "wboHeaterPin", startSimplePwmExt(&wboHeaterControl, "wboHeaterPin",
&engine->executor, &engine->executor,
CONFIGB(wboHeaterPin), CONFIG(wboHeaterPin),
&wboHeaterPin, CJ125_HEATER_PWM_FREQ, 0.0f, stateChangeCallback); &wboHeaterPin, CJ125_HEATER_PWM_FREQ, 0.0f, stateChangeCallback);
SetIdleHeater(PASS_ENGINE_PARAMETER_SIGNATURE); SetIdleHeater(PASS_ENGINE_PARAMETER_SIGNATURE);
} }

Some files were not shown because too many files have changed in this diff Show More