Merge pull request #715 from thomasgubler/geofence

Geofence: make better use of Block class for updating parameters
This commit is contained in:
Lorenz Meier 2014-03-10 18:59:57 +01:00
commit 36843b55c4
2 changed files with 7 additions and 10 deletions

View File

@ -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();
}

View File

@ -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();
};