Browse Source

Nuttx: fixed missing changes from AppMgr to AppState

Signed-off-by: Mark Charlebois <charlebm@gmail.com>
sbg
Mark Charlebois 10 years ago
parent
commit
fd7863270e
  1. 4
      src/examples/publisher/publisher_example.cpp
  2. 2
      src/examples/publisher/publisher_example.h
  3. 2
      src/examples/subscriber/subscriber_example.cpp
  4. 2
      src/examples/subscriber/subscriber_example.h
  5. 42
      src/modules/dataman/dataman.c
  6. 2
      src/modules/mc_att_control_multiplatform/mc_att_control.cpp
  7. 2
      src/modules/mc_att_control_multiplatform/mc_att_control.h
  8. 2
      src/modules/mc_pos_control_multiplatform/mc_pos_control.cpp
  9. 2
      src/modules/mc_pos_control_multiplatform/mc_pos_control.h

4
src/examples/publisher/publisher_example.cpp

@ -44,7 +44,7 @@ @@ -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() @@ -55,7 +55,7 @@ int PublisherExample::main()
{
px4::Rate loop_rate(10);
while (!mgr.exitRequested()) {
while (!appState.exitRequested()) {
loop_rate.sleep();
_n.spinOnce();

2
src/examples/publisher/publisher_example.h

@ -50,7 +50,7 @@ public: @@ -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;

2
src/examples/subscriber/subscriber_example.cpp

@ -49,7 +49,7 @@ void rc_channels_callback_function(const px4_rc_channels &msg) @@ -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)
{

2
src/examples/subscriber/subscriber_example.h

@ -58,7 +58,7 @@ protected: @@ -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);

42
src/modules/dataman/dataman.c

@ -40,7 +40,7 @@ @@ -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; @@ -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[]) @@ -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) @@ -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[]) @@ -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;
}

2
src/modules/mc_att_control_multiplatform/mc_att_control.cpp

@ -71,7 +71,7 @@ MulticopterAttitudeControl::MulticopterAttitudeControl() : @@ -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({

2
src/modules/mc_att_control_multiplatform/mc_att_control.h

@ -94,7 +94,7 @@ private: @@ -94,7 +94,7 @@ private:
px4::NodeHandle _n;
px4::AppMgr _mgr;
px4::AppState _appState;
struct {
px4::ParameterFloat roll_p;

2
src/modules/mc_pos_control_multiplatform/mc_pos_control.cpp

@ -65,7 +65,7 @@ MulticopterPositionControl::MulticopterPositionControl() : @@ -65,7 +65,7 @@ MulticopterPositionControl::MulticopterPositionControl() :
_local_pos_sp_msg(),
_global_vel_sp_msg(),
_n(_mgr),
_n(_appState),
/* parameters */
_params_handles({

2
src/modules/mc_pos_control_multiplatform/mc_pos_control.h

@ -107,7 +107,7 @@ protected: @@ -107,7 +107,7 @@ protected:
px4::NodeHandle _n;
px4::AppMgr _mgr;
px4::AppState _appState;
struct {
px4::ParameterFloat thr_min;

Loading…
Cancel
Save