From 06d7a9c4916ddbaeb6d457fec81f7f65fb6deff0 Mon Sep 17 00:00:00 2001 From: Julian Oes Date: Thu, 17 Mar 2016 11:02:51 +0000 Subject: [PATCH] param_shmem: fixes for params on Snapdragon On Snapdragon we can't yet use the "used" mask for parameters and therefore need to send all of them down to the ground station. All params were set to used in an earlier commit but the count and index function didn't reflect this change. This is fixed now, therefore we can successfully receive all params in QGC. --- src/modules/systemlib/param/param_shmem.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/modules/systemlib/param/param_shmem.c b/src/modules/systemlib/param/param_shmem.c index f789da1464..fbc5e1c0ea 100644 --- a/src/modules/systemlib/param/param_shmem.c +++ b/src/modules/systemlib/param/param_shmem.c @@ -307,6 +307,8 @@ param_count(void) unsigned param_count_used(void) { + //TODO FIXME: all params used right now +#if 0 unsigned count = 0; // ensure the allocation has been done @@ -322,6 +324,9 @@ param_count_used(void) } return count; +#else + return get_param_info_count(); +#endif } param_t @@ -378,6 +383,8 @@ param_get_index(param_t param) int param_get_used_index(param_t param) { + // TODO FIXME: the used bit is not supported right now, therefore just count all. +#if 0 /* this tests for out of bounds and does a constant time lookup */ if (!param_used(param)) { return -1; @@ -388,6 +395,7 @@ param_get_used_index(param_t param) for (unsigned i = 0; i < (unsigned)size_param_changed_storage_bytes; i++) { for (unsigned j = 0; j < bits_per_allocation_unit; j++) { + if (param_changed_storage[i] & (1 << j)) { if ((unsigned)param == i * bits_per_allocation_unit + j) { @@ -398,8 +406,11 @@ param_get_used_index(param_t param) } } } - return -1; +#else + return param; +#endif + } const char *