aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMark Charlebois <charlebm@gmail.com>2015-03-13 16:58:24 -0700
committerMark Charlebois <charlebm@gmail.com>2015-04-20 11:00:18 -0700
commitfd7863270e77a90fd309642b1707eb7424c0decb (patch)
tree9591e121d600c3c42a88028f97da8da54f509cc1 /src
parent7b0783a0701cdbd5b74c9e11fe9b45b1e5672a4c (diff)
downloadpx4-firmware-fd7863270e77a90fd309642b1707eb7424c0decb.tar.gz
px4-firmware-fd7863270e77a90fd309642b1707eb7424c0decb.tar.bz2
px4-firmware-fd7863270e77a90fd309642b1707eb7424c0decb.zip
Nuttx: fixed missing changes from AppMgr to AppState
Signed-off-by: Mark Charlebois <charlebm@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/examples/publisher/publisher_example.cpp4
-rw-r--r--src/examples/publisher/publisher_example.h2
-rw-r--r--src/examples/subscriber/subscriber_example.cpp2
-rw-r--r--src/examples/subscriber/subscriber_example.h2
-rw-r--r--src/modules/dataman/dataman.c42
-rw-r--r--src/modules/mc_att_control_multiplatform/mc_att_control.cpp2
-rw-r--r--src/modules/mc_att_control_multiplatform/mc_att_control.h2
-rw-r--r--src/modules/mc_pos_control_multiplatform/mc_pos_control.cpp2
-rw-r--r--src/modules/mc_pos_control_multiplatform/mc_pos_control.h2
9 files changed, 38 insertions, 22 deletions
diff --git a/src/examples/publisher/publisher_example.cpp b/src/examples/publisher/publisher_example.cpp
index 4fddd072e..7ce153312 100644
--- a/src/examples/publisher/publisher_example.cpp
+++ b/src/examples/publisher/publisher_example.cpp
@@ -44,7 +44,7 @@
using namespace px4;
PublisherExample::PublisherExample() :
- _n(mgr),
+ _n(appState),
_rc_channels_pub(_n.advertise<px4_rc_channels>()),
_v_att_pub(_n.advertise<px4_vehicle_attitude>()),
_parameter_update_pub(_n.advertise<px4_parameter_update>())
@@ -55,7 +55,7 @@ int PublisherExample::main()
{
px4::Rate loop_rate(10);
- while (!mgr.exitRequested()) {
+ while (!appState.exitRequested()) {
loop_rate.sleep();
_n.spinOnce();
diff --git a/src/examples/publisher/publisher_example.h b/src/examples/publisher/publisher_example.h
index 8b0d806bd..284132073 100644
--- a/src/examples/publisher/publisher_example.h
+++ b/src/examples/publisher/publisher_example.h
@@ -50,7 +50,7 @@ public:
int main();
- static px4::AppMgr mgr;
+ static px4::AppState appState;
protected:
px4::NodeHandle _n;
px4::Publisher<px4::px4_rc_channels> *_rc_channels_pub;
diff --git a/src/examples/subscriber/subscriber_example.cpp b/src/examples/subscriber/subscriber_example.cpp
index 91fb131f3..ae58f634c 100644
--- a/src/examples/subscriber/subscriber_example.cpp
+++ b/src/examples/subscriber/subscriber_example.cpp
@@ -49,7 +49,7 @@ void rc_channels_callback_function(const px4_rc_channels &msg)
}
SubscriberExample::SubscriberExample() :
- _n(_mgr),
+ _n(_appState),
_p_sub_interv("SUB_INTERV", PARAM_SUB_INTERV_DEFAULT),
_p_test_float("SUB_TESTF", PARAM_SUB_TESTF_DEFAULT)
{
diff --git a/src/examples/subscriber/subscriber_example.h b/src/examples/subscriber/subscriber_example.h
index 8003525dd..4fdd23636 100644
--- a/src/examples/subscriber/subscriber_example.h
+++ b/src/examples/subscriber/subscriber_example.h
@@ -58,7 +58,7 @@ protected:
px4::ParameterFloat _p_test_float;
px4::Subscriber<px4_rc_channels> *_sub_rc_chan;
- AppMgr _mgr;
+ AppState _appState;
void rc_channels_callback(const px4_rc_channels &msg);
void vehicle_attitude_callback(const px4_vehicle_attitude &msg);
diff --git a/src/modules/dataman/dataman.c b/src/modules/dataman/dataman.c
index c3b4ab8d4..9b64b8baa 100644
--- a/src/modules/dataman/dataman.c
+++ b/src/modules/dataman/dataman.c
@@ -40,7 +40,7 @@
* @author Thomas Gubler
*/
-#include <px4_config.h>
+#include <px4_platform.h>
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
@@ -129,7 +129,12 @@ static sem_t g_sys_state_mutex;
/* The data manager store file handle and file name */
static int g_fd = -1, g_task_fd = -1;
+// FIXME - need a configurable path that is not OS specific
+#ifdef __PX4_NUTTX
static const char *k_data_manager_device_path = "/fs/microsd/dataman";
+#else
+static const char *k_data_manager_device_path = "/tmp/dataman";
+#endif
/* The data manager work queues */
@@ -668,7 +673,7 @@ task_main(int argc, char *argv[])
}
/* Open or create the data manager file */
- g_task_fd = open(k_data_manager_device_path, O_RDWR | O_CREAT | O_BINARY);
+ g_task_fd = open(k_data_manager_device_path, O_RDWR | O_CREAT | O_BINARY, 0x0777);
if (g_task_fd < 0) {
warnx("Could not open data manager file %s", k_data_manager_device_path);
@@ -827,31 +832,40 @@ stop(void)
static void
usage(void)
{
- errx(1, "usage: dataman {start|stop|status|poweronrestart|inflightrestart}");
+ warnx("usage: dataman {start|stop|status|poweronrestart|inflightrestart}");
}
int
dataman_main(int argc, char *argv[])
{
- if (argc < 2)
+ if (argc < 2) {
usage();
+ return -1;
+ }
if (!strcmp(argv[1], "start")) {
- if (g_fd >= 0)
- errx(1, "already running");
+ if (g_fd >= 0) {
+ warnx("dataman already running");
+ return -1;
+ }
start();
- if (g_fd < 0)
- errx(1, "start failed");
+ if (g_fd < 0) {
+ warnx("dataman start failed");
+ return -1;
+ }
- exit(0);
+ return 0;
}
/* Worker thread should be running for all other commands */
- if (g_fd < 0)
- errx(1, "not running");
+ if (g_fd < 0) {
+ warnx("dataman worker thread not running");
+ usage();
+ return -1;
+ }
if (!strcmp(argv[1], "stop"))
stop();
@@ -861,8 +875,10 @@ dataman_main(int argc, char *argv[])
dm_restart(DM_INIT_REASON_POWER_ON);
else if (!strcmp(argv[1], "inflightrestart"))
dm_restart(DM_INIT_REASON_IN_FLIGHT);
- else
+ else {
usage();
+ return -1;
+ }
- exit(1);
+ return 1;
}
diff --git a/src/modules/mc_att_control_multiplatform/mc_att_control.cpp b/src/modules/mc_att_control_multiplatform/mc_att_control.cpp
index 34859071f..e478a92e9 100644
--- a/src/modules/mc_att_control_multiplatform/mc_att_control.cpp
+++ b/src/modules/mc_att_control_multiplatform/mc_att_control.cpp
@@ -71,7 +71,7 @@ MulticopterAttitudeControl::MulticopterAttitudeControl() :
_att_sp_pub(nullptr),
_v_rates_sp_pub(nullptr),
_actuators_0_pub(nullptr),
- _n(_mgr),
+ _n(_appState),
/* parameters */
_params_handles({
diff --git a/src/modules/mc_att_control_multiplatform/mc_att_control.h b/src/modules/mc_att_control_multiplatform/mc_att_control.h
index 50f06d696..aab41f97b 100644
--- a/src/modules/mc_att_control_multiplatform/mc_att_control.h
+++ b/src/modules/mc_att_control_multiplatform/mc_att_control.h
@@ -94,7 +94,7 @@ private:
px4::NodeHandle _n;
- px4::AppMgr _mgr;
+ px4::AppState _appState;
struct {
px4::ParameterFloat roll_p;
diff --git a/src/modules/mc_pos_control_multiplatform/mc_pos_control.cpp b/src/modules/mc_pos_control_multiplatform/mc_pos_control.cpp
index 1fd86fd50..72ee21429 100644
--- a/src/modules/mc_pos_control_multiplatform/mc_pos_control.cpp
+++ b/src/modules/mc_pos_control_multiplatform/mc_pos_control.cpp
@@ -65,7 +65,7 @@ MulticopterPositionControl::MulticopterPositionControl() :
_local_pos_sp_msg(),
_global_vel_sp_msg(),
- _n(_mgr),
+ _n(_appState),
/* parameters */
_params_handles({
diff --git a/src/modules/mc_pos_control_multiplatform/mc_pos_control.h b/src/modules/mc_pos_control_multiplatform/mc_pos_control.h
index 3c6f28050..4f786c429 100644
--- a/src/modules/mc_pos_control_multiplatform/mc_pos_control.h
+++ b/src/modules/mc_pos_control_multiplatform/mc_pos_control.h
@@ -107,7 +107,7 @@ protected:
px4::NodeHandle _n;
- px4::AppMgr _mgr;
+ px4::AppState _appState;
struct {
px4::ParameterFloat thr_min;