Commit de8f8d25 authored by Federico Vaga's avatar Federico Vaga

lib: improve raw_to_uv approximation

By postponing the division to improve the accuracy
Signed-off-by: Federico Vaga's avatarFederico Vaga <federico.vaga@cern.ch>
parent 05357315
......@@ -493,7 +493,7 @@ static uint32_t __offset_raw_to_uv(uint32_t value_raw)
{
int32_t value_raw_s = (int32_t)value_raw;
return (value_raw_s * (ADC_100M14B4CHA_DAC_VREF_uV / 0x8000LL)) - ADC_100M14B4CHA_DAC_VREF_uV;
return ((value_raw_s * ADC_100M14B4CHA_DAC_VREF_uV) / 0x8000LL) - ADC_100M14B4CHA_DAC_VREF_uV;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment