mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-30 15:52:12 +01:00
OP-1704 - Reenable an hook if it is reattached
This commit is contained in:
parent
a8e89dffcd
commit
108c74da3e
@ -341,7 +341,18 @@ FrameType_t GetCurrentFrameType()
|
||||
void SANITYCHECK_AttachHook(SANITYCHECK_CustomHook_function *hook)
|
||||
{
|
||||
PIOS_Assert(hook);
|
||||
SANITYCHECK_CustomHookInstance *instance = (SANITYCHECK_CustomHookInstance *)pios_malloc(sizeof(SANITYCHECK_CustomHookInstance));
|
||||
SANITYCHECK_CustomHookInstance *instance = NULL;
|
||||
|
||||
// Check whether there is an existing instance and enable it
|
||||
LL_FOREACH(hooks, instance) {
|
||||
if (instance->hook == hook) {
|
||||
instance->enabled = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// No existing instance found, attach this new one
|
||||
instance = (SANITYCHECK_CustomHookInstance *)pios_malloc(sizeof(SANITYCHECK_CustomHookInstance));
|
||||
PIOS_Assert(instance);
|
||||
instance->hook = hook;
|
||||
instance->next = NULL;
|
||||
|
Loading…
x
Reference in New Issue
Block a user