From 06e2bca3a60fcbda446ba3229184b946f16bbedc Mon Sep 17 00:00:00 2001 From: Alex Mikhalev Date: Tue, 16 Feb 2021 23:57:39 -0700 Subject: [PATCH] batt_smbus: Use orb_publish_auto --- src/drivers/batt_smbus/batt_smbus.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/drivers/batt_smbus/batt_smbus.cpp b/src/drivers/batt_smbus/batt_smbus.cpp index 9a7cbb1d74..8952a2c638 100644 --- a/src/drivers/batt_smbus/batt_smbus.cpp +++ b/src/drivers/batt_smbus/batt_smbus.cpp @@ -52,9 +52,6 @@ BATT_SMBUS::BATT_SMBUS(I2CSPIBusOption bus_option, const int bus, SMBus *interfa interface->get_device_address()), _interface(interface) { - battery_status_s new_report = {}; - _batt_topic = orb_advertise(ORB_ID(battery_status), &new_report); - int battsource = 1; 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); - 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; }