mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-04-14 10:07:39 +08:00
Allow px4io detect to be run when IO is already running
This commit is contained in:
parent
88ad9fc25b
commit
2d6dfe2a9e
@ -487,25 +487,27 @@ PX4IO::detect()
|
||||
{
|
||||
int ret;
|
||||
|
||||
ASSERT(_task == -1);
|
||||
if (_task == -1) {
|
||||
|
||||
/* do regular cdev init */
|
||||
ret = CDev::init();
|
||||
if (ret != OK)
|
||||
return ret;
|
||||
/* do regular cdev init */
|
||||
ret = CDev::init();
|
||||
if (ret != OK)
|
||||
return ret;
|
||||
|
||||
/* get some parameters */
|
||||
unsigned protocol = io_reg_get(PX4IO_PAGE_CONFIG, PX4IO_P_CONFIG_PROTOCOL_VERSION);
|
||||
if (protocol != PX4IO_PROTOCOL_VERSION) {
|
||||
if (protocol == _io_reg_get_error) {
|
||||
log("IO not installed");
|
||||
} else {
|
||||
log("IO version error");
|
||||
mavlink_log_emergency(_mavlink_fd, "IO VERSION MISMATCH, PLEASE UPGRADE SOFTWARE!");
|
||||
/* get some parameters */
|
||||
unsigned protocol = io_reg_get(PX4IO_PAGE_CONFIG, PX4IO_P_CONFIG_PROTOCOL_VERSION);
|
||||
if (protocol != PX4IO_PROTOCOL_VERSION) {
|
||||
if (protocol == _io_reg_get_error) {
|
||||
log("IO not installed");
|
||||
} else {
|
||||
log("IO version error");
|
||||
mavlink_log_emergency(_mavlink_fd, "IO VERSION MISMATCH, PLEASE UPGRADE SOFTWARE!");
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
log("IO found");
|
||||
|
||||
return 0;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user