mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-11-02 15:41:36 +08:00
Fix PX4IO startup
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user