diff options
author | Lorenz Meier <lm@inf.ethz.ch> | 2015-02-08 16:39:37 +0100 |
---|---|---|
committer | Lorenz Meier <lm@inf.ethz.ch> | 2015-02-08 16:39:37 +0100 |
commit | f7b79bfaf2cee56a52538bc24ba3ff917e2b5acf (patch) | |
tree | 2436b108d556495aeb4c52a735a6eb8cea0abf18 /src/modules | |
parent | 775e35ceaf8a1e511f9eaf157119d0563eceda9d (diff) | |
download | px4-firmware-f7b79bfaf2cee56a52538bc24ba3ff917e2b5acf.tar.gz px4-firmware-f7b79bfaf2cee56a52538bc24ba3ff917e2b5acf.tar.bz2 px4-firmware-f7b79bfaf2cee56a52538bc24ba3ff917e2b5acf.zip |
Param interface: Allow to check return value of param_reset. Reset test param prior to running test
Diffstat (limited to 'src/modules')
-rw-r--r-- | src/modules/systemlib/param/param.c | 9 | ||||
-rw-r--r-- | src/modules/systemlib/param/param.h | 5 |
2 files changed, 10 insertions, 4 deletions
diff --git a/src/modules/systemlib/param/param.c b/src/modules/systemlib/param/param.c index 6b8d0e634..7f5caf18f 100644 --- a/src/modules/systemlib/param/param.c +++ b/src/modules/systemlib/param/param.c @@ -1,6 +1,6 @@ /**************************************************************************** * - * Copyright (c) 2012-2014 PX4 Development Team. All rights reserved. + * Copyright (c) 2012-2015 PX4 Development Team. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -441,10 +441,11 @@ param_set(param_t param, const void *val) return param_set_internal(param, val, false); } -void +int param_reset(param_t param) { struct param_wbuf_s *s = NULL; + bool param_found = false; param_lock(); @@ -458,12 +459,16 @@ param_reset(param_t param) int pos = utarray_eltidx(param_values, s); utarray_erase(param_values, pos, 1); } + + param_found = true; } param_unlock(); if (s != NULL) param_notify_changes(); + + return (!param_found); } void diff --git a/src/modules/systemlib/param/param.h b/src/modules/systemlib/param/param.h index dc73b37e9..e003572d9 100644 --- a/src/modules/systemlib/param/param.h +++ b/src/modules/systemlib/param/param.h @@ -1,6 +1,6 @@ /**************************************************************************** * - * Copyright (C) 2012 PX4 Development Team. All rights reserved. + * Copyright (c) 2012-2015 PX4 Development Team. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -178,8 +178,9 @@ __EXPORT int param_set(param_t param, const void *val); * to its default value. * * @param param A handle returned by param_find or passed by param_foreach. + * @return Zero on success, nonzero on failure */ -__EXPORT void param_reset(param_t param); +__EXPORT int param_reset(param_t param); /** * Reset all parameters to their default values. |