diff --git a/firmware/config/engines/bmw_e34.cpp b/firmware/config/engines/bmw_e34.cpp index 96d48615b2..86e5fc97a9 100644 --- a/firmware/config/engines/bmw_e34.cpp +++ b/firmware/config/engines/bmw_e34.cpp @@ -36,16 +36,16 @@ void setBmwE43(engine_configuration_s *engineConfiguration) { setWholeTimingTable(engineConfiguration, 10); board_configuration_s *bc = &engineConfiguration->bc; - bc->malfunctionIndicatorPin = GPIO_NONE; + bc->malfunctionIndicatorPin = GPIO_UNASSIGNED; // bc->isFastAdcEnabled = true; bc->ignitionPins[0] = GPIOC_7; // #1 - bc->ignitionPins[1] = GPIO_NONE; // #2 + bc->ignitionPins[1] = GPIO_UNASSIGNED; // #2 bc->ignitionPins[2] = GPIOE_4; // #3 - bc->ignitionPins[3] = GPIO_NONE; // #4 + bc->ignitionPins[3] = GPIO_UNASSIGNED; // #4 bc->ignitionPins[4] = GPIOC_9; // #5 - bc->ignitionPins[5] = GPIO_NONE; // #6 + bc->ignitionPins[5] = GPIO_UNASSIGNED; // #6 engineConfiguration->map.sensor.sensorType = MT_MPX4250; } diff --git a/firmware/config/engines/citroenBerlingoTU3JP.cpp b/firmware/config/engines/citroenBerlingoTU3JP.cpp index d283b44d5d..debac234cc 100644 --- a/firmware/config/engines/citroenBerlingoTU3JP.cpp +++ b/firmware/config/engines/citroenBerlingoTU3JP.cpp @@ -68,22 +68,22 @@ void setCitroenBerlingoTU3JPConfiguration(engine_configuration_s *engineConfigur engineConfiguration->injectorFlow = 137; //SIEMENS DEKA VAZ20734 boardConfiguration->injectionPins[0] = GPIOE_6; boardConfiguration->injectionPins[1] = GPIOC_13; - boardConfiguration->injectionPins[2] = GPIO_NONE; - boardConfiguration->injectionPins[3] = GPIO_NONE; + boardConfiguration->injectionPins[2] = GPIO_UNASSIGNED; + boardConfiguration->injectionPins[3] = GPIO_UNASSIGNED; boardConfiguration->ignitionPins[0] = GPIOC_14; boardConfiguration->ignitionPins[1] = GPIOC_15; - boardConfiguration->ignitionPins[2] = GPIO_NONE; - boardConfiguration->ignitionPins[3] = GPIO_NONE; + boardConfiguration->ignitionPins[2] = GPIO_UNASSIGNED; + boardConfiguration->ignitionPins[3] = GPIO_UNASSIGNED; boardConfiguration->fuelPumpPin = GPIOB_9; boardConfiguration->fuelPumpPinMode = OM_DEFAULT; - boardConfiguration->fanPin = GPIO_NONE; + boardConfiguration->fanPin = GPIO_UNASSIGNED; // boardConfiguration->fanPinMode = OM_DEFAULT; // boardConfiguration->o2heaterPin = GPIOC_13; -// boardConfiguration->logicAnalyzerPins[1] = GPIO_NONE; +// boardConfiguration->logicAnalyzerPins[1] = GPIO_UNASSIGNED; /** * Inputs @@ -137,5 +137,5 @@ void setCitroenBerlingoTU3JPConfiguration(engine_configuration_s *engineConfigur /** * Other */ -// engineConfiguration->mafAdcChannel = GPIO_NONE; +// engineConfiguration->mafAdcChannel = GPIO_UNASSIGNED; } diff --git a/firmware/config/engines/dodge_neon.cpp b/firmware/config/engines/dodge_neon.cpp index d59bf900c5..79e7f06e2f 100644 --- a/firmware/config/engines/dodge_neon.cpp +++ b/firmware/config/engines/dodge_neon.cpp @@ -123,7 +123,7 @@ void setDodgeNeon1995EngineConfiguration(engine_configuration_s *engineConfigura // Frankenstein: high side #2: PE10 boardConfiguration->ignitionPins[0] = GPIOE_8; // Frankenstein: high side #1 - boardConfiguration->ignitionPins[1] = GPIO_NONE; + boardConfiguration->ignitionPins[1] = GPIO_UNASSIGNED; boardConfiguration->ignitionPins[2] = GPIOE_10; // // Frankenstein: high side #2 // set_ignition_pin_mode 0 @@ -175,7 +175,7 @@ void setDodgeNeonNGCEngineConfiguration(engine_configuration_s *engineConfigurat setFuelLoadBin(engineConfiguration, 0, 100); setTimingLoadBin(engineConfiguration, 0, 100); - boardConfiguration->malfunctionIndicatorPin = GPIO_NONE; + boardConfiguration->malfunctionIndicatorPin = GPIO_UNASSIGNED; /** * D14/W10 O2 Sensor @@ -191,9 +191,9 @@ void setDodgeNeonNGCEngineConfiguration(engine_configuration_s *engineConfigurat boardConfiguration->injectionPins[3] = GPIOB_7; boardConfiguration->ignitionPins[0] = GPIOC_9; - boardConfiguration->ignitionPins[1] = GPIO_NONE; + boardConfiguration->ignitionPins[1] = GPIO_UNASSIGNED; boardConfiguration->ignitionPins[2] = GPIOE_8; - boardConfiguration->ignitionPins[3] = GPIO_NONE; + boardConfiguration->ignitionPins[3] = GPIO_UNASSIGNED; boardConfiguration->idleValvePin = GPIOC_13; boardConfiguration->idleSolenoidFrequency = 300; @@ -201,8 +201,8 @@ void setDodgeNeonNGCEngineConfiguration(engine_configuration_s *engineConfigurat boardConfiguration->fuelPumpPin = GPIOE_3; boardConfiguration->fuelPumpPinMode = OM_DEFAULT; - boardConfiguration->gps_rx_pin = GPIO_NONE; - boardConfiguration->gps_tx_pin = GPIO_NONE; + boardConfiguration->gps_rx_pin = GPIO_UNASSIGNED; + boardConfiguration->gps_tx_pin = GPIO_UNASSIGNED; boardConfiguration->triggerInputPins[0] = GPIOA_5; boardConfiguration->triggerInputPins[1] = GPIOC_6; diff --git a/firmware/config/engines/ford_1995_inline_6.cpp b/firmware/config/engines/ford_1995_inline_6.cpp index 66dafbbbd4..722a2fde11 100644 --- a/firmware/config/engines/ford_1995_inline_6.cpp +++ b/firmware/config/engines/ford_1995_inline_6.cpp @@ -96,8 +96,8 @@ void setFordInline6(engine_configuration_s *engineConfiguration, board_configura boardConfiguration->injectionPins[1] = GPIOE_3; boardConfiguration->ignitionPins[0] = GPIOC_15; - boardConfiguration->injectionPins[2] = GPIO_NONE; - boardConfiguration->fanPin = GPIO_NONE; + boardConfiguration->injectionPins[2] = GPIO_UNASSIGNED; + boardConfiguration->fanPin = GPIO_UNASSIGNED; engineConfiguration->tpsMin = convertVoltageTo10bitADC(1.250); engineConfiguration->tpsMax = convertVoltageTo10bitADC(4.538); diff --git a/firmware/config/engines/ford_aspire.cpp b/firmware/config/engines/ford_aspire.cpp index f01a40ef81..d8b72680ef 100644 --- a/firmware/config/engines/ford_aspire.cpp +++ b/firmware/config/engines/ford_aspire.cpp @@ -126,8 +126,8 @@ void setFordAspireEngineConfiguration(engine_configuration_s *engineConfiguratio engineConfiguration->ignitionMode = IM_ONE_COIL; engineConfiguration->triggerConfig.triggerType = TT_FORD_ASPIRE; - boardConfiguration->injectionPins[4] = GPIO_NONE; - boardConfiguration->injectionPins[5] = GPIO_NONE; + boardConfiguration->injectionPins[4] = GPIO_UNASSIGNED; + boardConfiguration->injectionPins[5] = GPIO_UNASSIGNED; engineConfiguration->HD44780width = 20; engineConfiguration->HD44780height = 4; diff --git a/firmware/config/engines/honda_accord.cpp b/firmware/config/engines/honda_accord.cpp index 35e3a0a7f0..73cb843d1f 100644 --- a/firmware/config/engines/honda_accord.cpp +++ b/firmware/config/engines/honda_accord.cpp @@ -166,19 +166,19 @@ static void setHondaAccordConfigurationCommon(engine_configuration_s *engineConf boardConfiguration->injectionPins[3] = GPIOB_7; boardConfiguration->ignitionPins[0] = GPIOE_4; - boardConfiguration->ignitionPins[1] = GPIO_NONE; - boardConfiguration->ignitionPins[2] = GPIO_NONE; - boardConfiguration->ignitionPins[3] = GPIO_NONE; + boardConfiguration->ignitionPins[1] = GPIO_UNASSIGNED; + boardConfiguration->ignitionPins[2] = GPIO_UNASSIGNED; + boardConfiguration->ignitionPins[3] = GPIO_UNASSIGNED; boardConfiguration->fuelPumpPin = GPIOE_3; boardConfiguration->fuelPumpPinMode = OM_DEFAULT; - boardConfiguration->gps_rx_pin = GPIO_NONE; - boardConfiguration->gps_tx_pin = GPIO_NONE; + boardConfiguration->gps_rx_pin = GPIO_UNASSIGNED; + boardConfiguration->gps_tx_pin = GPIO_UNASSIGNED; setFrankenso_01_LCD(boardConfiguration); - boardConfiguration->logicAnalyzerPins[1] = GPIO_NONE; + boardConfiguration->logicAnalyzerPins[1] = GPIO_UNASSIGNED; boardConfiguration->idleSolenoidFrequency = 500; diff --git a/firmware/config/engines/mazda_miata.cpp b/firmware/config/engines/mazda_miata.cpp index fb55d3d4b4..3dbbae9098 100644 --- a/firmware/config/engines/mazda_miata.cpp +++ b/firmware/config/engines/mazda_miata.cpp @@ -72,8 +72,8 @@ static void commonMiataNa(engine_configuration_s *engineConfiguration, board_con setFuelLoadBin(engineConfiguration, 1.2, 4.4); setFuelRpmBin(engineConfiguration, 800, 7000); - boardConfiguration->gps_rx_pin = GPIO_NONE; - boardConfiguration->gps_tx_pin = GPIO_NONE; + boardConfiguration->gps_rx_pin = GPIO_UNASSIGNED; + boardConfiguration->gps_tx_pin = GPIO_UNASSIGNED; boardConfiguration->idleSolenoidFrequency = 160; @@ -88,8 +88,8 @@ static void commonMiataNa(engine_configuration_s *engineConfiguration, board_con boardConfiguration->ignitionPins[0] = GPIOE_12; // Frankenstein: high side #3 boardConfiguration->ignitionPins[1] = GPIOE_14; // Frankenstein: high side #4 - boardConfiguration->ignitionPins[2] = GPIO_NONE; - boardConfiguration->ignitionPins[3] = GPIO_NONE; + boardConfiguration->ignitionPins[2] = GPIO_UNASSIGNED; + boardConfiguration->ignitionPins[3] = GPIO_UNASSIGNED; boardConfiguration->ignitionPinMode = OM_DEFAULT; setDefaultCrankingFuel(engineConfiguration); @@ -111,7 +111,7 @@ static void common079721_2351(engine_configuration_s *engineConfiguration, board engineConfiguration->cylindersCount = 4; engineConfiguration->firingOrder = FO_1_THEN_3_THEN_4_THEN2; - boardConfiguration->fuelPumpPin = GPIO_NONE; // fuel pump is not controlled by ECU on this engine + boardConfiguration->fuelPumpPin = GPIO_UNASSIGNED; // fuel pump is not controlled by ECU on this engine // set_cranking_injection_mode 0 engineConfiguration->crankingInjectionMode = IM_SIMULTANEOUS; @@ -157,10 +157,10 @@ void setMiata1990(engine_configuration_s *engineConfiguration, board_configurati boardConfiguration->injectionPins[0] = GPIOB_9; // Frankenstein: low side - inj #12 boardConfiguration->injectionPins[1] = GPIOB_8; // Frankenstein: low side - inj #11 - boardConfiguration->injectionPins[2] = GPIO_NONE; - boardConfiguration->injectionPins[3] = GPIO_NONE; - boardConfiguration->injectionPins[4] = GPIO_NONE; - boardConfiguration->injectionPins[5] = GPIO_NONE; + boardConfiguration->injectionPins[2] = GPIO_UNASSIGNED; + boardConfiguration->injectionPins[3] = GPIO_UNASSIGNED; + boardConfiguration->injectionPins[4] = GPIO_UNASSIGNED; + boardConfiguration->injectionPins[5] = GPIO_UNASSIGNED; boardConfiguration->injectionPinMode = OM_DEFAULT; @@ -193,9 +193,9 @@ void setFordEscortGt(engine_configuration_s *engineConfiguration, board_configur // Frankenstein: high side #6 is PC7 boardConfiguration->ignitionPins[0] = GPIOE_12; // Frankenstein: high side #3 - boardConfiguration->ignitionPins[1] = GPIO_NONE; - boardConfiguration->ignitionPins[2] = GPIO_NONE; - boardConfiguration->ignitionPins[3] = GPIO_NONE; + boardConfiguration->ignitionPins[1] = GPIO_UNASSIGNED; + boardConfiguration->ignitionPins[2] = GPIO_UNASSIGNED; + boardConfiguration->ignitionPins[3] = GPIO_UNASSIGNED; boardConfiguration->ignitionPinMode = OM_DEFAULT; // set_whole_fuel_map 3 @@ -228,8 +228,8 @@ static void setMiata1994_common(engine_configuration_s *engineConfiguration, boa // boardConfiguration->triggerSimulatorPinModes[0] = OM_OPENDRAIN; // boardConfiguration->triggerSimulatorPinModes[1] = OM_OPENDRAIN; // -// boardConfiguration->triggerInputPins[0] = GPIO_NONE; -// boardConfiguration->triggerInputPins[1] = GPIO_NONE; +// boardConfiguration->triggerInputPins[0] = GPIO_UNASSIGNED; +// boardConfiguration->triggerInputPins[1] = GPIO_UNASSIGNED; // // boardConfiguration->is_enabled_spi_1 = false; // boardConfiguration->is_enabled_spi_2 = false; @@ -252,20 +252,20 @@ static void setMiata1994_common(engine_configuration_s *engineConfiguration, boa // Frankenso low out #12: PB7 - boardConfiguration->o2heaterPin = GPIO_NONE; + boardConfiguration->o2heaterPin = GPIO_UNASSIGNED; boardConfiguration->fuelPumpPin = GPIOE_4; - boardConfiguration->injectionPins[4] = GPIO_NONE; - boardConfiguration->injectionPins[5] = GPIO_NONE; + boardConfiguration->injectionPins[4] = GPIO_UNASSIGNED; + boardConfiguration->injectionPins[5] = GPIO_UNASSIGNED; boardConfiguration->injectionPinMode = OM_DEFAULT; boardConfiguration->idleValvePin = GPIOB_9; boardConfiguration->ignitionPins[0] = GPIOC_7; // Frankenso high side #3 - boardConfiguration->ignitionPins[1] = GPIO_NONE; + boardConfiguration->ignitionPins[1] = GPIO_UNASSIGNED; boardConfiguration->ignitionPins[2] = GPIOE_14; // Frankenso high side #2 - boardConfiguration->ignitionPins[3] = GPIO_NONE; + boardConfiguration->ignitionPins[3] = GPIO_UNASSIGNED; boardConfiguration->ignitionPinMode = OM_DEFAULT; setFrankenso_01_LCD(boardConfiguration); @@ -302,7 +302,7 @@ void setMiata1994_s(engine_configuration_s *engineConfiguration, board_configura setMiata1994_common(engineConfiguration, boardConfiguration); engineConfiguration->vbattDividerCoeff = ((float) (10.0 + 33)) / 10 * 2; - boardConfiguration->triggerSimulatorPins[2] = GPIO_NONE; + boardConfiguration->triggerSimulatorPins[2] = GPIO_UNASSIGNED; /** * This board has PE0 & PE1 mosfets rewires to PD3 and PD5 @@ -346,9 +346,9 @@ void setMiata1996(engine_configuration_s *engineConfiguration, board_configurati engineConfiguration->tpsAdcChannel = EFI_ADC_13; boardConfiguration->ignitionPins[0] = GPIOE_12; // Frankenstein: high side #3 - boardConfiguration->ignitionPins[1] = GPIO_NONE; + boardConfiguration->ignitionPins[1] = GPIO_UNASSIGNED; boardConfiguration->ignitionPins[2] = GPIOE_14; // Frankenstein: high side #4 - boardConfiguration->ignitionPins[3] = GPIO_NONE; + boardConfiguration->ignitionPins[3] = GPIO_UNASSIGNED; boardConfiguration->ignitionPinMode = OM_DEFAULT; // harness is sequential but we have a limited board @@ -357,10 +357,10 @@ void setMiata1996(engine_configuration_s *engineConfiguration, board_configurati boardConfiguration->injectionPins[0] = GPIOB_9; // Frankenstein: low side - inj #12 boardConfiguration->injectionPins[1] = GPIOB_8; // Frankenstein: low side - inj #11 - boardConfiguration->injectionPins[2] = GPIO_NONE; - boardConfiguration->injectionPins[3] = GPIO_NONE; - boardConfiguration->injectionPins[4] = GPIO_NONE; - boardConfiguration->injectionPins[5] = GPIO_NONE; + boardConfiguration->injectionPins[2] = GPIO_UNASSIGNED; + boardConfiguration->injectionPins[3] = GPIO_UNASSIGNED; + boardConfiguration->injectionPins[4] = GPIO_UNASSIGNED; + boardConfiguration->injectionPins[5] = GPIO_UNASSIGNED; boardConfiguration->injectionPinMode = OM_DEFAULT; } diff --git a/firmware/config/engines/mazda_miata_nb.cpp b/firmware/config/engines/mazda_miata_nb.cpp index 1c5a7285ce..3bd0bf6087 100644 --- a/firmware/config/engines/mazda_miata_nb.cpp +++ b/firmware/config/engines/mazda_miata_nb.cpp @@ -52,14 +52,14 @@ void setMazdaMiataNbEngineConfiguration(engine_configuration_s *engineConfigurat boardConfiguration->injectionPins[1] = GPIOB_8; // Frankenstein: low side - inj #11 boardConfiguration->injectionPins[2] = GPIOE_3; // Frankenstein: low side - inj #8 boardConfiguration->injectionPins[3] = GPIOE_5; // Frankenstein: low side - inj #6 - boardConfiguration->injectionPins[4] = GPIO_NONE; - boardConfiguration->injectionPins[5] = GPIO_NONE; + boardConfiguration->injectionPins[4] = GPIO_UNASSIGNED; + boardConfiguration->injectionPins[5] = GPIO_UNASSIGNED; boardConfiguration->injectionPinMode = OM_DEFAULT; boardConfiguration->ignitionPins[0] = GPIOE_10; // Frankenstein: high side #1 - boardConfiguration->ignitionPins[1] = GPIO_NONE; + boardConfiguration->ignitionPins[1] = GPIO_UNASSIGNED; boardConfiguration->ignitionPins[2] = GPIOC_9; // // Frankenstein: high side #2 - boardConfiguration->ignitionPins[3] = GPIO_NONE; + boardConfiguration->ignitionPins[3] = GPIO_UNASSIGNED; boardConfiguration->ignitionPinMode = OM_INVERTED; boardConfiguration->malfunctionIndicatorPin = GPIOE_1; @@ -68,8 +68,8 @@ void setMazdaMiataNbEngineConfiguration(engine_configuration_s *engineConfigurat boardConfiguration->fanPin = GPIOE_6; boardConfiguration->fanPinMode = OM_DEFAULT; - boardConfiguration->electronicThrottlePin1 = GPIO_NONE; - boardConfiguration->idleSwitchPin = GPIO_NONE; + boardConfiguration->electronicThrottlePin1 = GPIO_UNASSIGNED; + boardConfiguration->idleSwitchPin = GPIO_UNASSIGNED; // set_whole_fuel_map 3 setWholeFuelMap(engineConfiguration, 3); diff --git a/firmware/config/engines/mitsubishi.cpp b/firmware/config/engines/mitsubishi.cpp index 296102cbba..006067448d 100644 --- a/firmware/config/engines/mitsubishi.cpp +++ b/firmware/config/engines/mitsubishi.cpp @@ -73,9 +73,9 @@ void setMitsubishiConfiguration(engine_configuration_s *engineConfiguration, boa // Frankenstein: high side #2: PE10 boardConfiguration->ignitionPins[0] = GPIOE_8; // Frankenstein: high side #1 - boardConfiguration->ignitionPins[1] = GPIO_NONE; + boardConfiguration->ignitionPins[1] = GPIO_UNASSIGNED; boardConfiguration->ignitionPins[2] = GPIOE_10; // // Frankenstein: high side #2 - boardConfiguration->ignitionPins[3] = GPIO_NONE; + boardConfiguration->ignitionPins[3] = GPIO_UNASSIGNED; engineConfiguration->HD44780width = 20; engineConfiguration->HD44780height = 4; diff --git a/firmware/controllers/PwmTester.cpp b/firmware/controllers/PwmTester.cpp index 3e09cb13f9..bc3463470e 100644 --- a/firmware/controllers/PwmTester.cpp +++ b/firmware/controllers/PwmTester.cpp @@ -22,7 +22,7 @@ extern board_configuration_s *boardConfiguration; static void startPwmTest(int freq) { scheduleMsg(&logger, "running pwm test @%d", freq); - // PD13, GPIO_NONE because pin is initialized elsewhere already + // PD13, GPIO_UNASSIGNED because pin is initialized elsewhere already startSimplePwm(&pwmTest[0], "tester", LED_WARNING, 10, 0.5f); // currently this is PB9 by default - see boardConfiguration->injectionPins startSimplePwm(&pwmTest[1], "tester", INJECTOR_1_OUTPUT, freq / 1.3333333333, 0.5f); diff --git a/firmware/controllers/algo/auto_generated_enums.cpp b/firmware/controllers/algo/auto_generated_enums.cpp index 31fd62e18f..4c1f3a74cc 100644 --- a/firmware/controllers/algo/auto_generated_enums.cpp +++ b/firmware/controllers/algo/auto_generated_enums.cpp @@ -727,8 +727,8 @@ case GPIOA_9: return "GPIOA_9"; case GPIOA_0: return "GPIOA_0"; -case GPIO_NONE: - return "GPIO_NONE"; +case GPIO_UNASSIGNED: + return "GPIO_UNASSIGNED"; case GPIOA_1: return "GPIOA_1"; case GPIOA_2: diff --git a/firmware/controllers/algo/engine.h b/firmware/controllers/algo/engine.h index 8c22293e7c..4d29f7dd1f 100644 --- a/firmware/controllers/algo/engine.h +++ b/firmware/controllers/algo/engine.h @@ -80,6 +80,7 @@ private: void setPumpsCounter(engine_configuration_s *engineConfiguration, int newValue); }; +void prepareShapes(Engine *engine); void resetConfigurationExt(Logging * logger, engine_type_e engineType, Engine *engine); void applyNonPersistentConfiguration(Logging * logger, Engine *engine); diff --git a/firmware/controllers/algo/engine_configuration.cpp b/firmware/controllers/algo/engine_configuration.cpp index 68b7bfe22d..8fb437615f 100644 --- a/firmware/controllers/algo/engine_configuration.cpp +++ b/firmware/controllers/algo/engine_configuration.cpp @@ -320,14 +320,14 @@ void setDefaultConfiguration(engine_configuration_s *engineConfiguration, board_ boardConfiguration->max31855spiDevice = SPI_NONE; for (int i = 0; i < MAX31855_CS_COUNT; i++) { - boardConfiguration->max31855_cs[i] = GPIO_NONE; + boardConfiguration->max31855_cs[i] = GPIO_UNASSIGNED; } for (int i = 0; i < LE_COMMAND_COUNT; i++) { - boardConfiguration->gpioPins[i] = GPIO_NONE; + boardConfiguration->gpioPins[i] = GPIO_UNASSIGNED; boardConfiguration->le_formulas[i][0] = 0; } for (int i = 0; i < JOYSTICK_PIN_COUNT; i++) { - boardConfiguration->joystickPins[i] = GPIO_NONE; + boardConfiguration->joystickPins[i] = GPIO_UNASSIGNED; } boardConfiguration->idleValvePin = GPIOE_2; @@ -335,7 +335,7 @@ void setDefaultConfiguration(engine_configuration_s *engineConfiguration, board_ boardConfiguration->fuelPumpPin = GPIOC_13; boardConfiguration->fuelPumpPinMode = OM_DEFAULT; boardConfiguration->electronicThrottlePin1 = GPIOC_9; - boardConfiguration->o2heaterPin = GPIO_NONE; + boardConfiguration->o2heaterPin = GPIO_UNASSIGNED; boardConfiguration->injectionPins[0] = GPIOB_9; boardConfiguration->injectionPins[1] = GPIOB_8; @@ -343,26 +343,26 @@ void setDefaultConfiguration(engine_configuration_s *engineConfiguration, board_ boardConfiguration->injectionPins[3] = GPIOE_5; boardConfiguration->injectionPins[4] = GPIOE_6; boardConfiguration->injectionPins[5] = GPIOC_12; - boardConfiguration->injectionPins[6] = GPIO_NONE; - boardConfiguration->injectionPins[7] = GPIO_NONE; - boardConfiguration->injectionPins[8] = GPIO_NONE; - boardConfiguration->injectionPins[9] = GPIO_NONE; - boardConfiguration->injectionPins[10] = GPIO_NONE; - boardConfiguration->injectionPins[11] = GPIO_NONE; + boardConfiguration->injectionPins[6] = GPIO_UNASSIGNED; + boardConfiguration->injectionPins[7] = GPIO_UNASSIGNED; + boardConfiguration->injectionPins[8] = GPIO_UNASSIGNED; + boardConfiguration->injectionPins[9] = GPIO_UNASSIGNED; + boardConfiguration->injectionPins[10] = GPIO_UNASSIGNED; + boardConfiguration->injectionPins[11] = GPIO_UNASSIGNED; boardConfiguration->injectionPinMode = OM_DEFAULT; boardConfiguration->ignitionPins[0] = GPIOC_7; boardConfiguration->ignitionPins[1] = GPIOE_4; // todo: update this value boardConfiguration->ignitionPins[2] = GPIOE_0; // todo: update this value boardConfiguration->ignitionPins[3] = GPIOE_1; // todo: update this value - boardConfiguration->ignitionPins[4] = GPIO_NONE; - boardConfiguration->ignitionPins[5] = GPIO_NONE; - boardConfiguration->ignitionPins[6] = GPIO_NONE; - boardConfiguration->ignitionPins[7] = GPIO_NONE; - boardConfiguration->ignitionPins[8] = GPIO_NONE; - boardConfiguration->ignitionPins[9] = GPIO_NONE; - boardConfiguration->ignitionPins[10] = GPIO_NONE; - boardConfiguration->ignitionPins[11] = GPIO_NONE; + boardConfiguration->ignitionPins[4] = GPIO_UNASSIGNED; + boardConfiguration->ignitionPins[5] = GPIO_UNASSIGNED; + boardConfiguration->ignitionPins[6] = GPIO_UNASSIGNED; + boardConfiguration->ignitionPins[7] = GPIO_UNASSIGNED; + boardConfiguration->ignitionPins[8] = GPIO_UNASSIGNED; + boardConfiguration->ignitionPins[9] = GPIO_UNASSIGNED; + boardConfiguration->ignitionPins[10] = GPIO_UNASSIGNED; + boardConfiguration->ignitionPins[11] = GPIO_UNASSIGNED; boardConfiguration->ignitionPinMode = OM_DEFAULT; boardConfiguration->malfunctionIndicatorPin = GPIOC_9; @@ -407,9 +407,9 @@ void setDefaultConfiguration(engine_configuration_s *engineConfiguration, board_ boardConfiguration->triggerInputPins[0] = GPIOC_6; boardConfiguration->triggerInputPins[1] = GPIOA_5; boardConfiguration->logicAnalyzerPins[0] = GPIOA_8; - boardConfiguration->logicAnalyzerPins[1] = GPIO_NONE; // GPIOE_5 is a popular option (if available) - boardConfiguration->logicAnalyzerPins[2] = GPIO_NONE; - boardConfiguration->logicAnalyzerPins[3] = GPIO_NONE; + boardConfiguration->logicAnalyzerPins[1] = GPIO_UNASSIGNED; // GPIOE_5 is a popular option (if available) + boardConfiguration->logicAnalyzerPins[2] = GPIO_UNASSIGNED; + boardConfiguration->logicAnalyzerPins[3] = GPIO_UNASSIGNED; boardConfiguration->logicAnalyzerMode[0] = false; boardConfiguration->logicAnalyzerMode[1] = false; @@ -431,9 +431,9 @@ void setDefaultConfiguration(engine_configuration_s *engineConfiguration, board_ // set this to SPI_DEVICE_3 to enable stimulation boardConfiguration->digitalPotentiometerSpiDevice = SPI_NONE; boardConfiguration->digitalPotentiometerChipSelect[0] = GPIOD_7; - boardConfiguration->digitalPotentiometerChipSelect[1] = GPIO_NONE; + boardConfiguration->digitalPotentiometerChipSelect[1] = GPIO_UNASSIGNED; boardConfiguration->digitalPotentiometerChipSelect[2] = GPIOD_5; - boardConfiguration->digitalPotentiometerChipSelect[3] = GPIO_NONE; + boardConfiguration->digitalPotentiometerChipSelect[3] = GPIO_UNASSIGNED; boardConfiguration->is_enabled_spi_1 = false; boardConfiguration->is_enabled_spi_2 = true; @@ -576,11 +576,17 @@ void applyNonPersistentConfiguration(Logging * logger, Engine *engine) { return; } + prepareShapes(engine); +} + +void prepareShapes(Engine *engine) { prepareOutputSignals(engine); + engine_configuration_s *engineConfiguration = engine->engineConfiguration; + engine_configuration2_s *engineConfiguration2 = engine->engineConfiguration2; + // todo: looks like this is here only for unit tests. todo: remove initializeIgnitionActions(0, 0, engineConfiguration2, &engineConfiguration2->ignitionEvents[0] PASS_ENGINE_PARAMETER); - } void setOperationMode(engine_configuration_s *engineConfiguration, operation_mode_e mode) { diff --git a/firmware/controllers/algo/rusefi_enums.h b/firmware/controllers/algo/rusefi_enums.h index 63480eb591..f90babd887 100644 --- a/firmware/controllers/algo/rusefi_enums.h +++ b/firmware/controllers/algo/rusefi_enums.h @@ -431,7 +431,7 @@ typedef enum { GPIOE_14 = 78, GPIOE_15 = 79, - GPIO_NONE = 80, + GPIO_UNASSIGNED = 80, GPIO_INVALID = 81, Force_4b_cranking_brain_pin = ENUM_SIZE_HACK, diff --git a/firmware/controllers/engine_controller.cpp b/firmware/controllers/engine_controller.cpp index 13d5259936..567beb7d10 100644 --- a/firmware/controllers/engine_controller.cpp +++ b/firmware/controllers/engine_controller.cpp @@ -134,7 +134,7 @@ static void updateErrorCodes(void) { } static void fanRelayControl(void) { - if (boardConfiguration->fanPin == GPIO_NONE) + if (boardConfiguration->fanPin == GPIO_UNASSIGNED) return; int isCurrentlyOn = getOutputPinValue(FAN_RELAY); @@ -189,7 +189,7 @@ static void cylinderCleanupControl(Engine *engine) { } static void handleGpio(Engine *engine, int index) { - if (boardConfiguration->gpioPins[index] == GPIO_NONE) + if (boardConfiguration->gpioPins[index] == GPIO_UNASSIGNED) return; io_pin_e pin = (io_pin_e) ((int) GPIO_0 + index); @@ -227,13 +227,13 @@ static void onEvenyGeneralMilliseconds(Engine *engine) { engine->updateSlowSensors(); for (int i = 0; i < LE_COMMAND_COUNT; i++) { - if (boardConfiguration->gpioPins[i] != GPIO_NONE) { + if (boardConfiguration->gpioPins[i] != GPIO_UNASSIGNED) { handleGpio(engine, i); } } #if EFI_FUEL_PUMP - if (boardConfiguration->fuelPumpPin != GPIO_NONE && engineConfiguration->isFuelPumpEnabled) { + if (boardConfiguration->fuelPumpPin != GPIO_UNASSIGNED && engineConfiguration->isFuelPumpEnabled) { setPinState(FUEL_PUMP_RELAY, fuelPumpLogic, engine); } #endif @@ -269,8 +269,8 @@ static void initPeriodicEvents(Engine *engine) { // (void)arg; // if (index != 0) // return; // let's not abuse the timer - one time per revolution would be enough -// // todo: the check about GPIO_NONE should be somewhere else! -// if (!getOutputPinValue(FUEL_PUMP_RELAY) && boardConfiguration->fuelPumpPin != GPIO_NONE) +// // todo: the check about GPIO_UNASSIGNED should be somewhere else! +// if (!getOutputPinValue(FUEL_PUMP_RELAY) && boardConfiguration->fuelPumpPin != GPIO_UNASSIGNED) // scheduleMsg(&logger, "fuelPump ON at %s", hwPortname(boardConfiguration->fuelPumpPin)); // turnOutputPinOn(FUEL_PUMP_RELAY); // /** @@ -425,7 +425,7 @@ void initEngineContoller(Engine *engine) { addConsoleAction("analoginfo", printAnalogInfo); for (int i = 0; i < LE_COMMAND_COUNT; i++) { - if (boardConfiguration->gpioPins[i] != GPIO_NONE) { + if (boardConfiguration->gpioPins[i] != GPIO_UNASSIGNED) { //mySetPadMode2("user-defined", boardConfiguration->gpioPins[i], PAL_STM32_MODE_OUTPUT); diff --git a/firmware/controllers/math/engine_math.cpp b/firmware/controllers/math/engine_math.cpp index 67d5a3235b..96c0ce4bb7 100644 --- a/firmware/controllers/math/engine_math.cpp +++ b/firmware/controllers/math/engine_math.cpp @@ -117,7 +117,7 @@ static void registerSparkEvent(trigger_shape_s * s, if (!isPinAssigned(pin)) { // todo: extact method for this index math - warning(OBD_PCM_Processor_Fault, "pin not assigned for coil #%d", (int) pin - (int) SPARKOUT_1_OUTPUT + 1); + warning(OBD_PCM_Processor_Fault, "no_pin_cl #%d", (int) pin - (int) SPARKOUT_1_OUTPUT + 1); } event->io_pin = pin; @@ -179,7 +179,7 @@ void FuelSchedule::registerInjectionEvent(trigger_shape_s *s, if (!isPinAssigned(pin)) { // todo: extact method for this index math - warning(OBD_PCM_Processor_Fault, "pin not assigned for injector #%d", (int) pin - (int) INJECTOR_1_OUTPUT + 1); + warning(OBD_PCM_Processor_Fault, "no_pin_inj #%d", (int) pin - (int) INJECTOR_1_OUTPUT + 1); } ActuatorEvent *ev = list->getNextActuatorEvent(); diff --git a/firmware/emulation/hw_layer/poten.c b/firmware/emulation/hw_layer/poten.c index f42367c384..2fe08bcab0 100644 --- a/firmware/emulation/hw_layer/poten.c +++ b/firmware/emulation/hw_layer/poten.c @@ -103,7 +103,7 @@ void initPotentiometers(board_configuration_s *boardConfiguration) { for (int i = 0; i < DIGIPOT_COUNT; i++) { brain_pin_e csPin = boardConfiguration->digitalPotentiometerChipSelect[i]; - if (csPin == GPIO_NONE) { + if (csPin == GPIO_UNASSIGNED) { continue; } diff --git a/firmware/hw_layer/board_test.cpp b/firmware/hw_layer/board_test.cpp index bca522ad75..3cc0d7f3fe 100644 --- a/firmware/hw_layer/board_test.cpp +++ b/firmware/hw_layer/board_test.cpp @@ -30,7 +30,7 @@ #include "AdcConfiguration.h" static volatile int stepCoutner = 0; -static volatile brain_pin_e currentPin = GPIO_NONE; +static volatile brain_pin_e currentPin = GPIO_UNASSIGNED; extern AdcConfiguration slowAdc; extern AdcConfiguration fastAdc; @@ -136,7 +136,7 @@ void printBoardTestState(void) { print("'n' for next step and 'set X' to return to step X\r\n"); print("ADC count: slow %d/fast %d\r\n", slowAdc.size(), fastAdc.size()); - if (currentPin != GPIO_NONE) { + if (currentPin != GPIO_UNASSIGNED) { print("Blinking %s\r\n", hwPortname(currentPin)); } } diff --git a/firmware/hw_layer/io_pins.c b/firmware/hw_layer/io_pins.c index 076da15cc3..d5594423d8 100644 --- a/firmware/hw_layer/io_pins.c +++ b/firmware/hw_layer/io_pins.c @@ -66,9 +66,9 @@ static void outputPinRegisterExt(const char *msg, io_pin_e ioPin, GPIO_TypeDef * } GPIO_TypeDef * getHwPort(brain_pin_e brainPin) { - if (brainPin == GPIO_NONE) + if (brainPin == GPIO_UNASSIGNED) return GPIO_NULL; - if (brainPin > GPIO_NONE || brainPin < 0) { + if (brainPin > GPIO_UNASSIGNED || brainPin < 0) { firmwareError("Invalid brain_pin_e: %d", brainPin); return GPIO_NULL; } @@ -76,9 +76,9 @@ GPIO_TypeDef * getHwPort(brain_pin_e brainPin) { } ioportmask_t getHwPin(brain_pin_e brainPin) { - if (brainPin == GPIO_NONE) + if (brainPin == GPIO_UNASSIGNED) return EFI_ERROR_CODE; - if (brainPin > GPIO_NONE || brainPin < 0) { + if (brainPin > GPIO_UNASSIGNED || brainPin < 0) { firmwareError("Invalid brain_pin_e: %d", brainPin); return EFI_ERROR_CODE; } diff --git a/firmware/hw_layer/max31855.c b/firmware/hw_layer/max31855.c index f3415289f1..a6a558fe14 100644 --- a/firmware/hw_layer/max31855.c +++ b/firmware/hw_layer/max31855.c @@ -33,7 +33,7 @@ static void showEgtInfo(board_configuration_s *boardConfiguration) { scheduleMsg(&logger, "EGT spi: %d", boardConfiguration->max31855spiDevice); for (int i = 0; i < MAX31855_CS_COUNT; i++) { - if (boardConfiguration->max31855_cs[i] != GPIO_NONE) { + if (boardConfiguration->max31855_cs[i] != GPIO_UNASSIGNED) { scheduleMsg(&logger, "%d ETG @ %s", i, hwPortname(boardConfiguration->max31855_cs[i])); } @@ -144,7 +144,7 @@ void initMax31855(board_configuration_s *boardConfiguration) { turnOnSpi(SPI_DEVICE_3); for (int i = 0; i < MAX31855_CS_COUNT; i++) { - if (boardConfiguration->max31855_cs[i] != GPIO_NONE) { + if (boardConfiguration->max31855_cs[i] != GPIO_UNASSIGNED) { initSpiCs(&spiConfig[i], boardConfiguration->max31855_cs[i]); diff --git a/firmware/hw_layer/neo6m.c b/firmware/hw_layer/neo6m.c index 6476ee9b29..68359bd86f 100644 --- a/firmware/hw_layer/neo6m.c +++ b/firmware/hw_layer/neo6m.c @@ -106,7 +106,7 @@ static msg_t GpsThreadEntryPoint(void *arg) { } void initGps(void) { - if (boardConfiguration->gps_rx_pin == GPIO_NONE || boardConfiguration->gps_tx_pin == GPIO_NONE) { + if (boardConfiguration->gps_rx_pin == GPIO_UNASSIGNED || boardConfiguration->gps_tx_pin == GPIO_UNASSIGNED) { return; } diff --git a/firmware/hw_layer/pin_repository.c b/firmware/hw_layer/pin_repository.c index d84f2df33c..1705668ced 100644 --- a/firmware/hw_layer/pin_repository.c +++ b/firmware/hw_layer/pin_repository.c @@ -79,11 +79,11 @@ static char portNameBuffer[20]; /** * Parse string representation of physical pin into brain_pin_e ordinal. * - * @return GPIO_NONE for "none", GPIO_INVALID for invalid entry + * @return GPIO_UNASSIGNED for "none", GPIO_INVALID for invalid entry */ brain_pin_e parseBrainPin(const char *str) { if (strEqual(str, "none")) - return GPIO_NONE; + return GPIO_UNASSIGNED; // todo: create method toLowerCase? if (str[0] != 'p' && str[0] != 'p') { return GPIO_INVALID; diff --git a/firmware/rusefi.cpp b/firmware/rusefi.cpp index b2533bd416..a9d5eed41d 100644 --- a/firmware/rusefi.cpp +++ b/firmware/rusefi.cpp @@ -252,5 +252,5 @@ void firmwareError(const char *fmt, ...) { } int getRusEfiVersion(void) { - return 20141109; + return 20141110; } diff --git a/firmware/svnversion.h b/firmware/svnversion.h index 527a545510..5b1c1ce569 100644 --- a/firmware/svnversion.h +++ b/firmware/svnversion.h @@ -1,5 +1,5 @@ // This file was generated by Version2Header -// Sat Nov 08 10:29:01 EST 2014 +// Mon Nov 10 08:51:36 EST 2014 #ifndef VCS_VERSION -#define VCS_VERSION "5226" +#define VCS_VERSION "5255" #endif