Skip to content
Snippets Groups Projects
Commit e91db7b4 authored by Beat Küng's avatar Beat Küng Committed by Lorenz Meier
Browse files

uORBDeviceNode: move flags from SubscriberData to UpdateIntervalData

As there is only one bit used in 'flags', and it is only used in case
update_interval is not null, we can move the bit to UpdateIntervalData.

The size of UpdateIntervalData does not increase (on 32 bit).

Reduces RAM usage by 3.6KB (tested on a Pixracer).
parent 90cee2d5
No related branches found
No related tags found
No related merge requests found
......@@ -184,21 +184,23 @@ protected:
private:
struct UpdateIntervalData {
unsigned interval; /**< if nonzero minimum interval between updates */
struct hrt_call update_call; /**< deferred wakeup call if update_period is nonzero */
#ifndef __PX4_NUTTX
uint64_t last_update; /**< time at which the last update was provided, used when update_interval is nonzero */
#endif
unsigned interval; /**< if nonzero minimum interval between updates */
bool update_reported;
};
struct SubscriberData {
~SubscriberData() { if (update_interval) { delete (update_interval); } }
unsigned generation; /**< last generation the subscriber has seen */
int flags; /**< lowest 8 bits: priority of publisher, 9. bit: update_reported bit */
UpdateIntervalData *update_interval; /**< if null, no update interval */
bool update_reported() const { return flags & (1 << 8); }
void set_update_reported(bool update_reported_flag) { flags = (flags & ~(1 << 8)) | (((int)update_reported_flag) << 8); }
// these flags are only used if update_interval != null
bool update_reported() const { return update_interval ? update_interval->update_reported : false; }
void set_update_reported(bool update_reported_flag)
{ if (update_interval) { update_interval->update_reported = update_reported_flag; } }
};
const struct orb_metadata *_meta; /**< object metadata information */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment