mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-06-01 02:55:07 +08:00
navio_sysfs_rc_in orb_publish usage to uORB::PublicationMulti<>
This commit is contained in:
@@ -47,7 +47,7 @@
|
|||||||
|
|
||||||
#include <drivers/drv_hrt.h>
|
#include <drivers/drv_hrt.h>
|
||||||
|
|
||||||
#include <uORB/uORB.h>
|
#include <uORB/PublicationMulti.hpp>
|
||||||
#include <uORB/topics/input_rc.h>
|
#include <uORB/topics/input_rc.h>
|
||||||
|
|
||||||
namespace navio_sysfs_rc_in
|
namespace navio_sysfs_rc_in
|
||||||
@@ -96,7 +96,7 @@ private:
|
|||||||
bool _isRunning;
|
bool _isRunning;
|
||||||
struct work_s _work;
|
struct work_s _work;
|
||||||
|
|
||||||
orb_advert_t _rcinput_pub;
|
uORB::PublicationMulti<input_rc_s> _rcinput_pub{ORB_ID(input_rc)};
|
||||||
|
|
||||||
int _channels;
|
int _channels;
|
||||||
int _ch_fd[input_rc_s::RC_INPUT_MAX_CHANNELS] {};
|
int _ch_fd[input_rc_s::RC_INPUT_MAX_CHANNELS] {};
|
||||||
@@ -126,13 +126,6 @@ int RcInput::navio_rc_init()
|
|||||||
_data.values[i] = UINT16_MAX;
|
_data.values[i] = UINT16_MAX;
|
||||||
}
|
}
|
||||||
|
|
||||||
_rcinput_pub = orb_advertise(ORB_ID(input_rc), &_data);
|
|
||||||
|
|
||||||
if (_rcinput_pub == nullptr) {
|
|
||||||
PX4_WARN("error: advertise failed");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -208,7 +201,7 @@ void RcInput::_measure(void)
|
|||||||
_data.rc_lost = false;
|
_data.rc_lost = false;
|
||||||
_data.input_source = input_rc_s::RC_INPUT_SOURCE_PX4IO_PPM;
|
_data.input_source = input_rc_s::RC_INPUT_SOURCE_PX4IO_PPM;
|
||||||
|
|
||||||
orb_publish(ORB_ID(input_rc), _rcinput_pub, &_data);
|
_rcinput_pub.publish(_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user