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