aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpx4dev <px4@purgatory.org>2012-08-22 01:09:06 -0700
committerpx4dev <px4@purgatory.org>2012-08-22 01:09:06 -0700
commit44ff4d4ee29f3da53f64b2f24b822f2f2f7032c0 (patch)
tree376fada74203811056727dc17e445c084859603d
parent1eccfb7ccb91b98f53e791e41b917cb05b17d7e5 (diff)
downloadpx4-firmware-44ff4d4ee29f3da53f64b2f24b822f2f2f7032c0.tar.gz
px4-firmware-44ff4d4ee29f3da53f64b2f24b822f2f2f7032c0.tar.bz2
px4-firmware-44ff4d4ee29f3da53f64b2f24b822f2f2f7032c0.zip
Fix parameter change advertisement to conform to API change.
-rw-r--r--apps/systemlib/param/param.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/apps/systemlib/param/param.c b/apps/systemlib/param/param.c
index 7d0c75670..acd5674ab 100644
--- a/apps/systemlib/param/param.c
+++ b/apps/systemlib/param/param.c
@@ -91,6 +91,9 @@ UT_icd param_icd = {sizeof(struct param_wbuf_s), NULL, NULL, NULL};
/** parameter update topic */
ORB_DEFINE(parameter_update, struct parameter_update_s);
+/** parameter update topic handle */
+static orb_advert_t param_topic = -1;
+
/** lock the parameter store */
static void
param_lock(void)
@@ -390,13 +393,15 @@ out:
struct parameter_update_s pup = { .timestamp = hrt_absolute_time() };
/*
- * Because we're a library, we can't keep a persistent advertisement
- * around, so if we succeed in updating the topic, we have to toss
- * the descriptor straight away.
+ * If we don't have a handle to our topic, create one now; otherwise
+ * just publish.
*/
- int param_topic = orb_advertise(ORB_ID(parameter_update), &pup);
- if (param_topic != -1)
- close(param_topic);
+ if (param_topic == -1) {
+ param_topic = orb_advertise(ORB_ID(parameter_update), &pup);
+ } else {
+ orb_publish(ORB_ID(parameter_update), param_topic, &pup);
+ }
+
}
return result;