aboutsummaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
authorThomas Gubler <thomasgubler@gmail.com>2014-03-08 19:15:45 +0100
committerThomas Gubler <thomasgubler@gmail.com>2014-03-08 19:15:45 +0100
commitbe140eab5998fbec8c485e58e6f61a5ef950053b (patch)
tree311df3cd50de8b5c843eaf37506f31d582684471 /src/modules
parent501dc0cfa7259a1916522e5b70a5fd31cb7d20e1 (diff)
downloadpx4-firmware-be140eab5998fbec8c485e58e6f61a5ef950053b.tar.gz
px4-firmware-be140eab5998fbec8c485e58e6f61a5ef950053b.tar.bz2
px4-firmware-be140eab5998fbec8c485e58e6f61a5ef950053b.zip
geofence: make better use of Block class for updating parameters
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/navigator/geofence.cpp11
-rw-r--r--src/modules/navigator/geofence.h6
2 files changed, 7 insertions, 10 deletions
diff --git a/src/modules/navigator/geofence.cpp b/src/modules/navigator/geofence.cpp
index 9bbaf167a..f452a85f7 100644
--- a/src/modules/navigator/geofence.cpp
+++ b/src/modules/navigator/geofence.cpp
@@ -55,11 +55,13 @@
#endif
static const int ERROR = -1;
-Geofence::Geofence() : _fence_pub(-1),
+Geofence::Geofence() :
+ SuperBlock(NULL, "GF"),
+ _fence_pub(-1),
_altitude_min(0),
_altitude_max(0),
_verticesCount(0),
- param_geofence_on(NULL, "GF_ON", false)
+ param_geofence_on(this, "ON")
{
/* Load initial params */
updateParams();
@@ -292,8 +294,3 @@ int Geofence::clearDm()
{
dm_clear(DM_KEY_FENCE_POINTS);
}
-
-void Geofence::updateParams()
-{
- param_geofence_on.update();
-}
diff --git a/src/modules/navigator/geofence.h b/src/modules/navigator/geofence.h
index 5b56ebc7a..9628b7271 100644
--- a/src/modules/navigator/geofence.h
+++ b/src/modules/navigator/geofence.h
@@ -41,11 +41,13 @@
#define GEOFENCE_H_
#include <uORB/topics/fence.h>
+#include <controllib/blocks.hpp>
#include <controllib/block/BlockParam.hpp>
#define GEOFENCE_FILENAME "/fs/microsd/etc/geofence.txt"
-class Geofence {
+class Geofence : public control::SuperBlock
+{
private:
orb_advert_t _fence_pub; /**< publish fence topic */
@@ -85,8 +87,6 @@ public:
int loadFromFile(const char *filename);
bool isEmpty() {return _verticesCount == 0;}
-
- void updateParams();
};