From 0da68c55630f8ec6380540428320f7f1d2786487 Mon Sep 17 00:00:00 2001 From: rusEfi Date: Sat, 29 Nov 2014 18:03:27 -0600 Subject: [PATCH] auto-sync --- firmware/controllers/sensors/tps.cpp | 10 +++------- firmware/controllers/sensors/tps.h | 2 +- firmware/controllers/settings.cpp | 2 +- firmware/hw_layer/adc_inputs.cpp | 3 +++ 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/firmware/controllers/sensors/tps.cpp b/firmware/controllers/sensors/tps.cpp index b624442d5e..2cd794b4e5 100644 --- a/firmware/controllers/sensors/tps.cpp +++ b/firmware/controllers/sensors/tps.cpp @@ -6,8 +6,6 @@ #include "adc_inputs.h" #include "allsensors.h" -extern engine_configuration_s *engineConfiguration; - #if !EFI_PROD_CODE int mockTps; #endif @@ -54,7 +52,7 @@ float getTpsRateOfChange(void) { * Return current TPS position based on configured ADC levels, and adc * * */ -static float getTpsValue(engine_configuration_s *engineConfiguration, int adc) { +static float getTpsValue(int adc DECLARE_ENGINE_PARAMETER_S) { if (adc < engineConfiguration->tpsMin) { return 0.0f; } @@ -72,7 +70,7 @@ static float getTpsValue(engine_configuration_s *engineConfiguration, int adc) { /* * Return voltage on TPS AND channel * */ -float getTPSVoltage(void) { +float getTPSVoltage(DECLARE_ENGINE_PARAMETER_F) { return getVoltageDivided(engineConfiguration->tpsAdcChannel); } @@ -94,9 +92,7 @@ int getTPS10bitAdc(void) { * @brief Position on physical primary TPS */ static float getPrimatyRawTPS(DECLARE_ENGINE_PARAMETER_F) { - // blue, 1st board - /* PA7 - blue TP */ - float tpsValue = getTpsValue(engineConfiguration, getTPS10bitAdc()); + float tpsValue = getTpsValue(getTPS10bitAdc() PASS_ENGINE_PARAMETER); return tpsValue; } diff --git a/firmware/controllers/sensors/tps.h b/firmware/controllers/sensors/tps.h index 6ded79a02c..b9b9ca41bd 100644 --- a/firmware/controllers/sensors/tps.h +++ b/firmware/controllers/sensors/tps.h @@ -16,7 +16,7 @@ float getTPS(DECLARE_ENGINE_PARAMETER_F); int convertVoltageTo10bitADC(float voltage); int getTPS10bitAdc(void); -float getTPSVoltage(void); +float getTPSVoltage(DECLARE_ENGINE_PARAMETER_F); typedef struct { // time in systicks diff --git a/firmware/controllers/settings.cpp b/firmware/controllers/settings.cpp index d552bfe257..1a22ffa0cd 100644 --- a/firmware/controllers/settings.cpp +++ b/firmware/controllers/settings.cpp @@ -313,7 +313,7 @@ static void printTPSInfo(void) { int pin = getAdcChannelPin(engineConfiguration->tpsAdcChannel); scheduleMsg(&logger, "tps min %d/max %d v=%f @%s%d", engineConfiguration->tpsMin, engineConfiguration->tpsMax, - getTPSVoltage(), portname(port), pin); + getTPSVoltage(PASS_ENGINE_PARAMETER_F), portname(port), pin); #endif scheduleMsg(&logger, "current 10bit=%d value=%f rate=%f", getTPS10bitAdc(), getTPS(PASS_ENGINE_PARAMETER_F), getTpsRateOfChange()); diff --git a/firmware/hw_layer/adc_inputs.cpp b/firmware/hw_layer/adc_inputs.cpp index 67496bbc78..8d5b99a43f 100644 --- a/firmware/hw_layer/adc_inputs.cpp +++ b/firmware/hw_layer/adc_inputs.cpp @@ -203,6 +203,9 @@ static void pwmpcb_fast(PWMDriver *pwmp) { int getInternalAdcValue(adc_channel_e hwChannel) { if (boardConfiguration->adcHwChannelEnabled[hwChannel] == ADC_FAST) return fastAdcValue; + if (boardConfiguration->adcHwChannelEnabled[hwChannel] != ADC_SLOW) { + warning(OBD_PCM_Processor_Fault, "ADC is off %d", hwChannel); + } int internalIndex = slowAdc.internalAdcIndexByHardwareIndex[hwChannel]; return slowAdc.getAdcValueByIndex(internalIndex);