AP_BattMonitor: Remove unneeded memebers

is_powering_off was only used for solo, and was just an intermediate
copy before updating notify
This commit is contained in:
Michael du Breuil 2017-10-26 13:15:21 -07:00 committed by Francisco Ferreira
parent a1a5665213
commit bb0d43d03c
3 changed files with 2 additions and 15 deletions

View File

@ -246,10 +246,6 @@ bool AP_BattMonitor::healthy(uint8_t instance) const {
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
bool AP_BattMonitor::has_current(uint8_t instance) const
{

View File

@ -67,7 +67,6 @@ public:
struct BattMonitor_State {
uint8_t instance; // the instance number of this monitor
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 current_amps; // current in amperes
float current_total_mah; // total current draw since start-up
@ -95,9 +94,6 @@ public:
bool healthy(uint8_t instance) const;
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
bool has_current(uint8_t instance) const;
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)
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
bool overpower_detected() const;
bool overpower_detected(uint8_t instance) const;

View File

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