Browse Source

muorb: don't start muorb with stop command

Previously using 'muorb stop' would in fact start at least part of the
muorb which is not what it's expected to do.
sbg
Julian Oes 9 years ago
parent
commit
e4398bc87c
  1. 25
      src/modules/muorb/krait/muorb_main.cpp
  2. 9
      src/modules/muorb/krait/uORBKraitFastRpcChannel.hpp

25
src/modules/muorb/krait/muorb_main.cpp

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
/****************************************************************************
*
* Copyright (c) 2012-2015 PX4 Development Team. All rights reserved.
* Copyright (c) 2012-2016 PX4 Development Team. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@ -57,18 +57,26 @@ muorb_main(int argc, char *argv[]) @@ -57,18 +57,26 @@ muorb_main(int argc, char *argv[])
* XXX it would be nice to have a wrapper for this...
*/
if (!strcmp(argv[1], "start")) {
// register the fast rpc channel with UORB.
uORB::Manager::get_instance()->set_uorb_communicator(uORB::KraitFastRpcChannel::GetInstance());
if (uORB::KraitFastRpcChannel::isInstance()) {
PX4_WARN("muorb already running");
} else {
// register the fast rpc channel with UORB.
uORB::Manager::get_instance()->set_uorb_communicator(uORB::KraitFastRpcChannel::GetInstance());
// start the KaitFastRPC channel thread.
uORB::KraitFastRpcChannel::GetInstance()->Start();
// start the KaitFastRPC channel thread.
uORB::KraitFastRpcChannel::GetInstance()->Start();
}
return OK;
}
if (!strcmp(argv[1], "stop")) {
uORB::KraitFastRpcChannel::GetInstance()->Stop();
if (uORB::KraitFastRpcChannel::isInstance()) {
uORB::KraitFastRpcChannel::GetInstance()->Stop();
} else {
PX4_WARN("muorb not running");
}
return OK;
}
@ -76,6 +84,11 @@ muorb_main(int argc, char *argv[]) @@ -76,6 +84,11 @@ muorb_main(int argc, char *argv[])
* Print driver information.
*/
if (!strcmp(argv[1], "status")) {
if (uORB::KraitFastRpcChannel::isInstance()) {
PX4_WARN("muorb running");
} else {
PX4_WARN("muorb not running");
}
return OK;
}

9
src/modules/muorb/krait/uORBKraitFastRpcChannel.hpp

@ -62,6 +62,15 @@ public: @@ -62,6 +62,15 @@ public:
return _InstancePtr;
}
/**
* Static method to check if there is an instance.
*/
static bool isInstance()
{
return (_InstancePtr != nullptr);
}
/**
* @brief Interface to notify the remote entity of interest of a
* subscription for a message.

Loading…
Cancel
Save