Plane: integrate BattMonitor exhausted method
BatteryMonitor object made static Removed unused macros for battery voltage and current monitoring
This commit is contained in:
parent
7d73e62a23
commit
9388ea3848
@ -466,7 +466,7 @@ static int32_t altitude_error_cm;
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Battery Sensors
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
AP_BattMonitor battery;
|
||||
static AP_BattMonitor battery;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Airspeed Sensors
|
||||
|
@ -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
|
||||
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user