mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-22 05:53:34 +08:00
Automated style fixes in order to bring the code a little bit closer to compliance with MISRA C++ rules. No changes in logic.
This commit is contained in:
@@ -89,16 +89,20 @@ int DataTypeInfoProvider::start()
|
||||
res = cats_srv_.start(
|
||||
ComputeAggregateTypeSignatureCallback(this, &DataTypeInfoProvider::handleComputeAggregateTypeSignatureRequest));
|
||||
if (res < 0)
|
||||
{
|
||||
goto fail;
|
||||
}
|
||||
|
||||
res = gdti_srv_.start(GetDataTypeInfoCallback(this, &DataTypeInfoProvider::handleGetDataTypeInfoRequest));
|
||||
if (res < 0)
|
||||
{
|
||||
goto fail;
|
||||
}
|
||||
|
||||
assert(res >= 0);
|
||||
return res;
|
||||
|
||||
fail:
|
||||
fail:
|
||||
assert(res < 0);
|
||||
cats_srv_.stop();
|
||||
gdti_srv_.stop();
|
||||
|
||||
@@ -13,8 +13,8 @@ bool NodeStatusProvider::isNodeInfoInitialized() const
|
||||
{
|
||||
// Hardware version is not required
|
||||
return (node_info_.software_version != protocol::SoftwareVersion()) &&
|
||||
(node_info_.uavcan_version != protocol::SoftwareVersion()) &&
|
||||
(!node_info_.name.empty());
|
||||
(node_info_.uavcan_version != protocol::SoftwareVersion()) &&
|
||||
(!node_info_.name.empty());
|
||||
}
|
||||
|
||||
int NodeStatusProvider::publish()
|
||||
@@ -32,7 +32,9 @@ void NodeStatusProvider::publishWithErrorHandling()
|
||||
{
|
||||
const int res = publish();
|
||||
if (res < 0)
|
||||
{
|
||||
getNode().registerInternalFailure("NodeStatus publication failed");
|
||||
}
|
||||
}
|
||||
|
||||
void NodeStatusProvider::handleTimerEvent(const TimerEvent&)
|
||||
@@ -67,21 +69,27 @@ int NodeStatusProvider::startAndPublish()
|
||||
|
||||
res = publish(); // Initial broadcast
|
||||
if (res < 0)
|
||||
{
|
||||
goto fail;
|
||||
}
|
||||
|
||||
res = gdr_sub_.start(GlobalDiscoveryRequestCallback(this, &NodeStatusProvider::handleGlobalDiscoveryRequest));
|
||||
if (res < 0)
|
||||
{
|
||||
goto fail;
|
||||
}
|
||||
|
||||
res = gni_srv_.start(GetNodeInfoCallback(this, &NodeStatusProvider::handleGetNodeInfoRequest));
|
||||
if (res < 0)
|
||||
{
|
||||
goto fail;
|
||||
}
|
||||
|
||||
Timer::startPeriodic(MonotonicDuration::fromMSec(protocol::NodeStatus::PUBLICATION_PERIOD_MS));
|
||||
|
||||
return res;
|
||||
|
||||
fail:
|
||||
fail:
|
||||
assert(res < 0);
|
||||
gdr_sub_.stop();
|
||||
gni_srv_.stop();
|
||||
|
||||
@@ -29,7 +29,9 @@ void PanicBroadcaster::panic(const char* short_reason)
|
||||
while (p && *p)
|
||||
{
|
||||
if (msg_.reason_text.size() == msg_.reason_text.capacity())
|
||||
{
|
||||
break;
|
||||
}
|
||||
msg_.reason_text.push_back(*p);
|
||||
p++;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user