diff options
Diffstat (limited to 'src/drivers/px4io/px4io.cpp')
-rw-r--r-- | src/drivers/px4io/px4io.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/drivers/px4io/px4io.cpp b/src/drivers/px4io/px4io.cpp index cf1b89c4c..7845f8bf8 100644 --- a/src/drivers/px4io/px4io.cpp +++ b/src/drivers/px4io/px4io.cpp @@ -622,8 +622,15 @@ PX4IO::init() return ret; /* get some parameters */ - unsigned protocol = io_reg_get(PX4IO_PAGE_CONFIG, PX4IO_P_CONFIG_PROTOCOL_VERSION); + unsigned protocol; + hrt_abstime start_try_time = hrt_absolute_time(); + do { + usleep(2000); + protocol = io_reg_get(PX4IO_PAGE_CONFIG, PX4IO_P_CONFIG_PROTOCOL_VERSION); + } while (protocol == _io_reg_get_error && (hrt_elapsed_time(&start_try_time) < 700U * 1000U)); + + /* if the error still persists after timing out, we give up */ if (protocol == _io_reg_get_error) { mavlink_and_console_log_emergency(_mavlink_fd, "Failed to communicate with IO, abort."); return -1; |