param_shmem: fix bug where params didn't stick

There was the case where a param was changed on the Linux side but the
change did not get saved on the DSP side because the param was not in
the local list of changed params on the DSP side. On save, the param
index is now refreshed, and param_get is called on all params that have
changed. This is a hacky workaround but resolves the problem for now.
This commit is contained in:
Julian Oes
2016-04-26 10:21:01 +02:00
parent 2fff2d4eac
commit e3c9135ac2
3 changed files with 40 additions and 8 deletions
+3 -2
View File
@@ -65,6 +65,7 @@ void init_shared_memory(void);
void copy_params_to_shmem(struct param_info_s *);
void update_to_shmem(param_t param, union param_value_u value);
int update_from_shmem(param_t param, union param_value_u *value);
void update_index_from_shmem(void);
uint64_t update_from_shmem_prev_time = 0, update_from_shmem_current_time = 0;
static unsigned char adsp_changed_index[MAX_SHMEM_PARAMS / 8 + 1];
@@ -184,7 +185,7 @@ void copy_params_to_shmem(struct param_info_s *param_info_base)
#endif
}
//PX4_DEBUG("written %u params to shmem offset %lu", param_count(), (unsigned char*)&shmem_info_p->params_count-(unsigned char*)shmem_info_p);
PX4_DEBUG("written %u params to shmem", param_count());
for (i = 0; i < MAX_SHMEM_PARAMS / 8 + 1; i++) {
shmem_info_p->krait_changed_index[i] = 0;
@@ -230,7 +231,7 @@ void update_to_shmem(param_t param, union param_value_u value)
}
static void update_index_from_shmem(void)
void update_index_from_shmem(void)
{
unsigned int i;