that's how we can move all fields one by one from boardConfiguration to engineConfiguration

my approach is to move fields from the bottom of BC struct
This commit is contained in:
rusefi 2019-11-30 10:24:37 -05:00
parent f9986028c6
commit 2738fefa48
19 changed files with 59 additions and 54 deletions

View File

@ -69,7 +69,7 @@ void setBoardConfigurationOverrides(void) {
boardConfiguration->triggerSimulatorPins[2] = GPIO_UNASSIGNED;
boardConfiguration->triggerSimulatorPinModes[1] = OM_DEFAULT;
boardConfiguration->triggerSimulatorPinModes[2] = OM_DEFAULT;
boardConfiguration->vehicleSpeedSensorInputPin = GPIO_UNASSIGNED;
engineConfiguration->vehicleSpeedSensorInputPin = GPIO_UNASSIGNED;
boardConfiguration->digitalPotentiometerSpiDevice = SPI_NONE;
boardConfiguration->max31855spiDevice = SPI_NONE;

View File

@ -215,7 +215,7 @@ void setBoardConfigurationOverrides(void) {
boardConfiguration->triggerSimulatorPins[2] = GPIO_UNASSIGNED;
boardConfiguration->triggerSimulatorPinModes[1] = OM_DEFAULT;
boardConfiguration->triggerSimulatorPinModes[2] = OM_DEFAULT;
boardConfiguration->vehicleSpeedSensorInputPin = GPIO_UNASSIGNED;
engineConfiguration->vehicleSpeedSensorInputPin = GPIO_UNASSIGNED;
boardConfiguration->digitalPotentiometerSpiDevice = SPI_NONE;
boardConfiguration->max31855spiDevice = SPI_NONE;

View File

@ -177,7 +177,7 @@ void setBoardConfigurationOverrides(void) {
boardConfiguration->digitalPotentiometerChipSelect[1] = GPIO_UNASSIGNED;
boardConfiguration->digitalPotentiometerChipSelect[2] = GPIO_UNASSIGNED;
boardConfiguration->digitalPotentiometerChipSelect[3] = GPIO_UNASSIGNED;
boardConfiguration->vehicleSpeedSensorInputPin = GPIO_UNASSIGNED;
engineConfiguration->vehicleSpeedSensorInputPin = GPIO_UNASSIGNED;
boardConfiguration->digitalPotentiometerSpiDevice = SPI_NONE;
boardConfiguration->max31855spiDevice = SPI_NONE;

View File

@ -119,8 +119,8 @@ void setBmwE34(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
boardConfiguration->triggerErrorPin = GPIO_UNASSIGNED;
// clutch up
boardConfiguration->clutchUpPin = GPIOD_3;
boardConfiguration->clutchUpPinMode = PI_PULLUP;
engineConfiguration->clutchUpPin = GPIOD_3;
engineConfiguration->clutchUpPinMode = PI_PULLUP;
// fuel pump
boardConfiguration->fuelPumpPin = GPIOD_4;

View File

@ -201,7 +201,7 @@ void setCitroenBerlingoTU3JPConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
/**
* Speed Sensor
*/
boardConfiguration->vehicleSpeedSensorInputPin = GPIOA_8;
engineConfiguration->vehicleSpeedSensorInputPin = GPIOA_8;
/**
* Other
*/

View File

@ -434,8 +434,8 @@ void setDodgeNeonNGCEngineConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
boardConfiguration->clutchDownPin = GPIOC_12;
boardConfiguration->clutchDownPinMode = PI_PULLUP;
// boardConfiguration->clutchUpPin = GPIOA_14; // note SWCLK - conflict with SWD
boardConfiguration->clutchUpPinMode = PI_PULLUP;
// engineConfiguration->clutchUpPin = GPIOA_14; // note SWCLK - conflict with SWD
engineConfiguration->clutchUpPinMode = PI_PULLUP;
engineConfiguration->activateAuxPid1 = 1;
engineConfiguration->auxPidPins[0] = GPIOD_5; // playing with AUX PID for alternator
@ -456,7 +456,7 @@ void setDodgeNeonNGCEngineConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
// setFsioExt(0, GPIOE_5, "0 fsio_setting", 400 PASS_CONFIG_PARAMETER_SUFFIX);
#endif
boardConfiguration->vehicleSpeedSensorInputPin = GPIOA_8;
engineConfiguration->vehicleSpeedSensorInputPin = GPIOA_8;
engineConfiguration->fanOnTemperature = 92;
engineConfiguration->fanOffTemperature = 89;

View File

@ -304,7 +304,7 @@ void setMazdaMiata2003EngineConfiguration(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
boardConfiguration->alternatorControlPin = GPIOE_10;
boardConfiguration->alternatorControlPinMode = OM_OPENDRAIN;
// boardConfiguration->vehicleSpeedSensorInputPin = GPIOA_8;
// engineConfiguration->vehicleSpeedSensorInputPin = GPIOA_8;
boardConfiguration->vvtCamSensorUseRise = true;

View File

@ -117,7 +117,7 @@ void vag_18_Turbo(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
boardConfiguration->triggerInputPins[0] = GPIOG_7;
#endif /* STM32_HAS_GPIOF */
#if defined(STM32_HAS_GPIOF) && STM32_HAS_GPIOF
boardConfiguration->vehicleSpeedSensorInputPin = GPIOF_14;
engineConfiguration->vehicleSpeedSensorInputPin = GPIOF_14;
#endif /* STM32_HAS_GPIOF */

View File

@ -88,7 +88,7 @@ void setRoverv8(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
boardConfiguration->injectionPins[6] = GPIOE_2; // Frankenstein: low side - out #7
boardConfiguration->injectionPins[7] = GPIOE_3; // Frankenstein: low side - out #8
// not valid ICU pin boardConfiguration->vehicleSpeedSensorInputPin = GPIOC_2;
// not valid ICU pin engineConfiguration->vehicleSpeedSensorInputPin = GPIOC_2;
//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

View File

@ -89,7 +89,7 @@ void setSachs(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
setLinearCurve(config->afrRpmBins, 15000, 7000, 1);
engineConfiguration->hasFrequencyReportingMapSensor = true;
boardConfiguration->frequencyReportingMapInputPin = GPIOC_6;
engineConfiguration->frequencyReportingMapInputPin = GPIOC_6;
boardConfiguration->mapFrequency100Kpa = 159;
boardConfiguration->mapFrequency0Kpa = 80;
}

View File

@ -348,8 +348,8 @@ static percent_t automaticIdleController(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
}
engine->acSwitchState = result;
}
if (CONFIGB(clutchUpPin) != GPIO_UNASSIGNED) {
engine->clutchUpState = efiReadPin(CONFIGB(clutchUpPin));
if (CONFIG(clutchUpPin) != GPIO_UNASSIGNED) {
engine->clutchUpState = efiReadPin(CONFIG(clutchUpPin));
}
if (CONFIG(throttlePedalUpPin) != GPIO_UNASSIGNED) {
engine->engineState.idle.throttlePedalUpState = efiReadPin(CONFIG(throttlePedalUpPin));
@ -642,9 +642,9 @@ void startIdleThread(Logging*sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX) {
getInputMode(CONFIGB(clutchDownPinMode)));
}
if (CONFIGB(clutchUpPin) != GPIO_UNASSIGNED) {
efiSetPadMode("clutch up switch", CONFIGB(clutchUpPin),
getInputMode(CONFIGB(clutchUpPinMode)));
if (CONFIG(clutchUpPin) != GPIO_UNASSIGNED) {
efiSetPadMode("clutch up switch", CONFIG(clutchUpPin),
getInputMode(CONFIG(clutchUpPinMode)));
}
if (CONFIG(throttlePedalUpPin) != GPIO_UNASSIGNED) {

View File

@ -321,7 +321,7 @@ void prepareVoidConfiguration(engine_configuration_s *engineConfiguration) {
engineConfiguration->high_fuel_pressure_sensor_2 = EFI_ADC_NONE;
boardConfiguration->clutchDownPinMode = PI_PULLUP;
boardConfiguration->clutchUpPinMode = PI_PULLUP;
engineConfiguration->clutchUpPinMode = PI_PULLUP;
engineConfiguration->brakePedalPinMode = PI_PULLUP;
}
@ -608,7 +608,7 @@ static void setDefaultEngineConfiguration(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
setDefaultEtbBiasCurve(PASS_CONFIG_PARAMETER_SIGNATURE);
#endif /* EFI_ELECTRONIC_THROTTLE_BODY */
CONFIGB(mafSensorType) = Bosch0280218037;
CONFIG(mafSensorType) = Bosch0280218037;
setBosch0280218037(config);
setBosch02880155868(PASS_ENGINE_PARAMETER_SIGNATURE);

View File

@ -195,7 +195,7 @@ static void setFsioDigitalInputPin(const char *indexStr, const char *pinName) {
scheduleMsg(logger, "invalid pin name [%s]", pinName);
return;
}
CONFIGB(fsioDigitalInputs)[index] = pin;
CONFIG(fsioDigitalInputs)[index] = pin;
scheduleMsg(logger, "FSIO digital input pin #%d [%s]", (index + 1), hwPortname(pin));
}
@ -586,7 +586,7 @@ static void showFsioInfo(void) {
}
}
for (int i = 0; i < FSIO_COMMAND_COUNT; i++) {
brain_pin_e inputPin = CONFIGB(fsioDigitalInputs)[i];
brain_pin_e inputPin = CONFIG(fsioDigitalInputs)[i];
if (inputPin != GPIO_UNASSIGNED) {
scheduleMsg(logger, "FSIO digital input #%d: %s", i, hwPortname(inputPin));
}
@ -697,7 +697,7 @@ void initFsioImpl(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX) {
}
for (int i = 0; i < FSIO_COMMAND_COUNT; i++) {
brain_pin_e inputPin = CONFIGB(fsioDigitalInputs)[i];
brain_pin_e inputPin = CONFIG(fsioDigitalInputs)[i];
if (inputPin != GPIO_UNASSIGNED) {
efiSetPadMode("FSIO input", inputPin, getInputMode(engineConfiguration->fsioInputModes[i]));

View File

@ -225,7 +225,7 @@ static void printMAPInfo(void) {
if (engineConfiguration->hasFrequencyReportingMapSensor) {
scheduleMsg(logger, "instant value=%.2fHz @ %s", mapFreq, hwPortname(CONFIGB(frequencyReportingMapInputPin)));
scheduleMsg(logger, "instant value=%.2fHz @ %s", mapFreq, hwPortname(CONFIG(frequencyReportingMapInputPin)));
} else {
scheduleMsg(logger, "map type=%d/%s MAP=%.2fkPa mapMinBufferLength=%d", engineConfiguration->map.sensor.type,
getAir_pressure_sensor_type_e(engineConfiguration->map.sensor.type),
@ -268,14 +268,14 @@ void initMapDecoder(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX) {
if (engineConfiguration->hasFrequencyReportingMapSensor) {
#if HAL_USE_ICU
digital_input_s* digitalMapInput = startDigitalCapture("MAP freq", CONFIGB(frequencyReportingMapInputPin), true);
digital_input_s* digitalMapInput = startDigitalCapture("MAP freq", CONFIG(frequencyReportingMapInputPin), true);
digitalMapInput->setWidthCallback((VoidInt) digitalMapWidthCallback, NULL);
#else
#if EFI_PROD_CODE
efiExtiEnablePin(
"Frequency MAP",
CONFIGB(frequencyReportingMapInputPin),
CONFIG(frequencyReportingMapInputPin),
PAL_EVENT_MODE_RISING_EDGE,
(palcallback_t)digitalMapWidthCallback,
nullptr

View File

@ -281,7 +281,7 @@ void printConfiguration(const engine_configuration_s *engineConfiguration) {
boolToString(engineConfiguration->isManualSpinningMode),
boolToString(engineConfiguration->isCylinderCleanupEnabled));
scheduleMsg(&logger, "clutchUp@%s: %s", hwPortname(boardConfiguration->clutchUpPin),
scheduleMsg(&logger, "clutchUp@%s: %s", hwPortname(engineConfiguration->clutchUpPin),
boolToString(engine->clutchUpState));
scheduleMsg(&logger, "clutchDown@%s: %s", hwPortname(boardConfiguration->clutchDownPin),
boolToString(engine->clutchDownState));

View File

@ -333,8 +333,8 @@ void applyNewHardwareSettings(void) {
stopHD44780_pins();
#endif /* #if EFI_HD44780_LCD */
if (isPinOrModeChanged(bc.clutchUpPin, bc.clutchUpPinMode))
brain_pin_markUnused(activeConfiguration.bc.clutchUpPin);
if (isPinOrModeChanged(clutchUpPin, clutchUpPinMode))
brain_pin_markUnused(activeConfiguration.clutchUpPin);
enginePins.unregisterPins();

View File

@ -52,7 +52,7 @@ static void vsAnaWidthCallback(void) {
static void speedInfo(void) {
scheduleMsg(logger, "VSS input at %s",
hwPortname(CONFIGB(vehicleSpeedSensorInputPin)));
hwPortname(CONFIG(vehicleSpeedSensorInputPin)));
scheduleMsg(logger, "c=%.2f eventCounter=%d speed=%.2f",
engineConfiguration->vehicleSpeedCoef,
@ -63,17 +63,17 @@ static void speedInfo(void) {
}
bool hasVehicleSpeedSensor() {
return CONFIGB(vehicleSpeedSensorInputPin) != GPIO_UNASSIGNED;
return CONFIG(vehicleSpeedSensorInputPin) != GPIO_UNASSIGNED;
}
void stopVSSPins(void) {
stopDigitalCapture("VSS", activeConfiguration.bc.vehicleSpeedSensorInputPin);
stopDigitalCapture("VSS", activeConfiguration.vehicleSpeedSensorInputPin);
}
void startVSSPins(void) {
if (!hasVehicleSpeedSensor())
return;
digital_input_s* vehicleSpeedInput = addWaveAnalyzerDriver("VSS", CONFIGB(vehicleSpeedSensorInputPin));
digital_input_s* vehicleSpeedInput = addWaveAnalyzerDriver("VSS", CONFIG(vehicleSpeedSensorInputPin));
startInputDriver("VSS", vehicleSpeedInput, true);
vehicleSpeedInput->widthListeners.registerCallback((VoidInt) vsAnaWidthCallback, NULL);
}

View File

@ -698,23 +698,27 @@ custom ego_sensor_e 4 bits, S32, @OFFSET@, [0:2], @@ego_sensor_e_enum@@
#define maf_sensor_type_e_enum "v0", "v1", "v2", "v3"
custom maf_sensor_type_e 4 bits, S32, @OFFSET@, [0:2], @@maf_sensor_type_e_enum@@
maf_sensor_type_e mafSensorType;
! todo: keep moving all these fields at the end of board_configuration_s below 'board_configuration_s bc'
! end of board_configuration_s
end_struct
board_configuration_s bc;
maf_sensor_type_e mafSensorType;
custom le_formula_t 200 string, ASCII, @OFFSET@, 200
brain_pin_e[FSIO_COMMAND_COUNT iterate] fsioDigitalInputs;todo:not finished\nThese input pins allow us to pull toggle buttons state;
brain_input_pin_e vehicleSpeedSensorInputPin;
switch_input_pin_e clutchUpPin;Some vehicles have a switch to indicate that clutch pedal is all the way up
brain_input_pin_e frequencyReportingMapInputPin;
pin_input_mode_e clutchUpPinMode;
float etbIdleRange;;"angle", 1, 0, -100, 100, 2
bit clutchUpPinInverted
bit clutchDownPinInverted
int[121] unusedAtBoardConfigurationEnd;
end_struct
custom le_formula_t 200 string, ASCII, @OFFSET@, 200
board_configuration_s bc;
bit vvtDisplayInverted
float unused
bit todoClutchUpPinInverted
bit todoClutchDownPinInverted
int[121] unusedAtOldBoardConfigurationEnd;
bit vvtDisplayInverted
bit fuelClosedLoopCorrectionEnabled;+Enables lambda sensor closed loop feedback for fuelling.
bit isVerboseIAC;+Print details into rusEfi console
bit isVerboseETB;+Prints ETB details to rusEFI console
@ -1085,6 +1089,7 @@ uint8_t[4] unusuedsw;
int[565] mainUnusedEnd;
! end of engine_configuration_s
end_struct
engine_configuration_s engineConfiguration;

View File

@ -1,6 +1,6 @@
package com.rusefi.config.generated;
// this file was generated automatically by rusEfi tool ConfigDefinition.jar based on integration\rusefi_config.txt Fri Nov 29 21:56:48 EST 2019
// this file was generated automatically by rusEfi tool ConfigDefinition.jar based on integration\rusefi_config.txt Sat Nov 30 10:03:19 EST 2019
// by class com.rusefi.output.FileJavaFieldsConsumer
import com.rusefi.config.*;
@ -233,10 +233,8 @@ public class Fields {
public static final int cltTimingExtra_offset_hex = 950;
public static final int clutchDownPin_offset = 664;
public static final int clutchDownPin_offset_hex = 298;
public static final int clutchDownPinInverted_offset = 976;
public static final int clutchDownPinMode_offset = 667;
public static final int clutchUpPin_offset = 969;
public static final int clutchUpPinInverted_offset = 976;
public static final int clutchUpPinMode_offset = 971;
public static final String CMD_CALIBRATE_PEDAL_DOWN = "calibrate_pedal_down";
public static final String CMD_CALIBRATE_PEDAL_UP = "calibrate_pedal_up";
@ -365,7 +363,6 @@ public class Fields {
public static final int etbCalibrationOnStart_offset = 1476;
public static final int etbDeadband_offset = 3960;
public static final int etbFreq_offset = 2514;
public static final int etbIdleRange_offset = 972;
public static final int etbIdleThrottleRange_offset = 4012;
public static final int etbNeutralPosition_offset = 1471;
public static final int externalKnockSenseAdc_offset = 3103;
@ -1180,6 +1177,8 @@ public class Fields {
public static final int tle8888_cs_offset = 3105;
public static final int tle8888_csPinMode_offset = 3106;
public static final int tle8888spiDevice_offset = 4000;
public static final int todoClutchDownPinInverted_offset = 976;
public static final int todoClutchUpPinInverted_offset = 976;
public static final String TOP_DEAD_CENTER_MESSAGE = "r";
public static final int TOTAL_CONFIG_SIZE = 20000;
public static final int tps1_1AdcChannel_offset = 512;
@ -1256,8 +1255,9 @@ public class Fields {
public static final int unused_board_984_31_offset = 744;
public static final int unused_former_warmup_target_afr_offset = 2096;
public static final int unused_former_warmup_target_afr_offset_hex = 830;
public static final int unused_offset = 972;
public static final int unusedAnotherOne_offset = 744;
public static final int unusedAtBoardConfigurationEnd_offset = 980;
public static final int unusedAtOldBoardConfigurationEnd_offset = 980;
public static final int unusedErrorPin_offset = 2040;
public static final int unusedFlexFuelSensor_offset = 3100;
public static final int unusedFormerWarmupAfrPid_offset = 1768;
@ -1740,9 +1740,9 @@ public class Fields {
public static final Field CLUTCHUPPIN = Field.create("CLUTCHUPPIN", 969, FieldType.INT8, switch_input_pin_e);
public static final Field FREQUENCYREPORTINGMAPINPUTPIN = Field.create("FREQUENCYREPORTINGMAPINPUTPIN", 970, FieldType.INT8, brain_input_pin_e);
public static final Field CLUTCHUPPINMODE = Field.create("CLUTCHUPPINMODE", 971, FieldType.INT8);
public static final Field ETBIDLERANGE = Field.create("ETBIDLERANGE", 972, FieldType.FLOAT);
public static final Field CLUTCHUPPININVERTED = Field.create("CLUTCHUPPININVERTED", 976, FieldType.BIT, 0);
public static final Field CLUTCHDOWNPININVERTED = Field.create("CLUTCHDOWNPININVERTED", 976, FieldType.BIT, 1);
public static final Field UNUSED = Field.create("UNUSED", 972, FieldType.FLOAT);
public static final Field TODOCLUTCHUPPININVERTED = Field.create("TODOCLUTCHUPPININVERTED", 976, FieldType.BIT, 0);
public static final Field TODOCLUTCHDOWNPININVERTED = Field.create("TODOCLUTCHDOWNPININVERTED", 976, FieldType.BIT, 1);
public static final Field VVTDISPLAYINVERTED = Field.create("VVTDISPLAYINVERTED", 1464, FieldType.BIT, 0);
public static final Field FUELCLOSEDLOOPCORRECTIONENABLED = Field.create("FUELCLOSEDLOOPCORRECTIONENABLED", 1464, FieldType.BIT, 1);
public static final Field ISVERBOSEIAC = Field.create("ISVERBOSEIAC", 1464, FieldType.BIT, 2);
@ -2539,9 +2539,9 @@ public class Fields {
CLUTCHUPPIN,
FREQUENCYREPORTINGMAPINPUTPIN,
CLUTCHUPPINMODE,
ETBIDLERANGE,
CLUTCHUPPININVERTED,
CLUTCHDOWNPININVERTED,
UNUSED,
TODOCLUTCHUPPININVERTED,
TODOCLUTCHDOWNPININVERTED,
VVTDISPLAYINVERTED,
FUELCLOSEDLOOPCORRECTIONENABLED,
ISVERBOSEIAC,