mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-23 03:13:33 +08:00
Merge branch 'master' of github.com:PX4/Firmware into new_state_machine
This commit is contained in:
@@ -139,14 +139,12 @@ public:
|
||||
private:
|
||||
static const unsigned _rc_max_chan_count = RC_CHANNELS_MAX; /**< maximum number of r/c channels we handle */
|
||||
|
||||
#if CONFIG_HRT_PPM
|
||||
hrt_abstime _ppm_last_valid; /**< last time we got a valid ppm signal */
|
||||
|
||||
/**
|
||||
* Gather and publish PPM input data.
|
||||
*/
|
||||
void ppm_poll();
|
||||
#endif
|
||||
|
||||
/* XXX should not be here - should be own driver */
|
||||
int _fd_adc; /**< ADC driver handle */
|
||||
@@ -393,9 +391,7 @@ Sensors *g_sensors;
|
||||
}
|
||||
|
||||
Sensors::Sensors() :
|
||||
#ifdef CONFIG_HRT_PPM
|
||||
_ppm_last_valid(0),
|
||||
#endif
|
||||
|
||||
_fd_adc(-1),
|
||||
_last_adc(0),
|
||||
@@ -1120,16 +1116,18 @@ Sensors::adc_poll(struct sensor_combined_s &raw)
|
||||
}
|
||||
}
|
||||
|
||||
#if CONFIG_HRT_PPM
|
||||
void
|
||||
Sensors::ppm_poll()
|
||||
{
|
||||
|
||||
/* read low-level values from FMU or IO RC inputs (PPM, Spektrum, S.Bus) */
|
||||
bool rc_updated;
|
||||
orb_check(_rc_sub, &rc_updated);
|
||||
struct pollfd fds[1];
|
||||
fds[0].fd = _rc_sub;
|
||||
fds[0].events = POLLIN;
|
||||
/* check non-blocking for new data */
|
||||
int poll_ret = poll(fds, 1, 0);
|
||||
|
||||
if (rc_updated) {
|
||||
if (poll_ret > 0) {
|
||||
struct rc_input_values rc_input;
|
||||
|
||||
orb_copy(ORB_ID(input_rc), _rc_sub, &rc_input);
|
||||
@@ -1316,7 +1314,6 @@ Sensors::ppm_poll()
|
||||
}
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
Sensors::task_main_trampoline(int argc, char *argv[])
|
||||
@@ -1429,10 +1426,8 @@ Sensors::task_main()
|
||||
if (_publishing)
|
||||
orb_publish(ORB_ID(sensor_combined), _sensor_pub, &raw);
|
||||
|
||||
#ifdef CONFIG_HRT_PPM
|
||||
/* Look for new r/c input data */
|
||||
ppm_poll();
|
||||
#endif
|
||||
|
||||
perf_end(_loop_perf);
|
||||
}
|
||||
@@ -1472,7 +1467,7 @@ int sensors_main(int argc, char *argv[])
|
||||
if (!strcmp(argv[1], "start")) {
|
||||
|
||||
if (sensors::g_sensors != nullptr)
|
||||
errx(1, "sensors task already running");
|
||||
errx(0, "sensors task already running");
|
||||
|
||||
sensors::g_sensors = new Sensors;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user