mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-11-10 14:21:36 +08:00
batt_smbus: variable init cleanup + remove unused declarations
This commit is contained in:
@@ -47,20 +47,7 @@ extern "C" __EXPORT int batt_smbus_main(int argc, char *argv[]);
|
||||
|
||||
BATT_SMBUS::BATT_SMBUS(SMBus *interface, const char *path) :
|
||||
ScheduledWorkItem(MODULE_NAME, px4::device_bus_to_wq(interface->get_device_id())),
|
||||
_interface(interface),
|
||||
_cycle(perf_alloc(PC_ELAPSED, "batt_smbus_cycle")),
|
||||
_batt_topic(nullptr),
|
||||
_cell_count(4),
|
||||
_batt_capacity(0),
|
||||
_batt_startup_capacity(0),
|
||||
_cycle_count(0),
|
||||
_serial_number(0),
|
||||
_crit_thr(0.0f),
|
||||
_emergency_thr(0.0f),
|
||||
_low_thr(0.0f),
|
||||
_manufacturer_name(nullptr),
|
||||
_lifetime_max_delta_cell_voltage(0.0f),
|
||||
_cell_undervoltage_protection_status(1)
|
||||
_interface(interface)
|
||||
{
|
||||
battery_status_s new_report = {};
|
||||
_batt_topic = orb_advertise(ORB_ID(battery_status), &new_report);
|
||||
@@ -90,8 +77,6 @@ BATT_SMBUS::~BATT_SMBUS()
|
||||
|
||||
int battsource = 0;
|
||||
param_set(param_find("BAT_SOURCE"), &battsource);
|
||||
|
||||
PX4_WARN("Exiting.");
|
||||
}
|
||||
|
||||
int BATT_SMBUS::task_spawn(int argc, char *argv[])
|
||||
@@ -494,9 +479,11 @@ int BATT_SMBUS::manufacturer_name(uint8_t *man_name, const uint8_t length)
|
||||
return result;
|
||||
}
|
||||
|
||||
void BATT_SMBUS::print_report()
|
||||
int BATT_SMBUS::print_status()
|
||||
{
|
||||
PX4_INFO("Running");
|
||||
print_message(_last_report);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int BATT_SMBUS::manufacturer_read(const uint16_t cmd_code, void *data, const unsigned length)
|
||||
@@ -618,11 +605,6 @@ int BATT_SMBUS::custom_command(int argc, char *argv[])
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!strcmp(input, "report")) {
|
||||
obj->print_report();
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!strcmp(input, "suspend")) {
|
||||
obj->suspend();
|
||||
return 0;
|
||||
@@ -688,14 +670,13 @@ $ batt_smbus -X write_flash 19069 2 27 0
|
||||
PRINT_MODULE_USAGE_NAME("batt_smbus", "driver");
|
||||
|
||||
PRINT_MODULE_USAGE_COMMAND("start");
|
||||
PRINT_MODULE_USAGE_PARAM_STRING('X', "BATT_SMBUS_BUS_I2C_EXTERNAL", nullptr, nullptr, true);
|
||||
PRINT_MODULE_USAGE_PARAM_STRING('T', "BATT_SMBUS_BUS_I2C_EXTERNAL1", nullptr, nullptr, true);
|
||||
PRINT_MODULE_USAGE_PARAM_STRING('R', "BATT_SMBUS_BUS_I2C_EXTERNAL2", nullptr, nullptr, true);
|
||||
PRINT_MODULE_USAGE_PARAM_STRING('I', "BATT_SMBUS_BUS_I2C_INTERNAL", nullptr, nullptr, true);
|
||||
PRINT_MODULE_USAGE_PARAM_STRING('A', "BATT_SMBUS_BUS_ALL", nullptr, nullptr, true);
|
||||
PRINT_MODULE_USAGE_PARAM_FLAG('X', "BATT_SPARD_BUS_I2C_EXTERNAL", true);
|
||||
PRINT_MODULE_USAGE_PARAM_FLAG('T', "BATT_SPARD_BUS_I2C_EXTERNAL1", true);
|
||||
PRINT_MODULE_USAGE_PARAM_FLAG('R', "BATT_SPARD_BUS_I2C_EXTERNAL2", true);
|
||||
PRINT_MODULE_USAGE_PARAM_FLAG('I', "BATT_SPARD_BUS_I2C_INTERNAL", true);
|
||||
PRINT_MODULE_USAGE_PARAM_FLAG('A', "BATT_SPARD_BUS_ALL", true);
|
||||
|
||||
PRINT_MODULE_USAGE_COMMAND_DESCR("man_info", "Prints manufacturer info.");
|
||||
PRINT_MODULE_USAGE_COMMAND_DESCR("report", "Prints the last report.");
|
||||
PRINT_MODULE_USAGE_COMMAND_DESCR("unseal", "Unseals the devices flash memory to enable write_flash commands.");
|
||||
PRINT_MODULE_USAGE_COMMAND_DESCR("seal", "Seals the devices flash memory to disbale write_flash commands.");
|
||||
PRINT_MODULE_USAGE_COMMAND_DESCR("suspend", "Suspends the driver from rescheduling the cycle.");
|
||||
|
||||
Reference in New Issue
Block a user