diff --git a/firmware/config/engines/bmw_e34.cpp b/firmware/config/engines/bmw_e34.cpp index 412b2546da..0fb6eaf740 100644 --- a/firmware/config/engines/bmw_e34.cpp +++ b/firmware/config/engines/bmw_e34.cpp @@ -78,11 +78,11 @@ void setBmwE34(DECLARE_ENGINE_PARAMETER_F) { boardConfiguration->fuelPumpPin = GPIOD_4; - boardConfiguration->idleValvePin = GPIOC_14; - boardConfiguration->idleValvePinMode = OM_INVERTED; - boardConfiguration->idleSolenoidFrequency = 300; + boardConfiguration->idle.solenoidPin = GPIOC_14; + boardConfiguration->idle.solenoidPinMode = OM_INVERTED; + boardConfiguration->idle.solenoidFrequency = 300; // set_idle_pwm 50 - boardConfiguration->idleSolenoidPwm = 0.5; + boardConfiguration->idlePosition = 0.5; // turbocharger boost control solenoid: TODO output: GPIOE_6 // water injection #1 TODO GPIOD_7 diff --git a/firmware/config/engines/custom_engine.cpp b/firmware/config/engines/custom_engine.cpp index 38db65b0c4..7cba7e70fb 100644 --- a/firmware/config/engines/custom_engine.cpp +++ b/firmware/config/engines/custom_engine.cpp @@ -72,7 +72,7 @@ void setCustomEngineConfiguration(DECLARE_ENGINE_PARAMETER_F) { boardConfiguration->fuelPumpPin = GPIOE_4; boardConfiguration->mainRelayPin = GPIOD_7; - boardConfiguration->idleValvePin = GPIOC_13; + boardConfiguration->idle.solenoidPin = GPIOC_13; boardConfiguration->fanPin = GPIOE_5; diff --git a/firmware/config/engines/dodge_neon.cpp b/firmware/config/engines/dodge_neon.cpp index 20ac02fcad..282d25a213 100644 --- a/firmware/config/engines/dodge_neon.cpp +++ b/firmware/config/engines/dodge_neon.cpp @@ -279,8 +279,8 @@ void setDodgeNeonNGCEngineConfiguration(DECLARE_ENGINE_PARAMETER_F) { boardConfiguration->mainRelayPin = GPIOE_6; - boardConfiguration->idleValvePin = GPIOC_13; - boardConfiguration->idleSolenoidFrequency = 300; + boardConfiguration->idle.solenoidPin = GPIOC_13; + boardConfiguration->idle.solenoidFrequency = 300; boardConfiguration->fuelPumpPin = GPIOE_3; boardConfiguration->fuelPumpPinMode = OM_DEFAULT; diff --git a/firmware/config/engines/honda_accord.cpp b/firmware/config/engines/honda_accord.cpp index 877950293d..878934f93b 100644 --- a/firmware/config/engines/honda_accord.cpp +++ b/firmware/config/engines/honda_accord.cpp @@ -161,7 +161,7 @@ static void setHondaAccordConfigurationCommon(DECLARE_ENGINE_PARAMETER_F) { // Frankenso low out #11: PB8 // Frankenso low out #12: PB7 - boardConfiguration->idleValvePin = GPIOE_5; + boardConfiguration->idle.solenoidPin = GPIOE_5; boardConfiguration->o2heaterPin = GPIOC_13; boardConfiguration->injectionPins[0] = GPIOB_8; @@ -180,7 +180,7 @@ static void setHondaAccordConfigurationCommon(DECLARE_ENGINE_PARAMETER_F) { setFrankenso_01_LCD(boardConfiguration); - boardConfiguration->idleSolenoidFrequency = 500; + boardConfiguration->idle.solenoidFrequency = 500; } void setHondaAccordConfigurationTwoWires(DECLARE_ENGINE_PARAMETER_F) { diff --git a/firmware/config/engines/mazda_miata.cpp b/firmware/config/engines/mazda_miata.cpp index ac4695c089..89f4be7410 100644 --- a/firmware/config/engines/mazda_miata.cpp +++ b/firmware/config/engines/mazda_miata.cpp @@ -139,7 +139,7 @@ static void commonMiataNa(DECLARE_ENGINE_PARAMETER_F) { setFuelLoadBin(1.2, 4.4 PASS_ENGINE_PARAMETER); setFuelRpmBin(800, 7000 PASS_ENGINE_PARAMETER); - boardConfiguration->idleSolenoidFrequency = 160; + boardConfiguration->idle.solenoidFrequency = 160; engineConfiguration->globalTriggerAngleOffset = 294; @@ -335,8 +335,8 @@ void setFordEscortGt(DECLARE_ENGINE_PARAMETER_F) { engineConfiguration->cranking.baseFuel = 5; // 40% idle is good default - boardConfiguration->idleSolenoidFrequency = 300; - boardConfiguration->idleValvePin = GPIOB_9; + boardConfiguration->idle.solenoidFrequency = 300; + boardConfiguration->idle.solenoidPin = GPIOB_9; boardConfiguration->malfunctionIndicatorPin = GPIOE_5; boardConfiguration->malfunctionIndicatorPinMode = OM_DEFAULT; @@ -413,7 +413,7 @@ static void setMiata1994_common(DECLARE_ENGINE_PARAMETER_F) { boardConfiguration->injectionPins[5] = GPIO_UNASSIGNED; boardConfiguration->injectionPinMode = OM_DEFAULT; - boardConfiguration->idleValvePin = GPIOB_9; + boardConfiguration->idle.solenoidPin = GPIOB_9; boardConfiguration->ignitionPins[0] = GPIOE_14; // Frankenso high side - pin 1G boardConfiguration->ignitionPins[1] = GPIO_UNASSIGNED; @@ -450,7 +450,7 @@ void setMiata1994_d(DECLARE_ENGINE_PARAMETER_F) { boardConfiguration->injectionPins[3] = GPIOB_7; // todo: add the diode? change idle valve logic? - boardConfiguration->idleValvePin = GPIO_UNASSIGNED; + boardConfiguration->idle.solenoidPin = GPIO_UNASSIGNED; } void setMiata1994_s(DECLARE_ENGINE_PARAMETER_F) { @@ -474,7 +474,7 @@ void setMiata1994_s(DECLARE_ENGINE_PARAMETER_F) { boardConfiguration->injectionPins[3] = GPIOB_7; // injector #4 // setFsio(engineConfiguration, 0, GPIOD_11, "coolant 80 >"); - boardConfiguration->idleSolenoidFrequency = 500; + boardConfiguration->idle.solenoidFrequency = 500; engineConfiguration->acCutoffLowRpm = 400; engineConfiguration->acCutoffHighRpm = 4500; @@ -513,7 +513,7 @@ void setMiata1996(DECLARE_ENGINE_PARAMETER_F) { boardConfiguration->triggerInputPins[1] = GPIOC_6; boardConfiguration->fuelPumpPin = GPIOE_4; - boardConfiguration->idleValvePin = GPIOE_5; + boardConfiguration->idle.solenoidPin = GPIOE_5; engineConfiguration->mafAdcChannel = EFI_ADC_1; engineConfiguration->cltAdcChannel = EFI_ADC_11; diff --git a/firmware/config/engines/mazda_miata_nb.cpp b/firmware/config/engines/mazda_miata_nb.cpp index 2768fa7fdd..30d455500e 100644 --- a/firmware/config/engines/mazda_miata_nb.cpp +++ b/firmware/config/engines/mazda_miata_nb.cpp @@ -44,8 +44,8 @@ void setMazdaMiataNbEngineConfiguration(DECLARE_ENGINE_PARAMETER_F) { engineConfiguration->iatAdcChannel = EFI_ADC_13; engineConfiguration->afr.hwChannel = EFI_ADC_2; - boardConfiguration->idleValvePin = GPIOE_0; - boardConfiguration->idleValvePinMode = OM_DEFAULT; + boardConfiguration->idle.solenoidPin = GPIOE_0; + boardConfiguration->idle.solenoidPinMode = OM_DEFAULT; boardConfiguration->fuelPumpPin = GPIOC_14; // Frankenstein: low side - out #4 boardConfiguration->fuelPumpPinMode = OM_DEFAULT; diff --git a/firmware/controllers/algo/engine_configuration.cpp b/firmware/controllers/algo/engine_configuration.cpp index e060c13345..afbc3b80f5 100644 --- a/firmware/controllers/algo/engine_configuration.cpp +++ b/firmware/controllers/algo/engine_configuration.cpp @@ -358,9 +358,9 @@ void setDefaultConfiguration(DECLARE_ENGINE_PARAMETER_F) { engineConfiguration->hasBaroSensor = false; engineConfiguration->isDigitalChartEnabled = true; - boardConfiguration->idleSolenoidFrequency = 200; + boardConfiguration->idle.solenoidFrequency = 200; // set_idle_position 50 - boardConfiguration->idleSolenoidPwm = 0.5; + boardConfiguration->idlePosition = 0.5; engineConfiguration->targetIdleRpm = 1200; // engineConfiguration->idleMode = IM_AUTO; engineConfiguration->idleMode = IM_MANUAL; @@ -430,8 +430,8 @@ void setDefaultConfiguration(DECLARE_ENGINE_PARAMETER_F) { boardConfiguration->mainRelayPin = GPIO_UNASSIGNED; boardConfiguration->mainRelayPinMode = OM_DEFAULT; - boardConfiguration->idleValvePin = GPIO_UNASSIGNED; - boardConfiguration->idleValvePinMode = OM_DEFAULT; + boardConfiguration->idle.solenoidPin = GPIO_UNASSIGNED; + boardConfiguration->idle.solenoidPinMode = OM_DEFAULT; boardConfiguration->fuelPumpPin = GPIO_UNASSIGNED; boardConfiguration->fuelPumpPinMode = OM_DEFAULT; boardConfiguration->electronicThrottlePin1 = GPIO_UNASSIGNED; @@ -568,8 +568,8 @@ void setDefaultConfiguration(DECLARE_ENGINE_PARAMETER_F) { boardConfiguration->tunerStudioSerialSpeed = TS_DEFAULT_SPEED; - boardConfiguration->idleStepperStep = GPIO_UNASSIGNED; - boardConfiguration->idleStepperDirection = GPIO_UNASSIGNED; + boardConfiguration->idle.stepperStepPin = GPIO_UNASSIGNED; + boardConfiguration->idle.stepperDirectionPin = GPIO_UNASSIGNED; engineConfiguration->accelLength = 6; engineConfiguration->accelEnrichmentThreshold = 5; // kPa diff --git a/firmware/controllers/algo/engine_configuration_generated_structures.h b/firmware/controllers/algo/engine_configuration_generated_structures.h index b25f275ae2..4c62da2e39 100644 --- a/firmware/controllers/algo/engine_configuration_generated_structures.h +++ b/firmware/controllers/algo/engine_configuration_generated_structures.h @@ -1,4 +1,4 @@ -// this section was generated by config_definition.jar on Mon Mar 30 12:05:08 EDT 2015 +// this section was generated by config_definition.jar on Fri Apr 03 20:20:44 EDT 2015 // begin #include "rusefi_types.h" typedef struct { @@ -229,378 +229,386 @@ typedef struct { /** * offset 0 */ - brain_pin_e idleValvePin; + brain_pin_e solenoidPin; /** * offset 4 */ - pin_output_mode_e idleValvePinMode; + pin_output_mode_e solenoidPinMode; /** * offset 8 */ - brain_pin_e fuelPumpPin; + int solenoidFrequency; /** * offset 12 */ - pin_output_mode_e fuelPumpPinMode; + brain_pin_e stepperDirectionPin; /** * offset 16 */ + brain_pin_e stepperStepPin; + /** total size 20*/ +} idle_hardware_s; + +typedef struct { + /** + * offset 0 + */ + idle_hardware_s idle; + /** + * value between 0 and 1 + * offset 20 + */ + float idlePosition; + /** + * offset 24 + */ + brain_pin_e fuelPumpPin; + /** + * offset 28 + */ + pin_output_mode_e fuelPumpPinMode; + /** + * offset 32 + */ brain_pin_e injectionPins[INJECTION_PIN_COUNT]; /** - * offset 64 + * offset 80 */ pin_output_mode_e injectionPinMode; /** - * offset 68 + * offset 84 */ brain_pin_e ignitionPins[IGNITION_PIN_COUNT]; /** - * offset 116 + * offset 132 */ pin_output_mode_e ignitionPinMode; /** - * offset 120 + * offset 136 */ brain_pin_e malfunctionIndicatorPin; /** - * offset 124 + * offset 140 */ pin_output_mode_e malfunctionIndicatorPinMode; /** - * offset 128 + * offset 144 */ brain_pin_e fanPin; /** - * offset 132 + * offset 148 */ pin_output_mode_e fanPinMode; /** - * offset 136 + * offset 152 */ brain_pin_e electronicThrottlePin1; /** - * offset 140 + * offset 156 */ pin_output_mode_e electronicThrottlePin1Mode; /** * some cars have a switch to indicate that clutch pedal is all the way down - * offset 144 + * offset 160 */ brain_pin_e clutchDownPin; /** - * offset 148 + * offset 164 */ pin_input_mode_e clutchDownPinMode; /** - * offset 152 + * offset 168 */ brain_pin_e alternatorControlPin; /** - * offset 156 + * offset 172 */ pin_output_mode_e alternatorControlPinMode; /** - * offset 160 + * offset 176 */ brain_pin_e HD44780_rs; /** - * offset 164 + * offset 180 */ brain_pin_e HD44780_e; /** - * offset 168 + * offset 184 */ brain_pin_e HD44780_db4; /** - * offset 172 + * offset 188 */ brain_pin_e HD44780_db5; /** - * offset 176 + * offset 192 */ brain_pin_e HD44780_db6; /** - * offset 180 + * offset 196 */ brain_pin_e HD44780_db7; /** - * offset 184 + * offset 200 */ brain_pin_e gps_rx_pin; /** - * offset 188 + * offset 204 */ brain_pin_e gps_tx_pin; /** - * offset 192 - */ - int idleSolenoidFrequency; - /** - * offset 196 + * offset 208 */ int triggerSimulatorFrequency; /** * Digital Potentiometer is used by stock ECU stimulation code - * offset 200 + * offset 212 */ spi_device_e digitalPotentiometerSpiDevice; /** - * offset 204 + * offset 216 */ brain_pin_e digitalPotentiometerChipSelect[DIGIPOT_COUNT]; /** - * offset 220 + * offset 232 */ adc_channel_mode_e adcHwChannelEnabled[HW_MAX_ADC_INDEX]; /** - * offset 284 + * offset 296 */ brain_input_pin_e triggerInputPins[3]; /** - * offset 296 + * offset 308 */ brain_pin_e mainRelayPin; /** - * offset 300 + * offset 312 */ int idleThreadPeriod; /** - * offset 304 + * offset 316 */ int consoleLoopPeriod; /** - * offset 308 + * offset 320 */ int lcdThreadPeriod; /** - * offset 312 + * offset 324 */ int anotherUnused; /** - * offset 316 + * offset 328 */ int generalPeriodicThreadPeriod; /** - * offset 320 + * offset 332 */ uint32_t tunerStudioSerialSpeed; /** - * offset 324 + * offset 336 */ brain_pin_e boardTestModeJumperPin; /** - * offset 328 + * offset 340 */ can_device_mode_e canDeviceMode; /** - * offset 332 + * offset 344 */ brain_pin_e canTxPin; /** - * offset 336 + * offset 348 */ brain_pin_e canRxPin; /** - * offset 340 + * offset 352 */ brain_pin_e triggerSimulatorPins[TRIGGER_SIMULATOR_PIN_COUNT]; /** - * offset 352 + * offset 364 */ pin_output_mode_e triggerSimulatorPinModes[TRIGGER_SIMULATOR_PIN_COUNT]; /** - * offset 364 + * offset 376 */ brain_pin_e o2heaterPin; /** - * offset 368 + * offset 380 */ pin_output_mode_e o2heaterPinModeTodO; /** - offset 372 bit 0 */ + offset 384 bit 0 */ bool_t is_enabled_spi_1 : 1; /** - offset 372 bit 1 */ + offset 384 bit 1 */ bool_t is_enabled_spi_2 : 1; /** - offset 372 bit 2 */ + offset 384 bit 2 */ bool_t is_enabled_spi_3 : 1; /** - offset 372 bit 3 */ + offset 384 bit 3 */ bool_t isSdCardEnabled : 1; /** - offset 372 bit 4 */ + offset 384 bit 4 */ bool_t isFastAdcEnabled : 1; /** - offset 372 bit 5 */ + offset 384 bit 5 */ bool_t isEngineControlEnabled : 1; /** - offset 372 bit 6 */ + offset 384 bit 6 */ bool_t isHip9011Enabled : 1; /** - offset 372 bit 7 */ + offset 384 bit 7 */ bool_t isVerboseAlternator : 1; /** - offset 372 bit 8 */ + offset 384 bit 8 */ bool_t useSerialPort : 1; /** - offset 372 bit 9 */ + offset 384 bit 9 */ bool_t useStepperIdle : 1; /** - * offset 376 + * offset 388 */ brain_input_pin_e logicAnalyzerPins[LOGIC_ANALYZER_CHANNEL_COUNT]; /** * default or inverted input - * offset 392 + * offset 404 */ uint8_t logicAnalyzerMode[LOGIC_ANALYZER_CHANNEL_COUNT]; /** - * offset 396 + * offset 408 */ int unrealisticRpmThreashold; /** - * offset 400 + * offset 412 */ pin_output_mode_e mainRelayPinMode; /** - * offset 404 + * offset 416 */ brain_pin_e max31855_cs[EGT_CHANNEL_COUNT]; /** - * offset 436 + * offset 448 */ spi_device_e max31855spiDevice; /** - * offset 440 + * offset 452 */ brain_pin_e fsioPins[LE_COMMAND_COUNT]; /** - * offset 504 + * offset 516 */ pin_output_mode_e gpioPinModes[LE_COMMAND_COUNT]; /** - * offset 568 + * offset 580 */ brain_pin_e joystickPins[JOYSTICK_PIN_COUNT]; /** * This pin is used for debugging - snap a logic analyzer on it and see if it's ever high - * offset 588 + * offset 600 */ brain_pin_e triggerErrorPin; /** - * offset 592 + * offset 604 */ pin_output_mode_e triggerErrorPinMode; /** - * value between 0 and 1 - * offset 596 - */ - float idleSolenoidPwm; - /** - * offset 600 + * offset 608 */ brain_pin_e acRelayPin; /** - * offset 604 + * offset 612 */ pin_output_mode_e acRelayPinMode; /** - * offset 608 + * offset 616 */ fsio_pwm_freq_t fsioFrequency[LE_COMMAND_COUNT]; /** - * offset 640 + * offset 648 */ brain_pin_e hip9011CsPin; /** - * offset 644 + * offset 652 */ brain_pin_e hip9011IntHoldPin; /** - * offset 648 + * offset 656 */ brain_pin_e hip9011OutPin; /** - * offset 652 + * offset 660 */ fsio_setting_t fsio_setting[LE_COMMAND_COUNT]; /** - * offset 716 + * offset 724 */ brain_pin_e spi1mosiPin; /** - * offset 720 + * offset 728 */ brain_pin_e spi1misoPin; /** - * offset 724 + * offset 732 */ brain_pin_e spi1sckPin; /** - * offset 728 + * offset 736 */ brain_pin_e spi2mosiPin; /** - * offset 732 + * offset 740 */ brain_pin_e spi2misoPin; /** - * offset 736 + * offset 744 */ brain_pin_e spi2sckPin; /** - * offset 740 + * offset 748 */ brain_pin_e spi3mosiPin; /** - * offset 744 + * offset 752 */ brain_pin_e spi3misoPin; /** - * offset 748 + * offset 756 */ brain_pin_e spi3sckPin; /** - * offset 752 + * offset 760 */ float hip9011Gain; /** - * offset 756 + * offset 764 */ brain_pin_e joystickCenterPin; /** - * offset 760 + * offset 768 */ brain_pin_e joystickAPin; /** - * offset 764 + * offset 772 */ brain_pin_e joystickBPin; /** - * offset 768 + * offset 776 */ brain_pin_e joystickCPin; /** - * offset 772 + * offset 780 */ brain_pin_e joystickDPin; /** - * offset 776 + * offset 784 */ analog_chart_e analogChartMode; - /** - * offset 780 - */ - maf_sensor_type_e mafSensorType; - /** - * offset 784 - */ - brain_pin_e idleStepperDirection; /** * offset 788 */ - brain_pin_e idleStepperStep; + maf_sensor_type_e mafSensorType; /** * offset 792 */ @@ -1227,4 +1235,4 @@ typedef struct { } engine_configuration_s; // end -// this section was generated by config_definition.jar on Mon Mar 30 12:05:08 EDT 2015 +// this section was generated by config_definition.jar on Fri Apr 03 20:20:44 EDT 2015 diff --git a/firmware/controllers/flash_main.h b/firmware/controllers/flash_main.h index 06b9c00b00..50b5f8cdc3 100644 --- a/firmware/controllers/flash_main.h +++ b/firmware/controllers/flash_main.h @@ -12,7 +12,7 @@ #include "engine_configuration.h" #include "engine.h" -#define FLASH_DATA_VERSION 7568 +#define FLASH_DATA_VERSION 7599 void readFromFlash(void); void initFlash(Logging *sharedLogger, Engine *engine); diff --git a/firmware/controllers/idle_thread.cpp b/firmware/controllers/idle_thread.cpp index 814a8e6a0b..464461cd16 100644 --- a/firmware/controllers/idle_thread.cpp +++ b/firmware/controllers/idle_thread.cpp @@ -47,7 +47,7 @@ static SimplePwm idleValvePwm; static StepperMotor iacMotor; /** - * Idle level calculation algorithm lives in idle_controller.c + * Idle level calculation algorithm lives in idle_controller.cpp */ static IdleValveState idleMath; @@ -56,10 +56,14 @@ void idleDebug(const char *msg, percent_t value) { } static void showIdleInfo(void) { - scheduleMsg(logger, "idleMode=%s duty=%f", getIdle_mode_e(engineConfiguration->idleMode), - boardConfiguration->idleSolenoidPwm); - scheduleMsg(logger, "idle valve freq=%d on %s", boardConfiguration->idleSolenoidFrequency, - hwPortname(boardConfiguration->idleValvePin)); + scheduleMsg(logger, "idleMode=%s position=%f isStepper=%s", getIdle_mode_e(engineConfiguration->idleMode), + boardConfiguration->idlePosition, boolToString(boardConfiguration->useStepperIdle)); + if (boardConfiguration->useStepperIdle) { + + } else { + scheduleMsg(logger, "idle valve freq=%d on %s", boardConfiguration->idle.solenoidFrequency, + hwPortname(boardConfiguration->idle.solenoidPin)); + } } static void setIdleControlEnabled(int value) { @@ -72,7 +76,7 @@ static void setIdleValvePwm(percent_t value) { return; scheduleMsg(logger, "setting idle valve PWM %f", value); float f = 0.01 * value; - boardConfiguration->idleSolenoidPwm = f; + boardConfiguration->idlePosition = f; showIdleInfo(); /** * currently idle level is an percent value (0-100 range), and PWM takes a float in the 0..1 range @@ -82,7 +86,7 @@ static void setIdleValvePwm(percent_t value) { } static void setIdleValvePosition(int position) { - if(boardConfiguration->useStepperIdle) { + if (boardConfiguration->useStepperIdle) { iacMotor.targetPosition = position; } else { setIdleValvePwm(position); @@ -143,16 +147,16 @@ void startIdleThread(Logging*sharedLogger, Engine *engine) { logger = sharedLogger; if (boardConfiguration->useStepperIdle) { - iacMotor.initialize(boardConfiguration->idleStepperStep, boardConfiguration->idleStepperDirection); + iacMotor.initialize(boardConfiguration->idle.stepperStepPin, boardConfiguration->idle.stepperDirectionPin); } else { /** * Start PWM for idleValvePin */ - startSimplePwmExt(&idleValvePwm, "Idle Valve", boardConfiguration->idleValvePin, &idlePin, - boardConfiguration->idleSolenoidFrequency, boardConfiguration->idleSolenoidPwm, applyIdleSolenoidPinState); + startSimplePwmExt(&idleValvePwm, "Idle Valve", boardConfiguration->idle.solenoidPin, &idlePin, + boardConfiguration->idle.solenoidFrequency, boardConfiguration->idlePosition, + applyIdleSolenoidPinState); } - idleMath.init(); scheduleMsg(logger, "initial idle %d", idleMath.value); @@ -165,7 +169,8 @@ void startIdleThread(Logging*sharedLogger, Engine *engine) { getInputMode(boardConfiguration->clutchDownPinMode)); if (engineConfiguration->clutchUpPin != GPIO_UNASSIGNED) - mySetPadMode2("clutch up switch", engineConfiguration->clutchUpPin, getInputMode(engineConfiguration->clutchUpPinMode)); + mySetPadMode2("clutch up switch", engineConfiguration->clutchUpPin, + getInputMode(engineConfiguration->clutchUpPinMode)); addConsoleAction("idleinfo", showIdleInfo); addConsoleActionI("set_idle_rpm", setIdleRpmAction); diff --git a/firmware/controllers/settings.cpp b/firmware/controllers/settings.cpp index 55b6edb7a4..8e741d5766 100644 --- a/firmware/controllers/settings.cpp +++ b/firmware/controllers/settings.cpp @@ -85,8 +85,8 @@ static void printOutputs(engine_configuration_s *engineConfiguration) { scheduleMsg(&logger, "ignition #%d @ %s", (1 + i), hwPortname(brainPin)); } - scheduleMsg(&logger, "idlePin: mode %s @ %s freq=%d", getPin_output_mode_e(boardConfiguration->idleValvePinMode), - hwPortname(boardConfiguration->idleValvePin), boardConfiguration->idleSolenoidFrequency); + scheduleMsg(&logger, "idlePin: mode %s @ %s freq=%d", getPin_output_mode_e(boardConfiguration->idle.solenoidPinMode), + hwPortname(boardConfiguration->idle.solenoidPin), boardConfiguration->idle.solenoidFrequency); scheduleMsg(&logger, "malfunctionIndicatorn: %s mode=%s", hwPortname(boardConfiguration->malfunctionIndicatorPin), getPin_output_mode_e(boardConfiguration->malfunctionIndicatorPinMode)); @@ -308,7 +308,7 @@ void setEngineType(int value) { } static void setIdleSolenoidFrequency(int value) { - boardConfiguration->idleSolenoidFrequency = value; + boardConfiguration->idle.solenoidFrequency = value; } static void setInjectionPinMode(int value) { @@ -322,7 +322,7 @@ static void setIgnitionPinMode(int value) { } static void setIdlePinMode(int value) { - boardConfiguration->idleValvePinMode = (pin_output_mode_e) value; + boardConfiguration->idle.solenoidPinMode = (pin_output_mode_e) value; doPrintConfiguration(engine); } @@ -596,7 +596,7 @@ static void setIdlePin(const char *pinName) { return; } scheduleMsg(&logger, "setting idleValve pin to %s please save&restart", hwPortname(pin)); - boardConfiguration->idleValvePin = pin; + boardConfiguration->idle.solenoidPin = pin; } static void setFuelPumpPin(const char *pinName) { diff --git a/firmware/integration/rusefi_config.txt b/firmware/integration/rusefi_config.txt index 41128a4356..8c504d7f3e 100644 --- a/firmware/integration/rusefi_config.txt +++ b/firmware/integration/rusefi_config.txt @@ -251,10 +251,23 @@ float injectionAngle;this is about deciding when the injector starts it's squirt float diffLoadEnrichmentCoef; air_pressure_sensor_config_s baroSensor;@see hasBaroSensor + +struct idle_hardware_s + brain_pin_e solenoidPin; + pin_output_mode_e solenoidPinMode; + + int solenoidFrequency;;"Hz", 1, 0, 0, 3000, 0 + + brain_pin_e stepperDirectionPin; + brain_pin_e stepperStepPin; + +end_struct struct_no_prefix board_configuration_s - brain_pin_e idleValvePin; - pin_output_mode_e idleValvePinMode; + idle_hardware_s idle; + + + float idlePosition;value between 0 and 1;"%", 1, 0, 0, 100, 0 brain_pin_e fuelPumpPin; pin_output_mode_e fuelPumpPinMode; @@ -290,8 +303,6 @@ brain_pin_e clutchDownPin;some cars have a switch to indicate that clutch pedal brain_pin_e gps_rx_pin; brain_pin_e gps_tx_pin; - int idleSolenoidFrequency;;"Hz", 1, 0, 0, 3000, 0 - int triggerSimulatorFrequency;;"Rpm", 1, 0, 0,30000, 0 spi_device_e digitalPotentiometerSpiDevice;Digital Potentiometer is used by stock ECU stimulation code @@ -356,7 +367,6 @@ bit is_enabled_spi_2 pin_output_mode_e triggerErrorPinMode; - float idleSolenoidPwm;value between 0 and 1;"%", 1, 0, 0, 100, 0 brain_pin_e acRelayPin; pin_output_mode_e acRelayPinMode; @@ -389,8 +399,6 @@ custom fsio_setting_t 4 scalar, F32, @OFFSET@, "Val", 1, 0, 0, custom analog_chart_e 4 bits, S32, @OFFSET@, [0:1], "none", "trigger", "MAP", "INVALID" analog_chart_e analogChartMode; maf_sensor_type_e mafSensorType; - brain_pin_e idleStepperDirection; - brain_pin_e idleStepperStep; int[3] unusedbs;