parameters: param type checking use PX4_ERR and enable in PX4_SITL

This commit is contained in:
Daniel Agar 2021-11-19 11:49:33 -05:00
parent 7faaad79d0
commit cbb743c64d
1 changed files with 8 additions and 2 deletions

View File

@ -446,12 +446,18 @@ __END_DECLS
#if defined(__cplusplus) && !defined(PARAM_IMPLEMENTATION)
#if 0 // set to 1 to debug param type mismatches
#if defined(CONFIG_ARCH_BOARD_PX4_SITL) || 0 // set to 1 to debug param type mismatches
#include <cstdio>
#include <px4_platform_common/log.h>
#ifndef MODULE_NAME
#define MODULE_NAME "px4"
#endif
#define CHECK_PARAM_TYPE(param, type) \
if (param_type(param) != type) { \
/* use printf() to avoid having to use more includes */ \
printf("wrong type passed to param_get() for param %s\n", param_name(param)); \
PX4_ERR("wrong type passed to param_get() for param %s", param_name(param)); \
}
#else
#define CHECK_PARAM_TYPE(param, type)