mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-23 10:33:34 +08:00
parameters lib convert to c++ (#10267)
This commit is contained in:
@@ -38,10 +38,9 @@ if("${CONFIG_SHMEM}" STREQUAL "1")
|
||||
include_directories(${HEXAGON_SDK_INCLUDES})
|
||||
include_directories(${PX4_BINARY_DIR}/platforms/posix)
|
||||
list(APPEND SHMEM_SRCS
|
||||
shmem_posix.c
|
||||
shmem_posix.cpp
|
||||
)
|
||||
# TODO: This didn't seem to be tracked correctly from posix_eagle_release.cmake
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DCONFIG_SHMEM")
|
||||
add_definitions(-DCONFIG_SHMEM=1)
|
||||
set(EXTRA_DEPENDS generate_px4muorb_stubs)
|
||||
endif()
|
||||
|
||||
|
||||
@@ -58,10 +58,6 @@ __BEGIN_DECLS
|
||||
|
||||
long PX4_TICKS_PER_SEC = sysconf(_SC_CLK_TCK);
|
||||
|
||||
#ifdef CONFIG_SHMEM
|
||||
extern void init_params(void);
|
||||
#endif
|
||||
|
||||
__END_DECLS
|
||||
|
||||
namespace px4
|
||||
@@ -77,11 +73,6 @@ void init_once()
|
||||
hrt_work_queue_init();
|
||||
hrt_init();
|
||||
param_init();
|
||||
|
||||
#ifdef CONFIG_SHMEM
|
||||
PX4_DEBUG("Syncing params to shared memory\n");
|
||||
init_params();
|
||||
#endif
|
||||
}
|
||||
|
||||
void init(int argc, char *argv[], const char *app_name)
|
||||
|
||||
+3
-7
@@ -69,8 +69,7 @@ struct param_wbuf_s {
|
||||
/*update value and param's change bit in shared memory*/
|
||||
void update_to_shmem(param_t param, union param_value_u value)
|
||||
{
|
||||
if (px4muorb_param_update_to_shmem(param, (unsigned char *) &value,
|
||||
sizeof(value))) {
|
||||
if (px4muorb_param_update_to_shmem(param, (unsigned char *) &value, sizeof(value))) {
|
||||
PX4_ERR("krait update param %u failed", param);
|
||||
}
|
||||
}
|
||||
@@ -82,14 +81,12 @@ void update_index_from_shmem(void)
|
||||
return;
|
||||
}
|
||||
|
||||
px4muorb_param_update_index_from_shmem(adsp_changed_index,
|
||||
PARAM_BUFFER_SIZE);
|
||||
px4muorb_param_update_index_from_shmem(adsp_changed_index, PARAM_BUFFER_SIZE);
|
||||
}
|
||||
|
||||
static void update_value_from_shmem(param_t param, union param_value_u *value)
|
||||
{
|
||||
if (px4muorb_param_update_value_from_shmem(param, (unsigned char *) value,
|
||||
sizeof(union param_value_u))) {
|
||||
if (px4muorb_param_update_value_from_shmem(param, (unsigned char *) value, sizeof(union param_value_u))) {
|
||||
PX4_ERR("%s get param failed", __FUNCTION__);
|
||||
}
|
||||
}
|
||||
@@ -128,4 +125,3 @@ int update_from_shmem(param_t param, union param_value_u *value)
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user