mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-12-02 22:40:27 +08:00
refactor(uORB): share the SubscriptionMultiArray initialisation to save flash (#29547)
The constructor loop that assigns and subscribes every instance was expanded into each of the ~55 SubscriptionMultiArray members in the firmware. Move it into a non-template function in Subscription.cpp, called with the array, its size and the topic. px4_fmu-v6x_default: 1918712 -> 1917160 bytes of text, -1552 B. Assisted-by: Claude:claude-fable-5-1 Co-authored-by: Balduin <balduin@auterion.com>
This commit is contained in:
1 parent
b15cb5170c
commit
5196d31507
2 files changed
+16
-7
No files matched your search
@@ -37,6 +37,7 @@
|
||||
*/
|
||||
|
||||
#include "Subscription.hpp"
|
||||
#include "SubscriptionMultiArray.hpp"
|
||||
#include <px4_platform_common/defines.h>
|
||||
|
||||
namespace uORB
|
||||
@@ -194,4 +195,12 @@ bool Subscription::updated()
|
||||
return false;
|
||||
}
|
||||
|
||||
void subscribeMultiArray(Subscription *subscriptions, uint8_t count, ORB_ID id)
|
||||
{
|
||||
for (uint8_t i = 0; i < count; i++) {
|
||||
subscriptions[i] = Subscription{id, i};
|
||||
subscriptions[i].subscribe();
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace uORB
|
||||
Reference in new issue
Block a user