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:
Jukka Laitinen
2022-02-24 11:50:05 -05:00
committed by Daniel Agar
parent 611d50edf3
commit caaa13ddc0
4 changed files with 42 additions and 10 deletions
+24 -3
View File
@@ -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