Skip to content

Commit

Permalink
Merge pull request #1295 from bitcraze/krichardsson/force-assert
Browse files Browse the repository at this point in the history
Add parameter to force a failed assert
  • Loading branch information
tobbeanton authored Jun 8, 2023
2 parents 9ab7256 + f23f34c commit c163600
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/modules/src/system.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ static bool isInit;

static char nrf_version[16];
static uint8_t testLogParam;
static uint8_t doAssert;

STATIC_MEM_TASK_ALLOC(systemTask, SYSTEM_TASK_STACKSIZE);

Expand Down Expand Up @@ -408,6 +409,12 @@ void vApplicationIdleHook( void )
#endif
}

static void doAssertCallback(void) {
if (doAssert) {
ASSERT_FAILED();
}
}

/**
* This parameter group contain read-only parameters pertaining to the CPU
* in the Crazyflie.
Expand Down Expand Up @@ -456,6 +463,13 @@ PARAM_ADD(PARAM_UINT8, assertInfo, &dumpAssertInfo)
*/
PARAM_ADD(PARAM_UINT8, testLogParam, &testLogParam)

/**
* @brief Set to non-zero to trigger a failed assert, useful for debugging
*
*/
PARAM_ADD_WITH_CALLBACK(PARAM_UINT8, doAssert, &doAssert, doAssertCallback)


PARAM_GROUP_STOP(system)

/**
Expand Down

0 comments on commit c163600

Please sign in to comment.