2018-11-19 04:59:58 -04:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "AP_BattMonitor_Backend.h"
|
|
|
|
|
2023-03-06 22:02:49 -04:00
|
|
|
#if AP_BATTERY_SUM_ENABLED
|
|
|
|
|
|
|
|
#include "AP_BattMonitor.h"
|
|
|
|
|
2018-11-19 04:59:58 -04:00
|
|
|
class AP_BattMonitor_Sum : public AP_BattMonitor_Backend
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
/// Constructor
|
|
|
|
AP_BattMonitor_Sum(AP_BattMonitor &mon, AP_BattMonitor::BattMonitor_State &mon_state, AP_BattMonitor_Params ¶ms, uint8_t instance);
|
|
|
|
|
|
|
|
/// Read the battery voltage and current. Should be called at 10hz
|
|
|
|
void read() override;
|
|
|
|
|
|
|
|
/// returns true if battery monitor provides consumed energy info
|
|
|
|
bool has_consumed_energy() const override { return has_current(); }
|
|
|
|
|
|
|
|
/// returns true if battery monitor provides current info
|
|
|
|
bool has_current() const override { return _has_current; }
|
|
|
|
|
|
|
|
void init(void) override {}
|
|
|
|
|
2021-10-18 23:04:07 -03:00
|
|
|
static const struct AP_Param::GroupInfo var_info[];
|
|
|
|
|
2018-11-19 04:59:58 -04:00
|
|
|
private:
|
2021-10-18 23:04:07 -03:00
|
|
|
|
|
|
|
AP_Int16 _sum_mask;
|
2018-11-19 04:59:58 -04:00
|
|
|
uint8_t _instance;
|
|
|
|
bool _has_current;
|
|
|
|
};
|
2023-03-06 22:02:49 -04:00
|
|
|
|
|
|
|
#endif // AP_BATTERY_SUM_ENABLED
|