mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-07-14 06:00:35 +08:00
uORB: Added a new uorb_shutdown function that is called during normal shutdown procedures. It will only
call into a new UORB COMMUNICATOR ICHANNEL shutdown interface if it has been configured, otherwise it does nothing. This allows ICHANNEL implementations to pass on a shutdown indication to a remote processor. Implemented the shutdown interface in the muorb module for VOXL flight controllers.
This commit is contained in:
committed by
Eric Katzfey
parent
dbb00d500f
commit
1dbee4100a
@@ -58,7 +58,9 @@ muorb_init()
|
||||
if (channel && channel->Initialize(enable_debug)) {
|
||||
uORB::Manager::get_instance()->set_uorb_communicator(channel);
|
||||
|
||||
if (channel->Test()) { return OK; }
|
||||
if (channel->Test()) {
|
||||
return OK;
|
||||
}
|
||||
}
|
||||
|
||||
return -EINVAL;
|
||||
|
||||
@@ -291,6 +291,20 @@ int16_t uORB::AppsProtobufChannel::register_handler(uORBCommunicator::IChannelRx
|
||||
return 0;
|
||||
}
|
||||
|
||||
int16_t uORB::AppsProtobufChannel::shutdown()
|
||||
{
|
||||
if (_ShutdownRequested) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
_ShutdownRequested = true;
|
||||
|
||||
PX4_ERR("Sending kill command to SLPI!!!");
|
||||
fc_sensor_kill_slpi();
|
||||
sleep(1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int16_t uORB::AppsProtobufChannel::send_message(const char *messageName, int length, uint8_t *data)
|
||||
{
|
||||
// This is done to slow down high rate debug messages.
|
||||
|
||||
@@ -147,6 +147,16 @@ public:
|
||||
*/
|
||||
int16_t send_message(const char *messageName, int length, uint8_t *data);
|
||||
|
||||
/**
|
||||
* @brief Interface to notify the remote entity of a shutdown.
|
||||
*
|
||||
* @return
|
||||
* 0 = success; This means the shutdown is successfully sent to the receiver
|
||||
* Note: This does not mean that the receiver has received it.
|
||||
* otherwise = failure.
|
||||
*/
|
||||
int16_t shutdown();
|
||||
|
||||
/**
|
||||
* @brief Interface to test the functions of the protobuf channel.
|
||||
*
|
||||
@@ -169,6 +179,7 @@ private:
|
||||
static bool _Debug;
|
||||
|
||||
bool _Initialized;
|
||||
bool _ShutdownRequested{false};
|
||||
uint32_t _MessageCounter;
|
||||
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user