Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ec5730b

Browse files
committed
navio_sysfs_rc_in orb_publish usage to uORB::PublicationMulti<>
1 parent 6a539a3 commit ec5730b

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

boards/emlid/navio2/navio_sysfs_rc_in/navio_sysfs_rc_in.cpp

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747

4848
#include <drivers/drv_hrt.h>
4949

50-
#include <uORB/uORB.h>
50+
#include <uORB/PublicationMulti.hpp>
5151
#include <uORB/topics/input_rc.h>
5252

5353
namespace navio_sysfs_rc_in
@@ -96,7 +96,7 @@ class RcInput
9696
bool _isRunning;
9797
struct work_s _work;
9898

99-
orb_advert_t _rcinput_pub;
99+
uORB::PublicationMulti<input_rc_s> _rcinput_pub{ORB_ID(input_rc)};
100100

101101
int _channels;
102102
int _ch_fd[input_rc_s::RC_INPUT_MAX_CHANNELS] {};
@@ -126,13 +126,6 @@ int RcInput::navio_rc_init()
126126
_data.values[i] = UINT16_MAX;
127127
}
128128

129-
_rcinput_pub = orb_advertise(ORB_ID(input_rc), &_data);
130-
131-
if (_rcinput_pub == nullptr) {
132-
PX4_WARN("error: advertise failed");
133-
return -1;
134-
}
135-
136129
return 0;
137130
}
138131

@@ -208,7 +201,7 @@ void RcInput::_measure(void)
208201
_data.rc_lost = false;
209202
_data.input_source = input_rc_s::RC_INPUT_SOURCE_PX4IO_PPM;
210203

211-
orb_publish(ORB_ID(input_rc), _rcinput_pub, &_data);
204+
_rcinput_pub.publish(_data);
212205
}
213206

214207
/**

0 commit comments

Comments
 (0)