mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-05-23 15:27:35 +08:00
Fixed message definitions; added a compile-time check for maximum serialized message length
This commit is contained in:
@@ -7,4 +7,4 @@ uint8 sysid
|
||||
uint8 compid
|
||||
uint8 msgid
|
||||
|
||||
uint8[<256] payload
|
||||
uint8[<=105] payload
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
# Generic named parameter (key/value pair).
|
||||
#
|
||||
|
||||
uint8[<=92] key
|
||||
bool alignment
|
||||
uint8[<=100] key
|
||||
|
||||
uavcan.protocol.param.Value value
|
||||
float64[<=1] value
|
||||
|
||||
@@ -4,4 +4,4 @@
|
||||
|
||||
LogLevel level
|
||||
uint8[<32] source
|
||||
uint8[<128] text
|
||||
uint8[<94] text
|
||||
|
||||
@@ -94,7 +94,11 @@ struct UAVCAN_EXPORT ${t.cpp_type_name}
|
||||
% endfor
|
||||
{
|
||||
enum { MaxByteLen = ::uavcan::BitLenToByteLen<MaxBitLen>::Result };
|
||||
::uavcan::StaticAssert<int(MaxByteLen) <= int(::uavcan::MaxPossibleTransferPayloadLen)>::check();
|
||||
% if (t.kind == t.KIND_MESSAGE) and (t.has_default_dtid):
|
||||
::uavcan::StaticAssert<int(MaxByteLen) <= int(::uavcan::MaxMessageBroadcastTransferPayloadLen)>::check();
|
||||
% else:
|
||||
::uavcan::StaticAssert<int(MaxByteLen) <= int(::uavcan::MaxServiceTransferPayloadLen)>::check();
|
||||
% endif
|
||||
|
||||
::uavcan::StaticAssert<_tmpl == 0>::check(); // Usage check
|
||||
|
||||
|
||||
Reference in New Issue
Block a user