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:
Beat Küng
2016-10-18 13:20:19 +02:00
committed by Lorenz Meier
parent 03c12c4c78
commit c50e4a6e21
2 changed files with 9 additions and 12 deletions
+5 -7
View File
@@ -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;
}