mirror of https://github.com/FOME-Tech/fome-fw.git
fix #442
This commit is contained in:
parent
a6e97cdb54
commit
a27b9c0333
|
@ -8,16 +8,11 @@
|
||||||
#ifndef ADC_MATH_H_
|
#ifndef ADC_MATH_H_
|
||||||
#define ADC_MATH_H_
|
#define ADC_MATH_H_
|
||||||
|
|
||||||
// it is important that this constant is a float, not double literal
|
|
||||||
#ifndef ADC_VCC
|
|
||||||
// todo: migrate to engineConfiguration->adcVcc under https://github.com/rusefi/rusefi/issues/442
|
|
||||||
#define ADC_VCC 3.0f
|
|
||||||
#endif /* ADC_VCC */
|
|
||||||
#define ADC_MAX_VALUE 4095
|
#define ADC_MAX_VALUE 4095
|
||||||
|
|
||||||
#define adcToVolts(adc) (ADC_VCC / ADC_MAX_VALUE * (adc))
|
#define adcToVolts(adc) ((engineConfiguration->adcVcc) / ADC_MAX_VALUE * (adc))
|
||||||
|
|
||||||
#define voltsToAdc(volts) ((volts) * (ADC_MAX_VALUE / ADC_VCC))
|
#define voltsToAdc(volts) ((volts) * (ADC_MAX_VALUE / (engineConfiguration->adcVcc)))
|
||||||
|
|
||||||
#define getVoltage(msg, hwChannel) (adcToVolts(getAdcValue(msg, hwChannel)))
|
#define getVoltage(msg, hwChannel) (adcToVolts(getAdcValue(msg, hwChannel)))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue