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:
Jacob DahlandBalduin authored and GitHub committed 2026-10-31 11:57:26 -06:00
1 parent b15cb5170c
commit 5196d31507
2 files changed
+16 -7

No files matched your search

+9
View File
@@ -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