47
47
#include < lib/parameters/param.h>
48
48
#include < lib/perf/perf_counter.h>
49
49
#include < drivers/drv_hrt.h>
50
- #include < uORB/uORB.h >
50
+ #include < uORB/PublicationMulti.hpp >
51
51
#include < uORB/topics/power_monitor.h>
52
52
#include < px4_platform_common/px4_work_queue/ScheduledWorkItem.hpp>
53
53
@@ -164,7 +164,7 @@ class INA226 : public device::I2C, px4::ScheduledWorkItem
164
164
int _measure_interval{0 };
165
165
bool _collect_phase{false };
166
166
167
- orb_advert_t _power_monitor_topic{nullptr };
167
+ uORB::PublicationMulti<power_monitor_s> _power_monitor_topic{ORB_ID (power_monitor) };
168
168
169
169
perf_counter_t _sample_perf;
170
170
perf_counter_t _comms_errors;
@@ -394,7 +394,7 @@ INA226::collect()
394
394
395
395
if (_shunt >= 0 ) {
396
396
397
- struct power_monitor_s report;
397
+ power_monitor_s report{} ;
398
398
report.timestamp = hrt_absolute_time ();
399
399
report.voltage_v = (float ) _bus_volatage * INA226_VSCALE;
400
400
report.current_a = (float ) _current * _current_lsb;
@@ -411,8 +411,7 @@ INA226::collect()
411
411
#endif
412
412
413
413
/* publish it */
414
- int instance;
415
- orb_publish_auto (ORB_ID (power_monitor), &_power_monitor_topic, &report, &instance, ORB_PRIO_DEFAULT);
414
+ _power_monitor_topic.publish (report);
416
415
417
416
ret = OK;
418
417
perf_end (_sample_perf);
0 commit comments