Update ADC voltage calculation instances to avoid divide by integer.

This commit is contained in:
mcsauder
2018-07-09 07:51:15 +02:00
committed by Beat Küng
parent 850b1ad6a7
commit cf7dd383b1
3 changed files with 4 additions and 3 deletions
+2 -1
View File
@@ -281,6 +281,7 @@ int board_adc_init()
return OK;
}
int
ADC::init()
{
@@ -401,7 +402,7 @@ ADC::update_system_power(hrt_abstime now)
if (_samples[i].am_channel == ADC_SCALED_V5_SENSE) {
// it is 2:1 scaled
system_power.voltage5V_v = _samples[i].am_data * (ADC_V5_V_FULL_SCALE / 4096);
system_power.voltage5V_v = _samples[i].am_data * (ADC_V5_V_FULL_SCALE / 4096.0f);
cnt--;
} else