diff options
author | Lorenz Meier <lm@inf.ethz.ch> | 2014-04-29 07:53:30 +0200 |
---|---|---|
committer | Lorenz Meier <lm@inf.ethz.ch> | 2014-04-29 07:53:30 +0200 |
commit | 2ee02e5e4b455ef8ce136d62f2985b84357ef19f (patch) | |
tree | a04b87e8cf0c60aa966a84df5ba0214087a28bf1 /src/drivers/px4io/px4io.cpp | |
parent | fcdb7fed3a295a7e4d2f5b542bb8dcb5b6859495 (diff) | |
parent | ab257ebcced2af6ddb528a9d48355dc2cac7d10a (diff) | |
download | px4-firmware-2ee02e5e4b455ef8ce136d62f2985b84357ef19f.tar.gz px4-firmware-2ee02e5e4b455ef8ce136d62f2985b84357ef19f.tar.bz2 px4-firmware-2ee02e5e4b455ef8ce136d62f2985b84357ef19f.zip |
Merge pull request #874 from jean-m-cyr/master
Proper data manager restart handling
Diffstat (limited to 'src/drivers/px4io/px4io.cpp')
-rw-r--r-- | src/drivers/px4io/px4io.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/drivers/px4io/px4io.cpp b/src/drivers/px4io/px4io.cpp index e5a39ffb0..8458c2fdb 100644 --- a/src/drivers/px4io/px4io.cpp +++ b/src/drivers/px4io/px4io.cpp @@ -91,6 +91,8 @@ #include "uploader.h" +#include "modules/dataman/dataman.h" + extern device::Device *PX4IO_i2c_interface() weak_function; extern device::Device *PX4IO_serial_interface() weak_function; @@ -568,9 +570,15 @@ int PX4IO::init() { int ret; + param_t sys_restart_param; + int sys_restart_val = DM_INIT_REASON_VOLATILE; ASSERT(_task == -1); + sys_restart_param = param_find("SYS_RESTART_TYPE"); + /* Indicate restart type is unknown */ + param_set(sys_restart_param, &sys_restart_val); + /* do regular cdev init */ ret = CDev::init(); @@ -720,6 +728,11 @@ PX4IO::init() /* keep waiting for state change for 2 s */ } while (!safety.armed); + /* Indicate restart type is in-flight */ + sys_restart_val = DM_INIT_REASON_IN_FLIGHT; + param_set(sys_restart_param, &sys_restart_val); + + /* regular boot, no in-air restart, init IO */ } else { @@ -745,6 +758,10 @@ PX4IO::init() } } + /* Indicate restart type is power on */ + sys_restart_val = DM_INIT_REASON_POWER_ON; + param_set(sys_restart_param, &sys_restart_val); + } /* try to claim the generic PWM output device node as well - it's OK if we fail at this */ |