AP_BattMonitor: complete rename of SMBus_Maxell to Generic

This commit is contained in:
Randy Mackay 2020-06-02 16:21:10 +09:00 committed by WickedShell
parent c13c037f7b
commit f869cd9aa6
7 changed files with 16 additions and 15 deletions

View File

@ -133,11 +133,11 @@ AP_BattMonitor::init()
hal.i2c_mgr->get_device(_params[instance]._i2c_bus, AP_BATTMONITOR_SMBUS_I2C_ADDR,
100000, true, 20), 6);
break;
case AP_BattMonitor_Params::BattMonitor_TYPE_MAXELL:
case AP_BattMonitor_Params::BattMonitor_TYPE_SMBus_Generic:
_params[instance]._i2c_bus.set_default(AP_BATTMONITOR_SMBUS_BUS_EXTERNAL);
drivers[instance] = new AP_BattMonitor_SMBus_Maxell(*this, state[instance], _params[instance],
hal.i2c_mgr->get_device(_params[instance]._i2c_bus, AP_BATTMONITOR_SMBUS_I2C_ADDR,
100000, true, 20));
drivers[instance] = new AP_BattMonitor_SMBus_Generic(*this, state[instance], _params[instance],
hal.i2c_mgr->get_device(_params[instance]._i2c_bus, AP_BATTMONITOR_SMBUS_I2C_ADDR,
100000, true, 20));
break;
#endif // HAL_BATTMON_SMBUS_ENABLE
case AP_BattMonitor_Params::BattMonitor_TYPE_BEBOP:

View File

@ -32,7 +32,7 @@ class AP_BattMonitor_Backend;
class AP_BattMonitor_Analog;
class AP_BattMonitor_SMBus;
class AP_BattMonitor_SMBus_Solo;
class AP_BattMonitor_SMBus_Maxell;
class AP_BattMonitor_SMBus_Generic;
class AP_BattMonitor_UAVCAN;
class AP_BattMonitor
@ -41,7 +41,7 @@ class AP_BattMonitor
friend class AP_BattMonitor_Analog;
friend class AP_BattMonitor_SMBus;
friend class AP_BattMonitor_SMBus_Solo;
friend class AP_BattMonitor_SMBus_Maxell;
friend class AP_BattMonitor_SMBus_Generic;
friend class AP_BattMonitor_UAVCAN;
friend class AP_BattMonitor_Sum;
friend class AP_BattMonitor_FuelFlow;

View File

@ -13,7 +13,7 @@ const AP_Param::GroupInfo AP_BattMonitor_Params::var_info[] = {
// @Param: MONITOR
// @DisplayName: Battery monitoring
// @Description: Controls enabling monitoring of the battery's voltage and current
// @Values: 0:Disabled,3:Analog Voltage Only,4:Analog Voltage and Current,5:Solo,6:Bebop,7:SMBus-Maxell,8:UAVCAN-BatteryInfo,9:BLHeli ESC,10:SumOfFollowing,11:FuelFlow,12:FuelLevelPWM,13:SMBUS-SUI3,14:SMBUS-SUI6,15:NeoDesign
// @Values: 0:Disabled,3:Analog Voltage Only,4:Analog Voltage and Current,5:Solo,6:Bebop,7:SMBus-Maxell,8:UAVCAN-BatteryInfo,9:BLHeli ESC,10:SumOfFollowing,11:FuelFlow,12:FuelLevelPWM,13:SMBUS-SUI3,14:SMBUS-SUI6,15:NeoDesign,16:SMBus-Generic
// @User: Standard
// @RebootRequired: True
AP_GROUPINFO_FLAGS("MONITOR", 1, AP_BattMonitor_Params, _type, BattMonitor_TYPE_NONE, AP_PARAM_FLAG_ENABLE),

View File

@ -28,6 +28,7 @@ public:
BattMonitor_TYPE_SUI3 = 13,
BattMonitor_TYPE_SUI6 = 14,
BattMonitor_TYPE_NeoDesign = 15,
BattMonitor_TYPE_SMBus_Generic = 16,
};
// low voltage sources (used for BATT_LOW_TYPE parameter)

View File

@ -99,4 +99,4 @@ protected:
// include specific implementations
#include "AP_BattMonitor_SMBus_Solo.h"
#include "AP_BattMonitor_SMBus_Maxell.h"
#include "AP_BattMonitor_SMBus_Generic.h"

View File

@ -2,7 +2,7 @@
#include <AP_Common/AP_Common.h>
#include <AP_Math/AP_Math.h>
#include "AP_BattMonitor.h"
#include "AP_BattMonitor_SMBus_Maxell.h"
#include "AP_BattMonitor_SMBus_Generic.h"
#include <utility>
uint8_t maxell_cell_ids[] = { 0x3f, // cell 1
@ -30,14 +30,14 @@ uint8_t maxell_cell_ids[] = { 0x3f, // cell 1
*/
// Constructor
AP_BattMonitor_SMBus_Maxell::AP_BattMonitor_SMBus_Maxell(AP_BattMonitor &mon,
AP_BattMonitor_SMBus_Generic::AP_BattMonitor_SMBus_Generic(AP_BattMonitor &mon,
AP_BattMonitor::BattMonitor_State &mon_state,
AP_BattMonitor_Params &params,
AP_HAL::OwnPtr<AP_HAL::I2CDevice> dev)
: AP_BattMonitor_SMBus(mon, mon_state, params, std::move(dev))
{}
void AP_BattMonitor_SMBus_Maxell::timer()
void AP_BattMonitor_SMBus_Generic::timer()
{
// check if PEC is supported
if (!check_pec_support()) {
@ -90,7 +90,7 @@ void AP_BattMonitor_SMBus_Maxell::timer()
}
// read_block - returns number of characters read if successful, zero if unsuccessful
uint8_t AP_BattMonitor_SMBus_Maxell::read_block(uint8_t reg, uint8_t* data, bool append_zero) const
uint8_t AP_BattMonitor_SMBus_Generic::read_block(uint8_t reg, uint8_t* data, bool append_zero) const
{
// get length
uint8_t bufflen;
@ -135,7 +135,7 @@ uint8_t AP_BattMonitor_SMBus_Maxell::read_block(uint8_t reg, uint8_t* data, bool
// check if PEC supported with the version value in SpecificationInfo() function
// returns true once PEC is confirmed as working or not working
bool AP_BattMonitor_SMBus_Maxell::check_pec_support()
bool AP_BattMonitor_SMBus_Generic::check_pec_support()
{
// exit immediately if we have already confirmed pec support
if (_pec_confirmed) {

View File

@ -8,12 +8,12 @@
#define BATTMONITOR_SMBUS_MAXELL_NUM_CELLS 6
class AP_BattMonitor_SMBus_Maxell : public AP_BattMonitor_SMBus
class AP_BattMonitor_SMBus_Generic : public AP_BattMonitor_SMBus
{
public:
// Constructor
AP_BattMonitor_SMBus_Maxell(AP_BattMonitor &mon,
AP_BattMonitor_SMBus_Generic(AP_BattMonitor &mon,
AP_BattMonitor::BattMonitor_State &mon_state,
AP_BattMonitor_Params &params,
AP_HAL::OwnPtr<AP_HAL::I2CDevice> dev);