diff options
author | Lorenz Meier <lm@inf.ethz.ch> | 2014-03-10 18:59:57 +0100 |
---|---|---|
committer | Lorenz Meier <lm@inf.ethz.ch> | 2014-03-10 18:59:57 +0100 |
commit | 36843b55c4a9379455623a2cf57796d87818255d (patch) | |
tree | b3421c403080c49f514e34a9d109fca21d2b8019 | |
parent | 100ad8907912198fca4d29caab98cbfa791b5839 (diff) | |
parent | be140eab5998fbec8c485e58e6f61a5ef950053b (diff) | |
download | px4-firmware-36843b55c4a9379455623a2cf57796d87818255d.tar.gz px4-firmware-36843b55c4a9379455623a2cf57796d87818255d.tar.bz2 px4-firmware-36843b55c4a9379455623a2cf57796d87818255d.zip |
Merge pull request #715 from thomasgubler/geofence
Geofence: make better use of Block class for updating parameters
-rw-r--r-- | src/modules/navigator/geofence.cpp | 11 | ||||
-rw-r--r-- | src/modules/navigator/geofence.h | 6 |
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(); }; |