Fix calculation of safety ADC monitors.
This commit is contained in:
parent
69ff13a991
commit
d6356de1b6
@ -107,16 +107,16 @@ float safety_adc_convert_channel(enum safety_adc_meas_channel channel, uint16_t
|
||||
|
||||
switch (channel) {
|
||||
case SAFETY_ADC_MEAS_TEMP:
|
||||
converted_val = (((float)analog_value / 4095.0f * 2500.0f - SAFETY_ADC_TEMP_NOM_MV) /
|
||||
converted_val = (((float)analog_value / 4096.0f * 2500.0f - SAFETY_ADC_TEMP_NOM_MV) /
|
||||
SAFETY_ADC_TEMP_MV_SLOPE) + SAFETY_ADC_TEMP_NOM;
|
||||
break;
|
||||
case SAFETY_ADC_MEAS_VREF:
|
||||
converted_val = (SAFETY_ADC_INT_REF_MV * 4095.0f) / (float)analog_value;
|
||||
converted_val = (SAFETY_ADC_INT_REF_MV * 4096.0f) / (float)analog_value;
|
||||
break;
|
||||
case SAFETY_ADC_MEAS_SUPPLY:
|
||||
hw_rev = get_pcb_hardware_version();
|
||||
if (hw_rev >= HW_REV_V1_3)
|
||||
converted_val = ((float)analog_value) / 4095.0f * 2500.0f * 2.0f;
|
||||
converted_val = ((float)analog_value) / 4096.0f * 2500.0f * 2.0f;
|
||||
else
|
||||
converted_val = 3300.0f;
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user