AP_BattMonitor: add floating point constant designators
This commit is contained in:
parent
c2f04615d9
commit
e4b928be4d
@ -81,7 +81,7 @@ void AP_BattMonitor_FuelFlow::read()
|
||||
_state.last_time_micros = now_us;
|
||||
return;
|
||||
}
|
||||
float dt = (now_us - _state.last_time_micros) * 1.0e-6;
|
||||
float dt = (now_us - _state.last_time_micros) * 1.0e-6f;
|
||||
|
||||
if (dt < 1 && irq_state.pulse_count == 0) {
|
||||
// we allow for up to 1 second with no pulses to cope with low
|
||||
@ -101,13 +101,13 @@ void AP_BattMonitor_FuelFlow::read()
|
||||
this driver assumes that BATTx_AMP_PERVLT is set to give the
|
||||
number of millilitres per pulse.
|
||||
*/
|
||||
float irq_dt = state.total_us * 1.0e-6;
|
||||
float irq_dt = state.total_us * 1.0e-6f;
|
||||
float litres, litres_pec_sec;
|
||||
if (state.pulse_count == 0) {
|
||||
litres = 0;
|
||||
litres_pec_sec = 0;
|
||||
} else {
|
||||
litres = state.pulse_count * _params._curr_amp_per_volt * 0.001;
|
||||
litres = state.pulse_count * _params._curr_amp_per_volt * 0.001f;
|
||||
litres_pec_sec = litres / irq_dt;
|
||||
}
|
||||
|
||||
|
@ -53,7 +53,7 @@ void AP_BattMonitor_SMBus_Solo::timer()
|
||||
// because the Solo's I2C bus is so noisy, it's worth not spending the
|
||||
// time and bus bandwidth to request the pack voltage as a seperate
|
||||
// transaction
|
||||
_state.voltage = pack_voltage_mv * 1e-3;
|
||||
_state.voltage = pack_voltage_mv * 1e-3f;
|
||||
_state.last_time_micros = tnow;
|
||||
_state.healthy = true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user