Skip to content

Commit

Permalink
Fixed non-voxl2 builds
Browse files Browse the repository at this point in the history
  • Loading branch information
katzfey committed Mar 4, 2024
1 parent 32ba379 commit a235bfd
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 38 deletions.
10 changes: 10 additions & 0 deletions src/lib/parameters/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,19 @@ list(APPEND SRCS
parameters.cpp
atomic_transaction.cpp
autosave.cpp
)

if(CONFIG_PARAM_PRIMARY)
list(APPEND SRCS
parameters_primary.cpp
)
endif()

if(CONFIG_PARAM_REMOTE)
list(APPEND SRCS
parameters_remote.cpp
)
endif()

if(BUILD_TESTING)
list(APPEND SRCS param_translation_unit_tests.cpp)
Expand Down
81 changes: 44 additions & 37 deletions src/lib/parameters/parameters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -447,19 +447,23 @@ param_set_internal(param_t param, const void *val, bool mark_saved, bool notify_
}

// If this is the parameter server, make sure that the remote is updated
if ((remote_active) && (is_primary)) {
if (param_changed && update_remote) {
param_primary_set_value(param, val);
}
#if defined(CONFIG_PARAM_PRIMARY)

if (param_changed && update_remote) {
param_primary_set_value(param, val);
}

#endif

// If this is the parameter remote, make sure that the primary is updated
if ((remote_active) && (is_remote)) {
if (param_changed && update_remote) {
param_remote_set_value(param, val);
}
#if defined(CONFIG_PARAM_REMOTE)

if (param_changed && update_remote) {
param_remote_set_value(param, val);
}

#endif

perf_end(param_set_perf);

/*
Expand Down Expand Up @@ -512,10 +516,14 @@ bool param_used(param_t param)
void param_set_used(param_t param)
{
if (handle_in_range(param)) {
if ((remote_active) && (is_remote) && (! param_used(param))) {
#if defined(CONFIG_PARAM_REMOTE)

if (! param_used(param)) {
param_remote_set_used(param);
}

#endif

params_active.set(param, true);
}
}
Expand Down Expand Up @@ -611,9 +619,9 @@ static int param_reset_internal(param_t param, bool notify = true, bool autosave
param_notify_changes();
}

if ((remote_active) && (is_primary)) {
param_primary_reset(param);
}
#if defined(CONFIG_PARAM_PRIMARY)
param_primary_reset(param);
#endif

return param_found;
}
Expand All @@ -637,9 +645,9 @@ param_reset_all_internal(bool auto_save)
param_autosave();
}

if ((remote_active) && (is_primary)) {
param_primary_reset_all();
}
#if defined(CONFIG_PARAM_PRIMARY)
param_primary_reset_all();
#endif

param_notify_changes();
}
Expand Down Expand Up @@ -1347,27 +1355,26 @@ void param_print_status()
perf_print_counter(param_get_perf);
perf_print_counter(param_set_perf);

if (remote_active) {
if (is_primary) {
struct param_primary_counters counts;
param_primary_get_counters(&counts);
PX4_INFO("set value requests received: %u, set value responses sent: %u",
counts.set_value_request_received, counts.set_value_response_sent);
PX4_INFO("set value requests sent: %u, set value responses received: %u",
counts.set_value_request_sent, counts.set_value_response_received);
PX4_INFO("resets sent: %u, set used requests received: %u",
counts.reset_sent, counts.set_used_received);
}
#if defined(CONFIG_PARAM_PRIMARY)
struct param_primary_counters counts;
param_primary_get_counters(&counts);
PX4_INFO("set value requests received: %" PRIu32 ", set value responses sent: %" PRIu32,
counts.set_value_request_received, counts.set_value_response_sent);
PX4_INFO("set value requests sent: %" PRIu32 ", set value responses received: %" PRIu32,
counts.set_value_request_sent, counts.set_value_response_received);
PX4_INFO("resets sent: %" PRIu32 ", set used requests received: %" PRIu32,
counts.reset_sent, counts.set_used_received);
#endif

#if defined(CONFIG_PARAM_REMOTE)
struct param_remote_counters counts;
param_remote_get_counters(&counts);
PX4_INFO("set value requests received: %" PRIu32 ", set value responses sent: %" PRIu32,
counts.set_value_request_received, counts.set_value_response_sent);
PX4_INFO("set value requests sent: %" PRIu32 ", set value responses received: %" PRIu32,
counts.set_value_request_sent, counts.set_value_response_received);
PX4_INFO("resets received: %" PRIu32 ", set used requests sent: %" PRIu32,
counts.reset_received, counts.set_used_sent);
#endif

if (is_remote) {
struct param_remote_counters counts;
param_remote_get_counters(&counts);
PX4_INFO("set value requests received: %u, set value responses sent: %u",
counts.set_value_request_received, counts.set_value_response_sent);
PX4_INFO("set value requests sent: %u, set value responses received: %u",
counts.set_value_request_sent, counts.set_value_response_received);
PX4_INFO("resets received: %u, set used requests sent: %u",
counts.reset_received, counts.set_used_sent);
}
}
}
4 changes: 3 additions & 1 deletion src/lib/parameters/parameters_remote.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@

#include "uORB/uORBManager.hpp"

#include <inttypes.h>

#include <px4_platform_common/log.h>
#include <px4_platform_common/tasks.h>

Expand Down Expand Up @@ -214,7 +216,7 @@ void param_remote_set_value(param_t param, const void *val)
req.int_value = *(int32_t *)val;

if (debug) {
PX4_INFO("*** Setting %s to %d ***", param_name(req.parameter_index), req.int_value);
PX4_INFO("*** Setting %s to %" PRIi32 " ***", param_name(req.parameter_index), req.int_value);
}

break;
Expand Down

0 comments on commit a235bfd

Please sign in to comment.