aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Gubler <thomasgubler@gmail.com>2014-12-17 16:31:40 +0100
committerThomas Gubler <thomasgubler@gmail.com>2014-12-17 16:31:40 +0100
commit4402d7106bc63b2a02a1e4c22f54e072b3c48fc7 (patch)
treec1597cba369d070c9cf03a60bb58a25b59acf613
parent0a1e94d504b38d30c2d7428300c5728798db094d (diff)
downloadpx4-firmware-4402d7106bc63b2a02a1e4c22f54e072b3c48fc7.tar.gz
px4-firmware-4402d7106bc63b2a02a1e4c22f54e072b3c48fc7.tar.bz2
px4-firmware-4402d7106bc63b2a02a1e4c22f54e072b3c48fc7.zip
improve and fix multiplatform param by name macro
-rw-r--r--src/modules/systemlib/circuit_breaker.cpp3
-rw-r--r--src/platforms/px4_defines.h4
2 files changed, 3 insertions, 4 deletions
diff --git a/src/modules/systemlib/circuit_breaker.cpp b/src/modules/systemlib/circuit_breaker.cpp
index 2df13ebff..ea478a60f 100644
--- a/src/modules/systemlib/circuit_breaker.cpp
+++ b/src/modules/systemlib/circuit_breaker.cpp
@@ -48,8 +48,7 @@
bool circuit_breaker_enabled(const char* breaker, int32_t magic)
{
int32_t val;
- /* (void)param_get(param_find(breaker), &val); */
- (void)PX4_PARAM_GET_NAME(breaker, &val);
+ (void)PX4_PARAM_GET_BYNAME(breaker, &val);
return (val == magic);
}
diff --git a/src/platforms/px4_defines.h b/src/platforms/px4_defines.h
index 188149008..c1a0782c4 100644
--- a/src/platforms/px4_defines.h
+++ b/src/platforms/px4_defines.h
@@ -97,7 +97,7 @@ static inline px4_param_t PX4_ROS_PARAM_SET(const char *name, float value)
#define PX4_PARAM_GET(_handle, _destpt) ros::param::get(_handle, *_destpt)
/* Get value of parameter by name, which is equal to the handle for ros */
-#define PX4_PARAM_GET_NAME(_name, _destpt) PX4_PARAM_GET(_name, _destpt)
+#define PX4_PARAM_GET_BYNAME(_name, _destpt) PX4_PARAM_GET(_name, _destpt)
#define OK 0
#define ERROR -1
@@ -170,7 +170,7 @@ typedef param_t px4_param_t;
#define PX4_PARAM_GET(_handle, _destpt) param_get(_handle, _destpt)
/* Get value of parameter by name */
-#define PX4_PARAM_GET_NAME(_name, _destpt) param_get(PX4_PARAM_INIT(_name), _destpt)
+#define PX4_PARAM_GET_BYNAME(_name, _destpt) param_get(param_find(_name), _destpt)
/* XXX this is a hack to resolve conflicts with NuttX headers */
#define isspace(c) \