mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-18 03:52:11 +01:00
LP-523 uavobject.c.template: Invoke new method $(NAME)DataOverrideDefaults() from $(NAME)SetDefaults()
This commit is contained in:
parent
27312c4895
commit
d52f5a02f8
@ -71,6 +71,8 @@ typedef struct {
|
||||
*/
|
||||
typedef $(NAME)DataPacked __attribute__((aligned(4))) $(NAME)Data;
|
||||
|
||||
void $(NAME)DataOverrideDefaults($(NAME)Data * data);
|
||||
|
||||
/* Typesafe Object access functions */
|
||||
static inline int32_t $(NAME)Get($(NAME)Data * dataOut) {
|
||||
return UAVObjGetData($(NAME)Handle(), dataOut);
|
||||
|
@ -71,6 +71,10 @@ int32_t $(NAME)Initialize(void)
|
||||
return handle ? 0 : -1;
|
||||
}
|
||||
|
||||
static inline void DataOverrideDefaults(__attribute__((unused)) $(NAME)Data * data) {}
|
||||
|
||||
void $(NAME)DataOverrideDefaults($(NAME)Data * data) __attribute__((weak, alias("DataOverrideDefaults")));
|
||||
|
||||
/**
|
||||
* Initialize object fields and metadata with the default values.
|
||||
* If a default value is not specified the object fields
|
||||
@ -84,6 +88,7 @@ void $(NAME)SetDefaults(UAVObjHandle obj, uint16_t instId)
|
||||
UAVObjGetInstanceData(obj, instId, &data);
|
||||
memset(&data, 0, sizeof($(NAME)Data));
|
||||
$(INITFIELDS)
|
||||
$(NAME)DataOverrideDefaults(&data);
|
||||
UAVObjSetInstanceData(obj, instId, &data);
|
||||
|
||||
// Initialize object metadata to their default values
|
||||
|
Loading…
x
Reference in New Issue
Block a user