mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-28 10:46:33 +08:00
batt_smbus: Use orb_publish_auto
This commit is contained in:
committed by
Daniel Agar
parent
6bd4dff51f
commit
06e2bca3a6
@@ -52,9 +52,6 @@ BATT_SMBUS::BATT_SMBUS(I2CSPIBusOption bus_option, const int bus, SMBus *interfa
|
|||||||
interface->get_device_address()),
|
interface->get_device_address()),
|
||||||
_interface(interface)
|
_interface(interface)
|
||||||
{
|
{
|
||||||
battery_status_s new_report = {};
|
|
||||||
_batt_topic = orb_advertise(ORB_ID(battery_status), &new_report);
|
|
||||||
|
|
||||||
int battsource = 1;
|
int battsource = 1;
|
||||||
int batt_device_type = (int)SMBUS_DEVICE_TYPE::UNDEFINED;
|
int batt_device_type = (int)SMBUS_DEVICE_TYPE::UNDEFINED;
|
||||||
|
|
||||||
@@ -193,7 +190,9 @@ void BATT_SMBUS::RunImpl()
|
|||||||
}
|
}
|
||||||
|
|
||||||
new_report.interface_error = perf_event_count(_interface->_interface_errors);
|
new_report.interface_error = perf_event_count(_interface->_interface_errors);
|
||||||
orb_publish(ORB_ID(battery_status), _batt_topic, &new_report);
|
|
||||||
|
int instance = 0;
|
||||||
|
orb_publish_auto(ORB_ID(battery_status), &_batt_topic, &new_report, &instance);
|
||||||
|
|
||||||
_last_report = new_report;
|
_last_report = new_report;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user