From e4b928be4db55369c47cfc80ebbcdbf9da972ceb Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Fri, 5 Apr 2019 09:06:45 +1100 Subject: [PATCH] AP_BattMonitor: add floating point constant designators --- libraries/AP_BattMonitor/AP_BattMonitor_FuelFlow.cpp | 6 +++--- libraries/AP_BattMonitor/AP_BattMonitor_SMBus_Solo.cpp | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/libraries/AP_BattMonitor/AP_BattMonitor_FuelFlow.cpp b/libraries/AP_BattMonitor/AP_BattMonitor_FuelFlow.cpp index d2321668f1..878419c143 100644 --- a/libraries/AP_BattMonitor/AP_BattMonitor_FuelFlow.cpp +++ b/libraries/AP_BattMonitor/AP_BattMonitor_FuelFlow.cpp @@ -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; } diff --git a/libraries/AP_BattMonitor/AP_BattMonitor_SMBus_Solo.cpp b/libraries/AP_BattMonitor/AP_BattMonitor_SMBus_Solo.cpp index e333bf066d..50ddd809c3 100644 --- a/libraries/AP_BattMonitor/AP_BattMonitor_SMBus_Solo.cpp +++ b/libraries/AP_BattMonitor/AP_BattMonitor_SMBus_Solo.cpp @@ -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; }