auto-sync
This commit is contained in:
parent
88388ce9fb
commit
0da68c5563
|
@ -6,8 +6,6 @@
|
||||||
#include "adc_inputs.h"
|
#include "adc_inputs.h"
|
||||||
#include "allsensors.h"
|
#include "allsensors.h"
|
||||||
|
|
||||||
extern engine_configuration_s *engineConfiguration;
|
|
||||||
|
|
||||||
#if !EFI_PROD_CODE
|
#if !EFI_PROD_CODE
|
||||||
int mockTps;
|
int mockTps;
|
||||||
#endif
|
#endif
|
||||||
|
@ -54,7 +52,7 @@ float getTpsRateOfChange(void) {
|
||||||
* Return current TPS position based on configured ADC levels, and adc
|
* 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) {
|
if (adc < engineConfiguration->tpsMin) {
|
||||||
return 0.0f;
|
return 0.0f;
|
||||||
}
|
}
|
||||||
|
@ -72,7 +70,7 @@ static float getTpsValue(engine_configuration_s *engineConfiguration, int adc) {
|
||||||
/*
|
/*
|
||||||
* Return voltage on TPS AND channel
|
* Return voltage on TPS AND channel
|
||||||
* */
|
* */
|
||||||
float getTPSVoltage(void) {
|
float getTPSVoltage(DECLARE_ENGINE_PARAMETER_F) {
|
||||||
return getVoltageDivided(engineConfiguration->tpsAdcChannel);
|
return getVoltageDivided(engineConfiguration->tpsAdcChannel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -94,9 +92,7 @@ int getTPS10bitAdc(void) {
|
||||||
* @brief Position on physical primary TPS
|
* @brief Position on physical primary TPS
|
||||||
*/
|
*/
|
||||||
static float getPrimatyRawTPS(DECLARE_ENGINE_PARAMETER_F) {
|
static float getPrimatyRawTPS(DECLARE_ENGINE_PARAMETER_F) {
|
||||||
// blue, 1st board
|
float tpsValue = getTpsValue(getTPS10bitAdc() PASS_ENGINE_PARAMETER);
|
||||||
/* PA7 - blue TP */
|
|
||||||
float tpsValue = getTpsValue(engineConfiguration, getTPS10bitAdc());
|
|
||||||
return tpsValue;
|
return tpsValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
float getTPS(DECLARE_ENGINE_PARAMETER_F);
|
float getTPS(DECLARE_ENGINE_PARAMETER_F);
|
||||||
int convertVoltageTo10bitADC(float voltage);
|
int convertVoltageTo10bitADC(float voltage);
|
||||||
int getTPS10bitAdc(void);
|
int getTPS10bitAdc(void);
|
||||||
float getTPSVoltage(void);
|
float getTPSVoltage(DECLARE_ENGINE_PARAMETER_F);
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
// time in systicks
|
// time in systicks
|
||||||
|
|
|
@ -313,7 +313,7 @@ static void printTPSInfo(void) {
|
||||||
int pin = getAdcChannelPin(engineConfiguration->tpsAdcChannel);
|
int pin = getAdcChannelPin(engineConfiguration->tpsAdcChannel);
|
||||||
|
|
||||||
scheduleMsg(&logger, "tps min %d/max %d v=%f @%s%d", engineConfiguration->tpsMin, engineConfiguration->tpsMax,
|
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
|
#endif
|
||||||
scheduleMsg(&logger, "current 10bit=%d value=%f rate=%f", getTPS10bitAdc(), getTPS(PASS_ENGINE_PARAMETER_F),
|
scheduleMsg(&logger, "current 10bit=%d value=%f rate=%f", getTPS10bitAdc(), getTPS(PASS_ENGINE_PARAMETER_F),
|
||||||
getTpsRateOfChange());
|
getTpsRateOfChange());
|
||||||
|
|
|
@ -203,6 +203,9 @@ static void pwmpcb_fast(PWMDriver *pwmp) {
|
||||||
int getInternalAdcValue(adc_channel_e hwChannel) {
|
int getInternalAdcValue(adc_channel_e hwChannel) {
|
||||||
if (boardConfiguration->adcHwChannelEnabled[hwChannel] == ADC_FAST)
|
if (boardConfiguration->adcHwChannelEnabled[hwChannel] == ADC_FAST)
|
||||||
return fastAdcValue;
|
return fastAdcValue;
|
||||||
|
if (boardConfiguration->adcHwChannelEnabled[hwChannel] != ADC_SLOW) {
|
||||||
|
warning(OBD_PCM_Processor_Fault, "ADC is off %d", hwChannel);
|
||||||
|
}
|
||||||
|
|
||||||
int internalIndex = slowAdc.internalAdcIndexByHardwareIndex[hwChannel];
|
int internalIndex = slowAdc.internalAdcIndexByHardwareIndex[hwChannel];
|
||||||
return slowAdc.getAdcValueByIndex(internalIndex);
|
return slowAdc.getAdcValueByIndex(internalIndex);
|
||||||
|
|
Loading…
Reference in New Issue