mirror of https://github.com/ArduPilot/ardupilot
AP_BattMonitor: removed create() method for objects
See discussion here: https://github.com/ArduPilot/ardupilot/issues/7331 we were getting some uninitialised variables. While it only showed up in AP_SbusOut, it means we can't be sure it won't happen on other objects, so safest to remove the approach Thanks to assistance from Lucas, Peter and Francisco
This commit is contained in:
parent
68f8817e97
commit
a4c56fcb82
|
@ -37,9 +37,7 @@ class AP_BattMonitor
|
|||
friend class AP_BattMonitor_SMBus_Maxell;
|
||||
|
||||
public:
|
||||
static AP_BattMonitor create() { return AP_BattMonitor{}; }
|
||||
|
||||
constexpr AP_BattMonitor(AP_BattMonitor &&other) = default;
|
||||
AP_BattMonitor();
|
||||
|
||||
/* Do not allow copies */
|
||||
AP_BattMonitor(const AP_BattMonitor &other) = delete;
|
||||
|
@ -179,8 +177,6 @@ protected:
|
|||
AP_Int8 _low_voltage_source; /// voltage type used for detection of low voltage event
|
||||
|
||||
private:
|
||||
AP_BattMonitor();
|
||||
|
||||
BattMonitor_State state[AP_BATT_MONITOR_MAX_INSTANCES];
|
||||
AP_BattMonitor_Backend *drivers[AP_BATT_MONITOR_MAX_INSTANCES];
|
||||
uint8_t _num_instances; /// number of monitors
|
||||
|
|
|
@ -11,7 +11,7 @@ void loop();
|
|||
|
||||
const AP_HAL::HAL& hal = AP_HAL::get_HAL();
|
||||
|
||||
static AP_BattMonitor battery_mon = AP_BattMonitor::create();
|
||||
static AP_BattMonitor battery_mon;
|
||||
uint32_t timer;
|
||||
|
||||
void setup() {
|
||||
|
|
Loading…
Reference in New Issue