Plane: integrate BattMonitor exhausted method

BatteryMonitor object made static
Removed unused macros for battery voltage and current monitoring
This commit is contained in:
Randy Mackay 2013-09-30 23:15:35 +09:00
parent 7d73e62a23
commit 9388ea3848
3 changed files with 2 additions and 15 deletions

View File

@ -466,7 +466,7 @@ static int32_t altitude_error_cm;
////////////////////////////////////////////////////////////////////////////////
// Battery Sensors
////////////////////////////////////////////////////////////////////////////////
AP_BattMonitor battery;
static AP_BattMonitor battery;
////////////////////////////////////////////////////////////////////////////////
// Airspeed Sensors

View File

@ -199,10 +199,6 @@ enum log_messages {
#define ALTITUDE_HISTORY_LENGTH 8 //Number of (time,altitude) points to
// regress a climb rate from
#define BATTERY_VOLTAGE(x) (x->voltage_average()*g.volt_div_ratio)
#define CURRENT_AMPS(x) (x->voltage_average()-g.curr_amp_offset)*g.curr_amp_per_volt
#define AN4 4
#define AN5 5

View File

@ -50,16 +50,7 @@ static void read_battery(void)
battery.read();
if (!usb_connected &&
battery.voltage() != 0 &&
g.fs_batt_voltage > 0 &&
battery.voltage() < g.fs_batt_voltage) {
low_battery_event();
}
if (!usb_connected &&
battery.monitoring() == AP_BATT_MONITOR_VOLTAGE_AND_CURRENT &&
g.fs_batt_mah > 0 &&
battery.pack_capacity() - battery.current_total_mah() < g.fs_batt_mah) {
if (!usb_connected && battery.exhausted(g.fs_batt_voltage, g.fs_batt_mah)) {
low_battery_event();
}
}