pwm_out_sim: don't complain without waiting

This commit is contained in:
Julian Oes
2016-06-01 17:02:19 +01:00
committed by Lorenz Meier
parent a6e46a7e6f
commit 750b40f962
+5 -12
View File
@@ -414,21 +414,14 @@ PWMSim::task_main()
_current_update_rate = _update_rate;
}
/* sleep waiting for data, but no more than a second */
int ret = 0;
if (_poll_fds_num == 0) {
usleep(1000 * 1000);
/* this can happen during boot, but after the sleep its likely resolved */
if (_poll_fds_num == 0) {
PX4_WARN("pwm_out_sim: No valid fds");
}
} else {
ret = px4_poll(&_poll_fds[0], _poll_fds_num, 1000);
PX4_DEBUG("no valid fds");
continue;
}
/* sleep waiting for data, but no more than a second */
int ret = px4_poll(&_poll_fds[0], _poll_fds_num, 1000);
/* this would be bad... */
if (ret < 0) {
DEVICE_LOG("poll error %d", errno);