ETB target is using integer values #945

refactoring - ADC mocking is a mess
This commit is contained in:
rusefi 2019-09-22 10:02:07 -04:00
parent d0ee86b258
commit f600bbc6d7
11 changed files with 15 additions and 16 deletions

View File

@ -369,7 +369,7 @@ static void printSensors(Logging *log) {
if (engineConfiguration->fsioAdc[i] != EFI_ADC_NONE) {
strcpy(buf, "adcX");
buf[3] = '0' + i;
reportSensorF(log, buf, "", getVoltage("fsio", engineConfiguration->fsioAdc[i]), 2);
reportSensorF(log, buf, "", getVoltage("fsio", engineConfiguration->fsioAdc[i] PASS_ENGINE_PARAMETER_SUFFIX), 2);
}
}
@ -939,7 +939,7 @@ void updateTunerStudioState(TunerStudioOutputChannels *tsOutputChannels DECLARE_
// todo: implement a proper loop
if (engineConfiguration->fsioAdc[0] != EFI_ADC_NONE) {
strcpy(buf, "adcX");
tsOutputChannels->debugFloatField1 = getVoltage("fsio", engineConfiguration->fsioAdc[0]);
tsOutputChannels->debugFloatField1 = getVoltage("fsio", engineConfiguration->fsioAdc[0] PASS_ENGINE_PARAMETER_SUFFIX);
}
break;
case DBG_FSIO_EXPRESSION:
@ -991,7 +991,7 @@ void updateTunerStudioState(TunerStudioOutputChannels *tsOutputChannels DECLARE_
tsOutputChannels->debugFloatField7 = (engineConfiguration->afr.hwChannel != EFI_ADC_NONE) ? getVoltageDivided("ego", engineConfiguration->afr.hwChannel PASS_ENGINE_PARAMETER_SUFFIX) : 0.0f;
break;
case DBG_ANALOG_INPUTS2:
tsOutputChannels->debugFloatField4 = getVoltage("debug", engineConfiguration->throttlePedalPositionAdcChannel);
tsOutputChannels->debugFloatField4 = getVoltage("debug", engineConfiguration->throttlePedalPositionAdcChannel PASS_ENGINE_PARAMETER_SUFFIX);
break;
case DBG_INSTANT_RPM:
{

View File

@ -284,7 +284,7 @@ bool LECalculator::processElement(LEElement *element DECLARE_ENGINE_PARAMETER_SU
// todo: implement code for digital inout!!!
case LE_METHOD_FSIO_ANALOG_INPUT:
// todo: start taking index parameter!!!
push(element->action, getVoltage("fsio", engineConfiguration->fsioAdc[0]));
push(element->action, getVoltage("fsio", engineConfiguration->fsioAdc[0] PASS_ENGINE_PARAMETER_SUFFIX));
break;
case LE_METHOD_KNOCK:
push(element->action, engine->knockCount);

View File

@ -407,7 +407,7 @@ static void printAnalogChannelInfoExt(const char *name, adc_channel_e hwChannel,
static void printAnalogChannelInfo(const char *name, adc_channel_e hwChannel) {
#if HAL_USE_ADC
printAnalogChannelInfoExt(name, hwChannel, getVoltage("print", hwChannel), engineConfiguration->analogInputDividerCoefficient);
printAnalogChannelInfoExt(name, hwChannel, getVoltage("print", hwChannel PASS_ENGINE_PARAMETER_SUFFIX), engineConfiguration->analogInputDividerCoefficient);
#endif
}
@ -449,7 +449,7 @@ static void printAnalogInfo(void) {
printAnalogChannelInfo("A/C sw", engineConfiguration->acSwitchAdc);
printAnalogChannelInfo("HIP9011", engineConfiguration->hipOutputChannel);
printAnalogChannelInfoExt("Vbatt", engineConfiguration->vbattAdcChannel, getVoltage("vbatt", engineConfiguration->vbattAdcChannel),
printAnalogChannelInfoExt("Vbatt", engineConfiguration->vbattAdcChannel, getVoltage("vbatt", engineConfiguration->vbattAdcChannel PASS_ENGINE_PARAMETER_SUFFIX),
engineConfiguration->vbattDividerCoeff);
}

View File

@ -232,7 +232,7 @@ static void printMAPInfo(void) {
adc_channel_e mapAdc = engineConfiguration->map.sensor.hwChannel;
static char pinNameBuffer[16];
scheduleMsg(logger, "MAP %.2fv @%s", getVoltage("mapinfo", mapAdc),
scheduleMsg(logger, "MAP %.2fv @%s", getVoltage("mapinfo", mapAdc PASS_ENGINE_PARAMETER_SUFFIX),
getPinNameByAdcChannel("map", mapAdc, pinNameBuffer));
if (engineConfiguration->map.sensor.type == MT_CUSTOM) {
scheduleMsg(logger, "at %.2fv=%.2f at %.2fv=%.2f",

View File

@ -83,7 +83,7 @@ temperature_t getTemperatureC(ThermistorConf *cfg, ThermistorMath *tm, bool useL
tm->setConfig(&cfg->config); // implementation checks if configuration has changed or not
DISPLAY_TEXT(Analog_MCU_reads);
tm->DISPLAY_FIELD(voltageMCU) = DISPLAY_TEXT(from_pin) getVoltage("term", cfg->DISPLAY_CONFIG(adcChannel));
tm->DISPLAY_FIELD(voltageMCU) = DISPLAY_TEXT(from_pin) getVoltage("term", cfg->DISPLAY_CONFIG(adcChannel) PASS_ENGINE_PARAMETER_SUFFIX);
DISPLAY_TEXT(EOL);
DISPLAY_TEXT(Analog_ECU_reads);

View File

@ -24,5 +24,5 @@ bool hasVBatt(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
}
float getVBatt(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
return getVoltage("vbatt", engineConfiguration->vbattAdcChannel) * engineConfiguration->vbattDividerCoeff;
return getVoltage("vbatt", engineConfiguration->vbattAdcChannel PASS_ENGINE_PARAMETER_SUFFIX) * engineConfiguration->vbattDividerCoeff;
}

View File

@ -50,7 +50,7 @@ EXTERN_ENGINE;
// Board voltage, with divider coefficient accounted for
float getVoltageDivided(const char *msg, adc_channel_e hwChannel DECLARE_ENGINE_PARAMETER_SUFFIX) {
return getVoltage(msg, hwChannel) * engineConfiguration->analogInputDividerCoefficient;
return getVoltage(msg, hwChannel PASS_ENGINE_PARAMETER_SUFFIX) * engineConfiguration->analogInputDividerCoefficient;
}
AdcDevice::AdcDevice(ADCConversionGroup* hwConfig) {

View File

@ -4,7 +4,6 @@
#include "global.h"
#include "converter_sensor.h"
#include "rusefi_hw_enums.h"
class AdcSubscription {
public:

View File

@ -111,7 +111,7 @@ static float getUr() {
#if EFI_PROD_CODE
if (!engineConfiguration->cj125isUrDivided) {
// in case of directly connected Ur signal from CJ125 to the ADC pin of MCU
return getVoltage("cj125ur", CONFIG(cj125ur));
return getVoltage("cj125ur", CONFIG(cj125ur) PASS_ENGINE_PARAMETER_SUFFIX);
} else {
// if a standard voltage division scheme with OpAmp is used
return getVoltageDivided("cj125ur", CONFIG(cj125ur) PASS_ENGINE_PARAMETER_SUFFIX);

View File

@ -23,11 +23,11 @@ float getVoltageDivided(const char *msg, adc_channel_e channel DECLARE_ENGINE_PA
return 0;
}
float getVoltage(const char *msg, int channel) {
float getVoltage(const char *msg, adc_channel_e channel DECLARE_ENGINE_PARAMETER_SUFFIX) {
return 0;
}
int getAdcValue(const char *msg, int channel) {
int getAdcValue(const char *msg, adc_channel_e channel) {
return 0;
}

View File

@ -13,7 +13,7 @@
#define ADC_CHANNEL_VREF 0
float getVoltageDivided(const char *msg, adc_channel_e channel DECLARE_ENGINE_PARAMETER_SUFFIX);
float getVoltage(const char *msg, int channel);
int getAdcValue(const char *msg, int channel);
float getVoltage(const char *msg, adc_channel_e channel DECLARE_ENGINE_PARAMETER_SUFFIX);
int getAdcValue(const char *msg, adc_channel_e channel);
#endif /* BOARDS_H_ */