mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-05-01 03:04:07 +08:00
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.
This commit is contained in:
parent
338ccb34f5
commit
e4398bc87c
@ -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[])
|
||||
* 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[])
|
||||
* Print driver information.
|
||||
*/
|
||||
if (!strcmp(argv[1], "status")) {
|
||||
if (uORB::KraitFastRpcChannel::isInstance()) {
|
||||
PX4_WARN("muorb running");
|
||||
} else {
|
||||
PX4_WARN("muorb not running");
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
||||
@ -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…
x
Reference in New Issue
Block a user