Use discharged current to estimate remaining battery charge if capacity is known

This commit is contained in:
Anton Babushkin
2013-11-08 21:30:10 +04:00
parent 1a318ee2a6
commit 6b085e8ced
4 changed files with 32 additions and 21 deletions
+2 -1
View File
@@ -896,8 +896,9 @@ int commander_thread_main(int argc, char *argv[])
/* only consider battery voltage if system has been running 2s and battery voltage is higher than 4V */
if (hrt_absolute_time() > start_time + 2000000 && battery.voltage_v > 4.0f) {
status.battery_voltage = battery.voltage_v;
status.battery_current = battery.current_a;
status.condition_battery_voltage_valid = true;
status.battery_remaining = battery_remaining_estimate_voltage(status.battery_voltage);
status.battery_remaining = battery_remaining_estimate_voltage(battery.voltage_v, battery.discharged_mah);
}
}