mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-17 02:52:12 +01:00
Change to object template so when they are already registered it doesn't
initialize them a second time (which causes the handle to get lost)
This commit is contained in:
parent
5044ea36de
commit
2218ff6fe9
@ -45,10 +45,14 @@ static UAVObjHandle handle;
|
||||
/**
|
||||
* Initialize object.
|
||||
* \return 0 Success
|
||||
* \return -1 Failure
|
||||
* \return -1 Failure to initialize or -2 for already initialized
|
||||
*/
|
||||
int32_t $(NAME)Initialize(void)
|
||||
{
|
||||
// Don't set the handle to null if already registered
|
||||
if(UAVObjGetByID($(NAMEUC)_OBJID) != NULL)
|
||||
return -2;
|
||||
|
||||
// Register object with the object manager
|
||||
handle = UAVObjRegister($(NAMEUC)_OBJID, $(NAMEUC)_NAME, $(NAMEUC)_METANAME, 0,
|
||||
$(NAMEUC)_ISSINGLEINST, $(NAMEUC)_ISSETTINGS, $(NAMEUC)_NUMBYTES, &$(NAME)SetDefaults);
|
||||
|
Loading…
x
Reference in New Issue
Block a user