Copter: sent battery voltage and current to motors

This commit is contained in:
Leonard Hall 2015-02-11 20:50:55 +09:00 committed by Randy Mackay
parent 1217ab9579
commit 8eedb2c040
1 changed files with 8 additions and 0 deletions

View File

@ -150,6 +150,14 @@ static void read_battery(void)
compass.set_current(battery.current_amps());
}
// update motors with voltage and current
if (battery.get_type() != AP_BattMonitor::BattMonitor_TYPE_NONE) {
motors.set_voltage(battery.voltage());
}
if (battery.has_current()) {
motors.set_current(battery.current_amps());
}
// check for low voltage or current if the low voltage check hasn't already been triggered
// we only check when we're not powered by USB to avoid false alarms during bench tests
if (!ap.usb_connected && !failsafe.battery && battery.exhausted(g.fs_batt_voltage, g.fs_batt_mah)) {