|
|
|
@ -4,7 +4,6 @@
@@ -4,7 +4,6 @@
|
|
|
|
|
#include <AP_Common/AP_Common.h> |
|
|
|
|
#include <AP_Param/AP_Param.h> |
|
|
|
|
#include <AP_Math/AP_Math.h> |
|
|
|
|
#include <AP_Vehicle/AP_Vehicle_Type.h> |
|
|
|
|
|
|
|
|
|
// maximum number of battery monitors
|
|
|
|
|
#define AP_BATT_MONITOR_MAX_INSTANCES 2 |
|
|
|
@ -106,14 +105,12 @@ public:
@@ -106,14 +105,12 @@ 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); } |
|
|
|
|
|
|
|
|
|
#if APM_BUILD_TYPE(APM_BUILD_ArduPlane) |
|
|
|
|
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; |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
static const struct AP_Param::GroupInfo var_info[]; |
|
|
|
|
|
|
|
|
@ -127,9 +124,7 @@ protected:
@@ -127,9 +124,7 @@ protected:
|
|
|
|
|
AP_Float _curr_amp_per_volt[AP_BATT_MONITOR_MAX_INSTANCES]; /// voltage on current pin multiplied by this to calculate current in amps
|
|
|
|
|
AP_Float _curr_amp_offset[AP_BATT_MONITOR_MAX_INSTANCES]; /// offset voltage that is subtracted from current pin before conversion to amps
|
|
|
|
|
AP_Int32 _pack_capacity[AP_BATT_MONITOR_MAX_INSTANCES]; /// battery pack capacity less reserve in mAh
|
|
|
|
|
#if APM_BUILD_TYPE(APM_BUILD_ArduPlane) |
|
|
|
|
AP_Int16 _watt_max[AP_BATT_MONITOR_MAX_INSTANCES]; /// max battery power allowed. Reduce max throttle to reduce current to satisfy this limit
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
private: |
|
|
|
|
BattMonitor_State state[AP_BATT_MONITOR_MAX_INSTANCES]; |
|
|
|
|