mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-21 21:43:33 +08:00
libuavcan passive mode support
This commit is contained in:
@@ -62,10 +62,15 @@ int NodeStatusProvider::startAndPublish()
|
||||
return -ErrNotInited;
|
||||
}
|
||||
|
||||
int res = publish(); // Initial broadcast
|
||||
if (res < 0)
|
||||
int res = -1;
|
||||
|
||||
if (!getNode().isPassiveMode())
|
||||
{
|
||||
goto fail;
|
||||
res = publish(); // Initial broadcast
|
||||
if (res < 0)
|
||||
{
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
|
||||
res = gdr_sub_.start(GlobalDiscoveryRequestCallback(this, &NodeStatusProvider::handleGlobalDiscoveryRequest));
|
||||
@@ -80,7 +85,10 @@ int NodeStatusProvider::startAndPublish()
|
||||
goto fail;
|
||||
}
|
||||
|
||||
TimerBase::startPeriodic(MonotonicDuration::fromMSec(protocol::NodeStatus::PUBLICATION_PERIOD_MS));
|
||||
if (!getNode().isPassiveMode())
|
||||
{
|
||||
TimerBase::startPeriodic(MonotonicDuration::fromMSec(protocol::NodeStatus::PUBLICATION_PERIOD_MS));
|
||||
}
|
||||
|
||||
return res;
|
||||
|
||||
|
||||
@@ -19,6 +19,11 @@ int TransferSender::send(const uint8_t* payload, int payload_len, MonotonicTime
|
||||
MonotonicTime blocking_deadline, TransferType transfer_type, NodeID dst_node_id,
|
||||
TransferID tid)
|
||||
{
|
||||
if (dispatcher_.isPassiveMode())
|
||||
{
|
||||
return -ErrPassiveMode;
|
||||
}
|
||||
|
||||
dispatcher_.getTransferPerfCounter().addTxTransfer();
|
||||
|
||||
Frame frame(data_type_.getID(), transfer_type, dispatcher_.getNodeID(), dst_node_id, 0, tid);
|
||||
|
||||
Reference in New Issue
Block a user