diff --git a/src/modules/systemlib/param/param.c b/src/modules/systemlib/param/param.c index 35ebb5f63a..7241357b06 100644 --- a/src/modules/systemlib/param/param.c +++ b/src/modules/systemlib/param/param.c @@ -236,7 +236,7 @@ param_find_changed(param_t param) } static void -param_notify_changes(bool is_saved) +_param_notify_changes(bool is_saved) { #if !defined(PARAM_NO_ORB) struct parameter_update_s pup = { @@ -258,6 +258,12 @@ param_notify_changes(bool is_saved) #endif } +void +param_notify_changes(void) +{ + _param_notify_changes(true); +} + param_t param_find_internal(const char *name, bool notification) { @@ -601,7 +607,7 @@ out: * a thing has been set. */ if (params_changed && notify_changes) { - param_notify_changes(is_saved); + _param_notify_changes(is_saved); } return result; @@ -687,7 +693,7 @@ param_reset(param_t param) param_unlock(); if (s != NULL) { - param_notify_changes(false); + _param_notify_changes(false); } return (!param_found); @@ -707,7 +713,7 @@ param_reset_all(void) param_unlock(); - param_notify_changes(false); + _param_notify_changes(false); } void @@ -739,7 +745,7 @@ param_reset_excludes(const char *excludes[], int num_excludes) param_unlock(); - param_notify_changes(false); + _param_notify_changes(false); } static const char *param_default_file = PX4_ROOTFSDIR"/eeprom/parameters"; diff --git a/src/modules/systemlib/param/param.h b/src/modules/systemlib/param/param.h index 9e2d83d93a..5350a4f22e 100644 --- a/src/modules/systemlib/param/param.h +++ b/src/modules/systemlib/param/param.h @@ -236,6 +236,12 @@ __EXPORT int param_set_no_autosave(param_t param, const void *val); */ __EXPORT int param_set_no_notification(param_t param, const void *val); +/** + * Notify the system about parameter changes. Can be used for example after several calls to + * param_set_no_notification() to avoid unnecessary system notifications. + */ +__EXPORT void param_notify_changes(void); + /** * Reset a parameter to its default value. * diff --git a/src/modules/systemlib/param/param_shmem.c b/src/modules/systemlib/param/param_shmem.c index ea64b7e6ae..b0769b82d1 100644 --- a/src/modules/systemlib/param/param_shmem.c +++ b/src/modules/systemlib/param/param_shmem.c @@ -246,8 +246,8 @@ param_find_changed(param_t param) return s; } -static void -param_notify_changes(bool is_saved) +void +_param_notify_changes(bool is_saved) { struct parameter_update_s pup = { .timestamp = hrt_absolute_time(), .saved = is_saved }; @@ -263,6 +263,13 @@ param_notify_changes(bool is_saved) } } +void +param_notify_changes(void) +{ + _param_notify_changes(true); +} + + param_t param_find_internal(const char *name, bool notification) { @@ -643,7 +650,7 @@ out: if (!param_import_done) { notify_changes = 0; } if (params_changed && notify_changes) { - param_notify_changes(is_saved); + _param_notify_changes(is_saved); } if (result == 0 && !set_called_from_get) { @@ -740,7 +747,7 @@ param_reset(param_t param) param_unlock(); if (s != NULL) { - param_notify_changes(false); + _param_notify_changes(false); } return (!param_found); @@ -760,7 +767,7 @@ param_reset_all(void) param_unlock(); - param_notify_changes(false); + _param_notify_changes(false); } void @@ -792,7 +799,7 @@ param_reset_excludes(const char *excludes[], int num_excludes) param_unlock(); - param_notify_changes(false); + _param_notify_changes(false); } #ifdef __PX4_QURT