Skip to content

Commit

Permalink
uORB remove unnecessary priority from each subscriber
Browse files Browse the repository at this point in the history
  • Loading branch information
dagar authored and LorenzMeier committed Oct 20, 2018
1 parent 297c1b7 commit 526fa9e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 10 deletions.
8 changes: 1 addition & 7 deletions src/modules/uORB/uORBDeviceNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,6 @@ uORB::DeviceNode::open(cdev::file_t *filp)
/* If there were any previous publications, allow the subscriber to read them */
sd->generation = _generation - (_queue_size < _generation ? _queue_size : _generation);

/* set priority */
sd->set_priority(_priority);

FILE_PRIV(filp) = (void *)sd;

ret = CDev::open(filp);
Expand Down Expand Up @@ -215,9 +212,6 @@ uORB::DeviceNode::read(cdev::file_t *filp, char *buffer, size_t buflen)
++sd->generation;
}

/* set priority */
sd->set_priority(_priority);

/*
* Clear the flag that indicates that an update has been reported, as
* we have just collected it.
Expand Down Expand Up @@ -362,7 +356,7 @@ uORB::DeviceNode::ioctl(cdev::file_t *filp, int cmd, unsigned long arg)
return PX4_OK;

case ORBIOCGPRIORITY:
*(int *)arg = sd->priority();
*(int *)arg = get_priority();
return PX4_OK;

case ORBIOCSETQUEUESIZE:
Expand Down
4 changes: 1 addition & 3 deletions src/modules/uORB/uORBDeviceNode.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ class uORB::DeviceNode : public cdev::CDev
unsigned int published_message_count() const { return _generation; }
const struct orb_metadata *get_meta() const { return _meta; }

int get_priority() const { return _priority; }
void set_priority(uint8_t priority) { _priority = priority; }

protected:
Expand All @@ -196,9 +197,6 @@ class uORB::DeviceNode : public cdev::CDev
int flags; /**< lowest 8 bits: priority of publisher, 9. bit: update_reported bit */
UpdateIntervalData *update_interval; /**< if null, no update interval */

int priority() const { return flags & 0xff; }
void set_priority(uint8_t prio) { flags = (flags & ~0xff) | prio; }

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); }
};
Expand Down

0 comments on commit 526fa9e

Please sign in to comment.