mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-26 15:43:34 +08:00
uORB performance updates
Move some logic from Subscriber into uORBManager. This reduces calls from the modules to the uORB manager, improving performance in protected build. Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
This commit is contained in:
committed by
Daniel Agar
parent
611d50edf3
commit
caaa13ddc0
@@ -136,19 +136,40 @@ public:
|
||||
/**
|
||||
* Check if there is a new update.
|
||||
*/
|
||||
bool updated() { return advertised() && Manager::updates_available(_node, _last_generation); }
|
||||
bool updated()
|
||||
{
|
||||
if (!valid()) {
|
||||
subscribe();
|
||||
}
|
||||
|
||||
return valid() ? Manager::updates_available(_node, _last_generation) : false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the struct
|
||||
* @param dst The uORB message struct we are updating.
|
||||
*/
|
||||
bool update(void *dst) { return updated() && Manager::orb_data_copy(_node, dst, _last_generation); }
|
||||
bool update(void *dst)
|
||||
{
|
||||
if (!valid()) {
|
||||
subscribe();
|
||||
}
|
||||
|
||||
return valid() ? Manager::orb_data_copy(_node, dst, _last_generation, true) : false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy the struct
|
||||
* @param dst The uORB message struct we are updating.
|
||||
*/
|
||||
bool copy(void *dst) { return advertised() && Manager::orb_data_copy(_node, dst, _last_generation); }
|
||||
bool copy(void *dst)
|
||||
{
|
||||
if (!valid()) {
|
||||
subscribe();
|
||||
}
|
||||
|
||||
return valid() ? Manager::orb_data_copy(_node, dst, _last_generation, false) : false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Change subscription instance
|
||||
|
||||
Reference in New Issue
Block a user