auto-sync

This commit is contained in:
rusEfi 2015-04-25 21:12:30 -04:00
parent d3065688cd
commit b03cb58454
12 changed files with 38 additions and 83 deletions

View File

@ -34,21 +34,14 @@ void setCustomEngineConfiguration(DECLARE_ENGINE_PARAMETER_F) {
* Frankenso analog #11 PC5 ADC15
* Frankenso analog #12 PC4 ADC14 VBatt
*/
boardConfiguration->adcHwChannelEnabled[2] = ADC_FAST;
engineConfiguration->tpsAdcChannel = EFI_ADC_2;
boardConfiguration->adcHwChannelEnabled[0] = ADC_FAST;
engineConfiguration->map.sensor.hwChannel = EFI_ADC_0;
boardConfiguration->adcHwChannelEnabled[4] = ADC_SLOW;
engineConfiguration->cltAdcChannel = EFI_ADC_12;
engineConfiguration->iatAdcChannel = EFI_ADC_11;
engineConfiguration->afr.hwChannel = EFI_ADC_13;
boardConfiguration->adcHwChannelEnabled[14] = ADC_SLOW;
engineConfiguration->vbattAdcChannel = EFI_ADC_14;
setCommonNTCSensor(&engineConfiguration->clt);
engineConfiguration->clt.bias_resistor = 2700;
setCommonNTCSensor(&engineConfiguration->iat);

View File

@ -318,27 +318,6 @@ void setDodgeNeonNGCEngineConfiguration(DECLARE_ENGINE_PARAMETER_F) {
*/
engineConfiguration->map.sensor.hwChannel = EFI_ADC_6;
boardConfiguration->adcHwChannelEnabled[0] = ADC_SLOW; // ADC0 - PA0
boardConfiguration->adcHwChannelEnabled[1] = ADC_SLOW; // just for test
boardConfiguration->adcHwChannelEnabled[2] = ADC_SLOW; // just for test
boardConfiguration->adcHwChannelEnabled[3] = ADC_SLOW; // just for test
boardConfiguration->adcHwChannelEnabled[4] = ADC_SLOW;
boardConfiguration->adcHwChannelEnabled[5] = ADC_OFF;
boardConfiguration->adcHwChannelEnabled[6] = ADC_FAST;
boardConfiguration->adcHwChannelEnabled[7] = ADC_SLOW; // just for test
boardConfiguration->adcHwChannelEnabled[8] = ADC_OFF;
boardConfiguration->adcHwChannelEnabled[9] = ADC_OFF;
boardConfiguration->adcHwChannelEnabled[10] = ADC_OFF;
boardConfiguration->adcHwChannelEnabled[11] = ADC_SLOW; // IAT
boardConfiguration->adcHwChannelEnabled[12] = ADC_SLOW; // CLT
boardConfiguration->adcHwChannelEnabled[13] = ADC_SLOW; // AFR
boardConfiguration->adcHwChannelEnabled[14] = ADC_SLOW; // VBatt
boardConfiguration->adcHwChannelEnabled[15] = ADC_FAST; // TPS
/**
* TPS
*/

View File

@ -68,17 +68,6 @@ void setFordInline6(DECLARE_ENGINE_PARAMETER_F) {
// input channel 10 is PC3, that's ADC13
// input channel 12 is PC1, that's ADC11
memset(boardConfiguration->adcHwChannelEnabled, 0, sizeof(boardConfiguration->adcHwChannelEnabled));
boardConfiguration->adcHwChannelEnabled[1] = ADC_SLOW;
boardConfiguration->adcHwChannelEnabled[2] = ADC_SLOW;
boardConfiguration->adcHwChannelEnabled[3] = ADC_SLOW;
boardConfiguration->adcHwChannelEnabled[4] = ADC_SLOW;
boardConfiguration->adcHwChannelEnabled[7] = ADC_SLOW;
boardConfiguration->adcHwChannelEnabled[11] = ADC_SLOW;
boardConfiguration->adcHwChannelEnabled[15] = ADC_FAST;
engineConfiguration->tpsAdcChannel = EFI_ADC_4;
engineConfiguration->iatAdcChannel = EFI_ADC_2;
engineConfiguration->cltAdcChannel = EFI_ADC_1;

View File

@ -96,18 +96,6 @@ static void setHondaAccordConfigurationCommon(DECLARE_ENGINE_PARAMETER_F) {
* Inp6/ADC1 PA1: TPS
* Inp12/ADC14 PC4: VBatt
*/
memset(boardConfiguration->adcHwChannelEnabled, 0, sizeof(boardConfiguration->adcHwChannelEnabled));
boardConfiguration->adcHwChannelEnabled[0] = ADC_FAST; // ADC0 - PA0 - MAP
boardConfiguration->adcHwChannelEnabled[1] = ADC_SLOW; // TPS
boardConfiguration->adcHwChannelEnabled[2] = ADC_SLOW;
boardConfiguration->adcHwChannelEnabled[3] = ADC_SLOW;
boardConfiguration->adcHwChannelEnabled[4] = ADC_SLOW;
boardConfiguration->adcHwChannelEnabled[6] = ADC_SLOW;
boardConfiguration->adcHwChannelEnabled[11] = ADC_SLOW; // IAT
boardConfiguration->adcHwChannelEnabled[12] = ADC_SLOW; // CLT
boardConfiguration->adcHwChannelEnabled[13] = ADC_SLOW; // AFR
boardConfiguration->adcHwChannelEnabled[14] = ADC_SLOW; // VBatt
/**
* D14/W10 O2 Sensor

View File

@ -528,23 +528,6 @@ void setDefaultConfiguration(DECLARE_ENGINE_PARAMETER_F) {
boardConfiguration->gps_rx_pin = GPIOB_7;
boardConfiguration->gps_tx_pin = GPIOB_6;
memset(boardConfiguration->adcHwChannelEnabled, 0, sizeof(boardConfiguration->adcHwChannelEnabled));
boardConfiguration->adcHwChannelEnabled[0] = ADC_SLOW;
boardConfiguration->adcHwChannelEnabled[1] = ADC_SLOW;
boardConfiguration->adcHwChannelEnabled[2] = ADC_SLOW;
boardConfiguration->adcHwChannelEnabled[3] = ADC_FAST;
engineConfiguration->tpsAdcChannel = EFI_ADC_3;
boardConfiguration->adcHwChannelEnabled[4] = ADC_FAST;
// boardConfiguration->adcHwChannelEnabled[5] = ADC_SLOW; PA5 is also timer input
boardConfiguration->adcHwChannelEnabled[6] = ADC_SLOW;
boardConfiguration->adcHwChannelEnabled[7] = ADC_SLOW;
boardConfiguration->adcHwChannelEnabled[11] = ADC_SLOW;
boardConfiguration->adcHwChannelEnabled[12] = ADC_SLOW;
boardConfiguration->adcHwChannelEnabled[13] = ADC_SLOW;
boardConfiguration->adcHwChannelEnabled[14] = ADC_SLOW;
boardConfiguration->triggerInputPins[0] = GPIOC_6;
boardConfiguration->triggerInputPins[1] = GPIOA_5;
boardConfiguration->logicAnalyzerPins[0] = GPIO_UNASSIGNED;
@ -805,7 +788,6 @@ void commonFrankensoAnalogInputs(engine_configuration_s *engineConfiguration) {
* VBatt
*/
engineConfiguration->vbattAdcChannel = EFI_ADC_14;
engineConfiguration->bc.adcHwChannelEnabled[14] = ADC_SLOW;
}
void setFrankenso0_1_joystick(engine_configuration_s *engineConfiguration) {

View File

@ -1,4 +1,4 @@
// this section was generated by config_definition.jar on Thu Apr 23 17:29:25 EDT 2015
// this section was generated by config_definition.jar on Sat Apr 25 18:11:41 EDT 2015
// begin
#include "rusefi_types.h"
typedef struct {
@ -372,7 +372,7 @@ typedef struct {
/**
* offset 232
*/
adc_channel_mode_e adcHwChannelEnabled[HW_MAX_ADC_INDEX];
adc_channel_mode_e unusedADC[HW_MAX_ADC_INDEX];
/**
* offset 296
*/
@ -1289,4 +1289,4 @@ typedef struct {
} persistent_config_s;
// end
// this section was generated by config_definition.jar on Thu Apr 23 17:29:25 EDT 2015
// this section was generated by config_definition.jar on Sat Apr 25 18:11:41 EDT 2015

View File

@ -88,11 +88,10 @@ int getTPS10bitAdc(DECLARE_ENGINE_PARAMETER_F) {
if(engineConfiguration->tpsAdcChannel==EFI_ADC_NONE)
return -1;
#if EFI_PROD_CODE
if(boardConfiguration->adcHwChannelEnabled[engineConfiguration->tpsAdcChannel]==ADC_FAST)
return tpsFastAdc / 4;
return tpsFastAdc / 4;
#else
return 0;
#endif /* EFI_PROD_CODE */
int adc = getAdcValue(engineConfiguration->tpsAdcChannel);
return (int) adc / 4; // Only for TunerStudio compatibility. Max TS adc value in 1023
}
/**

View File

@ -135,7 +135,6 @@ void setHip9011FrankensoPinout(void) {
boardConfiguration->hip9011Gain = 0.1;
engineConfiguration->hipThreshold = 2;
boardConfiguration->adcHwChannelEnabled[10] = ADC_FAST; // HIP9011
engineConfiguration->hipOutputChannel = EFI_ADC_10;
}

View File

@ -19,6 +19,8 @@
#include "engine_math.h"
#include "board_test.h"
static adc_channel_mode_e adcHwChannelEnabled[HW_MAX_ADC_INDEX];
AdcDevice::AdcDevice(ADCConversionGroup* hwConfig) {
this->hwConfig = hwConfig;
channelCount = 0;
@ -191,11 +193,11 @@ int getInternalAdcValue(adc_channel_e hwChannel) {
return -1;
}
if (boardConfiguration->adcHwChannelEnabled[hwChannel] == ADC_FAST) {
if (adcHwChannelEnabled[hwChannel] == ADC_FAST) {
int internalIndex = fastAdc.internalAdcIndexByHardwareIndex[hwChannel];
return fastAdc.samples[internalIndex];
}
if (boardConfiguration->adcHwChannelEnabled[hwChannel] != ADC_SLOW) {
if (adcHwChannelEnabled[hwChannel] != ADC_SLOW) {
warning(OBD_PCM_Processor_Fault, "ADC is off %d", hwChannel);
}
@ -463,9 +465,33 @@ static void adc_callback_slow(ADCDriver *adcp, adcsample_t *buffer, size_t n) {
}
}
static void addChannel(adc_channel_e setting, adc_channel_mode_e mode) {
if (setting == EFI_ADC_NONE) {
return;
}
adcHwChannelEnabled[setting] = mode;
}
static void configureInputs(void) {
memset(adcHwChannelEnabled, 0, sizeof(adcHwChannelEnabled));
addChannel(engineConfiguration->tpsAdcChannel, ADC_FAST);
addChannel(engineConfiguration->map.sensor.hwChannel, ADC_FAST);
addChannel(engineConfiguration->mafAdcChannel, ADC_FAST);
addChannel(engineConfiguration->hipOutputChannel, ADC_FAST);
addChannel(engineConfiguration->vbattAdcChannel, ADC_SLOW);
addChannel(engineConfiguration->cltAdcChannel, ADC_SLOW);
addChannel(engineConfiguration->iatAdcChannel, ADC_SLOW);
addChannel(engineConfiguration->afr.hwChannel, ADC_SLOW);
}
void initAdcInputs(bool boardTestMode) {
printMsg(&logger, "initAdcInputs()");
configureInputs();
printStatus();
addConsoleActionI("adcDebug", &setAdcDebugReporting);
@ -478,7 +504,7 @@ void initAdcInputs(bool boardTestMode) {
adcStart(&ADC_FAST_DEVICE, NULL);
for (int adc = 0; adc < HW_MAX_ADC_INDEX; adc++) {
adc_channel_mode_e mode = boardConfiguration->adcHwChannelEnabled[adc];
adc_channel_mode_e mode = adcHwChannelEnabled[adc];
/**
* in board test mode all currently enabled ADC channels are running in slow mode

View File

@ -179,7 +179,7 @@ static void calcFastAdcIndexes(void) {
hipSampleIndex =
engineConfiguration->hipOutputChannel == EFI_ADC_NONE ?
-1 : fastAdc.internalAdcIndexByHardwareIndex[engineConfiguration->hipOutputChannel];
if(engineConfiguration->tpsAdcChannel!=EFI_ADC_NONE && boardConfiguration->adcHwChannelEnabled[engineConfiguration->tpsAdcChannel]==ADC_FAST) {
if (engineConfiguration->tpsAdcChannel != EFI_ADC_NONE) {
tpsSampleIndex = fastAdc.internalAdcIndexByHardwareIndex[engineConfiguration->tpsAdcChannel];
} else {
tpsSampleIndex = TPS_IS_SLOW;

View File

@ -307,7 +307,7 @@ spi_device_e digitalPotentiometerSpiDevice;Digital Potentiometer is used by stoc
brain_pin_e[DIGIPOT_COUNT iterate] digitalPotentiometerChipSelect;
custom adc_channel_mode_e 4 bits, U32, @OFFSET@, [0:1], "Off", "Slow", "Fast", "INVALID"
adc_channel_mode_e[HW_MAX_ADC_INDEX iterate] adcHwChannelEnabled;
adc_channel_mode_e[HW_MAX_ADC_INDEX iterate] unusedADC;
brain_input_pin_e[3 iterate] triggerInputPins;

View File

@ -290,5 +290,5 @@ int getRusEfiVersion(void) {
return 123; // this is here to make the compiler happy about the unused array
if (UNUSED_CCM_SIZE[0] * 0 != 0)
return 3211; // this is here to make the compiler happy about the unused array
return 20150423;
return 20150425;
}