mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-05-17 10:17:35 +08:00
Dedicated error code for transfers of excessive length
This commit is contained in:
@@ -33,6 +33,7 @@ const int16_t ErrNotInited = 8;
|
||||
const int16_t ErrRecursiveCall = 9;
|
||||
const int16_t ErrLogic = 10;
|
||||
const int16_t ErrPassiveMode = 11; ///< Operation not permitted in passive mode
|
||||
const int16_t ErrTransferTooLong = 12; ///< Transfer of this length cannot be sent with given transfer type
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
@@ -21,8 +21,7 @@ int TransferSender::send(const uint8_t* payload, unsigned payload_len, Monotonic
|
||||
{
|
||||
if (payload_len > getMaxPayloadLenForTransferType(transfer_type))
|
||||
{
|
||||
UAVCAN_ASSERT(0);
|
||||
return -ErrInvalidParam;
|
||||
return -ErrTransferTooLong;
|
||||
}
|
||||
|
||||
Frame frame(data_type_.getID(), transfer_type, dispatcher_.getNodeID(), dst_node_id, 0, tid);
|
||||
@@ -129,6 +128,12 @@ int TransferSender::send(const uint8_t* payload, unsigned payload_len, Monotonic
|
||||
int TransferSender::send(const uint8_t* payload, unsigned payload_len, MonotonicTime tx_deadline,
|
||||
MonotonicTime blocking_deadline, TransferType transfer_type, NodeID dst_node_id)
|
||||
{
|
||||
// This check must be performed before TID is incremented to avoid skipping TID values on failures
|
||||
if (payload_len > getMaxPayloadLenForTransferType(transfer_type))
|
||||
{
|
||||
return -ErrTransferTooLong;
|
||||
}
|
||||
|
||||
const OutgoingTransferRegistryKey otr_key(data_type_.getID(), transfer_type, dst_node_id);
|
||||
|
||||
UAVCAN_ASSERT(!tx_deadline.isZero());
|
||||
|
||||
Reference in New Issue
Block a user