aboutsummaryrefslogtreecommitdiff
path: root/src/drivers/px4io/px4io.cpp
diff options
context:
space:
mode:
authorLorenz Meier <lm@inf.ethz.ch>2013-09-08 20:40:26 +0200
committerLorenz Meier <lm@inf.ethz.ch>2013-09-08 20:40:26 +0200
commit2d6dfe2a9e1fc04a9cadc3e4defa3e9cd615db1f (patch)
treef0675f8185e0ba886555ee3bae337e5fce8a6432 /src/drivers/px4io/px4io.cpp
parent88ad9fc25b17e2b61233da28ec76e0bef4976738 (diff)
downloadpx4-firmware-2d6dfe2a9e1fc04a9cadc3e4defa3e9cd615db1f.tar.gz
px4-firmware-2d6dfe2a9e1fc04a9cadc3e4defa3e9cd615db1f.tar.bz2
px4-firmware-2d6dfe2a9e1fc04a9cadc3e4defa3e9cd615db1f.zip
Allow px4io detect to be run when IO is already running
Diffstat (limited to 'src/drivers/px4io/px4io.cpp')
-rw-r--r--src/drivers/px4io/px4io.cpp32
1 files changed, 17 insertions, 15 deletions
diff --git a/src/drivers/px4io/px4io.cpp b/src/drivers/px4io/px4io.cpp
index c88abe59a..78d1d3e63 100644
--- a/src/drivers/px4io/px4io.cpp
+++ b/src/drivers/px4io/px4io.cpp
@@ -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;