Merge remote-tracking branch 'origin/Hellen_fork_point' into master

# Conflicts:
#	firmware/controllers/algo/engine_configuration.cpp
This commit is contained in:
rusefi 2020-09-07 15:55:43 -04:00
commit 9bea1190a4
2 changed files with 41 additions and 4 deletions

View File

@ -309,9 +309,44 @@ void prepareVoidConfiguration(engine_configuration_s *engineConfiguration) {
efiAssertVoid(OBD_PCM_Processor_Fault, engineConfiguration != NULL, "ec NULL");
memset(engineConfiguration, 0, sizeof(engine_configuration_s));
// 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
for (int i = 0; i < FSIO_ANALOG_INPUT_COUNT ; i++) {
engineConfiguration->fsioAdc[i] = EFI_ADC_NONE;
}
engineConfiguration->clt.adcChannel = EFI_ADC_NONE;
engineConfiguration->iat.adcChannel = EFI_ADC_NONE;
engineConfiguration->cj125ua = EFI_ADC_NONE;
engineConfiguration->cj125ur = EFI_ADC_NONE;
engineConfiguration->auxTempSensor1.adcChannel = EFI_ADC_NONE;
engineConfiguration->auxTempSensor2.adcChannel = EFI_ADC_NONE;
engineConfiguration->baroSensor.hwChannel = EFI_ADC_NONE;
engineConfiguration->throttlePedalPositionAdcChannel = EFI_ADC_NONE;
engineConfiguration->oilPressure.hwChannel = EFI_ADC_NONE;
engineConfiguration->vRefAdcChannel = EFI_ADC_NONE;
engineConfiguration->vbattAdcChannel = EFI_ADC_NONE;
engineConfiguration->map.sensor.hwChannel = EFI_ADC_NONE;
engineConfiguration->mafAdcChannel = EFI_ADC_NONE;
/* this breaks unit tests lovely TODO: fix this?
engineConfiguration->tps1_1AdcChannel = EFI_ADC_NONE;
*/
engineConfiguration->tps2_1AdcChannel = EFI_ADC_NONE;
engineConfiguration->auxFastSensor1_adcChannel = EFI_ADC_NONE;
engineConfiguration->acSwitchAdc = EFI_ADC_NONE;
engineConfiguration->externalKnockSenseAdc = EFI_ADC_NONE;
engineConfiguration->fuelLevelSensor = EFI_ADC_NONE;
engineConfiguration->hipOutputChannel = EFI_ADC_NONE;
engineConfiguration->afr.hwChannel = EFI_ADC_NONE;
engineConfiguration->high_fuel_pressure_sensor_1 = EFI_ADC_NONE;
engineConfiguration->high_fuel_pressure_sensor_2 = EFI_ADC_NONE;
engineConfiguration->clutchDownPinMode = PI_PULLUP;
engineConfiguration->clutchUpPinMode = PI_PULLUP;
engineConfiguration->brakePedalPinMode = PI_PULLUP;
}
void setDefaultBasePins(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
@ -661,7 +696,7 @@ void setDefaultGppwmParameters(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
for (size_t k = 0; k < efi::size(cfg.rpmBins); k++) {
cfg.table[j][k] = z;
}
}
for (size_t j = 0; j < efi::size(cfg.rpmBins); j++) {

View File

@ -9,7 +9,9 @@
#if HAL_USE_ADC
#ifndef ADC_MAX_CHANNELS_COUNT
#define ADC_MAX_CHANNELS_COUNT 16
#endif /* ADC_MAX_CHANNELS_COUNT */
// this structure contains one multi-channel ADC state snapshot
typedef struct {
@ -22,7 +24,7 @@ public:
void enableChannel(adc_channel_e hwChannelIndex);
void enableChannelAndPin(const char *msg, adc_channel_e hwChannelIndex);
adc_channel_e getAdcHardwareIndexByInternalIndex(int index) const;
int internalAdcIndexByHardwareIndex[20];
int internalAdcIndexByHardwareIndex[ADC_MAX_CHANNELS_COUNT + 4];
bool isHwUsed(adc_channel_e hwChannel) const;
int size() const;
void init(void);
@ -48,8 +50,8 @@ private:
/**
* Number of ADC channels in use
*/
adc_channel_e hardwareIndexByIndernalAdcIndex[20];
adc_channel_e hardwareIndexByIndernalAdcIndex[ADC_MAX_CHANNELS_COUNT + 4];
};
#endif /* HAL_USE_ADC */