mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-07-12 19:40:34 +08:00
uORB::DeviceNode: reduce the size of some members
The limits the maximum queue size to 255, which I think is ok for the forseable future. sizeof(uORB::DeviceNode) is reduces from 128 to 112 on NuttX, and with ~80 instances, this saves over 1KB of RAM.
This commit is contained in:
@@ -93,14 +93,11 @@ uORB::DeviceNode::DeviceNode(const struct orb_metadata *meta, const char *name,
|
||||
_data(nullptr),
|
||||
_last_update(0),
|
||||
_generation(0),
|
||||
_priority(priority),
|
||||
_priority((uint8_t)priority),
|
||||
_published(false),
|
||||
_queue_size(queue_size),
|
||||
_publisher(0),
|
||||
#ifdef __PX4_NUTTX
|
||||
_IsRemoteSubscriberPresent(false),
|
||||
#endif
|
||||
_subscriber_count(0)
|
||||
_subscriber_count(0),
|
||||
_publisher(0)
|
||||
{
|
||||
// enable debug() calls
|
||||
//_debug_enabled = true;
|
||||
@@ -749,7 +746,8 @@ int uORB::DeviceNode::update_queue_size(unsigned int queue_size)
|
||||
return PX4_OK;
|
||||
}
|
||||
|
||||
if (_data || _queue_size > queue_size) {
|
||||
//queue size is limited to 255 for the single reason that we use uint8 to store it
|
||||
if (_data || _queue_size > queue_size || queue_size > 255) {
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user