Browse Source

AP_BattMonitor: Remove unneeded memebers

is_powering_off was only used for solo, and was just an intermediate
copy before updating notify
mission-4.1.18
Michael du Breuil 7 years ago committed by Francisco Ferreira
parent
commit
bb0d43d03c
  1. 4
      libraries/AP_BattMonitor/AP_BattMonitor.cpp
  2. 7
      libraries/AP_BattMonitor/AP_BattMonitor.h
  3. 6
      libraries/AP_BattMonitor/AP_BattMonitor_SMBus_Solo.cpp

4
libraries/AP_BattMonitor/AP_BattMonitor.cpp

@ -246,10 +246,6 @@ bool AP_BattMonitor::healthy(uint8_t instance) const {
return instance < _num_instances && _BattMonitor_STATE(instance).healthy; return instance < _num_instances && _BattMonitor_STATE(instance).healthy;
} }
bool AP_BattMonitor::is_powering_off(uint8_t instance) const {
return instance < _num_instances && _BattMonitor_STATE(instance).is_powering_off;
}
/// has_current - returns true if battery monitor instance provides current info /// has_current - returns true if battery monitor instance provides current info
bool AP_BattMonitor::has_current(uint8_t instance) const bool AP_BattMonitor::has_current(uint8_t instance) const
{ {

7
libraries/AP_BattMonitor/AP_BattMonitor.h

@ -67,7 +67,6 @@ public:
struct BattMonitor_State { struct BattMonitor_State {
uint8_t instance; // the instance number of this monitor uint8_t instance; // the instance number of this monitor
bool healthy; // battery monitor is communicating correctly bool healthy; // battery monitor is communicating correctly
bool is_powering_off; // true if the battery is about to power off
float voltage; // voltage in volts float voltage; // voltage in volts
float current_amps; // current in amperes float current_amps; // current in amperes
float current_total_mah; // total current draw since start-up float current_total_mah; // total current draw since start-up
@ -95,9 +94,6 @@ public:
bool healthy(uint8_t instance) const; bool healthy(uint8_t instance) const;
bool healthy() const { return healthy(AP_BATT_PRIMARY_INSTANCE); } bool healthy() const { return healthy(AP_BATT_PRIMARY_INSTANCE); }
bool is_powering_off(uint8_t instance) const;
bool is_powering_off() const { return is_powering_off(AP_BATT_PRIMARY_INSTANCE); }
/// has_current - returns true if battery monitor instance provides current info /// has_current - returns true if battery monitor instance provides current info
bool has_current(uint8_t instance) const; bool has_current(uint8_t instance) const;
bool has_current() const { return has_current(AP_BATT_PRIMARY_INSTANCE); } bool has_current() const { return has_current(AP_BATT_PRIMARY_INSTANCE); }
@ -138,9 +134,6 @@ public:
/// set_monitoring - sets the monitor type (used for example sketch only) /// set_monitoring - sets the monitor type (used for example sketch only)
void set_monitoring(uint8_t instance, uint8_t mon) { _monitoring[instance].set(mon); } void set_monitoring(uint8_t instance, uint8_t mon) { _monitoring[instance].set(mon); }
bool get_watt_max() { return get_watt_max(AP_BATT_PRIMARY_INSTANCE); }
bool get_watt_max(uint8_t instance) { return _watt_max[instance]; }
/// true when (voltage * current) > watt_max /// true when (voltage * current) > watt_max
bool overpower_detected() const; bool overpower_detected() const;
bool overpower_detected(uint8_t instance) const; bool overpower_detected(uint8_t instance) const;

6
libraries/AP_BattMonitor/AP_BattMonitor_SMBus_Solo.cpp

@ -82,8 +82,7 @@ void AP_BattMonitor_SMBus_Solo::timer()
if (_button_press_count >= BATTMONITOR_SMBUS_SOLO_BUTTON_DEBOUNCE) { if (_button_press_count >= BATTMONITOR_SMBUS_SOLO_BUTTON_DEBOUNCE) {
// battery will power off // battery will power off
_state.is_powering_off = true; AP_Notify::flags.powering_off = true;
} else if (pressed) { } else if (pressed) {
// battery will power off if the button is held // battery will power off if the button is held
_button_press_count++; _button_press_count++;
@ -91,9 +90,8 @@ void AP_BattMonitor_SMBus_Solo::timer()
} else { } else {
// button released, reset counters // button released, reset counters
_button_press_count = 0; _button_press_count = 0;
_state.is_powering_off = false; AP_Notify::flags.powering_off = false;
} }
AP_Notify::flags.powering_off = _state.is_powering_off;
} }
read_temp(); read_temp();

Loading…
Cancel
Save