forked from Archive/PX4-Autopilot
geofence: make better use of Block class for updating parameters
This commit is contained in:
parent
501dc0cfa7
commit
be140eab59
|
@ -55,11 +55,13 @@
|
||||||
#endif
|
#endif
|
||||||
static const int ERROR = -1;
|
static const int ERROR = -1;
|
||||||
|
|
||||||
Geofence::Geofence() : _fence_pub(-1),
|
Geofence::Geofence() :
|
||||||
|
SuperBlock(NULL, "GF"),
|
||||||
|
_fence_pub(-1),
|
||||||
_altitude_min(0),
|
_altitude_min(0),
|
||||||
_altitude_max(0),
|
_altitude_max(0),
|
||||||
_verticesCount(0),
|
_verticesCount(0),
|
||||||
param_geofence_on(NULL, "GF_ON", false)
|
param_geofence_on(this, "ON")
|
||||||
{
|
{
|
||||||
/* Load initial params */
|
/* Load initial params */
|
||||||
updateParams();
|
updateParams();
|
||||||
|
@ -292,8 +294,3 @@ int Geofence::clearDm()
|
||||||
{
|
{
|
||||||
dm_clear(DM_KEY_FENCE_POINTS);
|
dm_clear(DM_KEY_FENCE_POINTS);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Geofence::updateParams()
|
|
||||||
{
|
|
||||||
param_geofence_on.update();
|
|
||||||
}
|
|
||||||
|
|
|
@ -41,11 +41,13 @@
|
||||||
#define GEOFENCE_H_
|
#define GEOFENCE_H_
|
||||||
|
|
||||||
#include <uORB/topics/fence.h>
|
#include <uORB/topics/fence.h>
|
||||||
|
#include <controllib/blocks.hpp>
|
||||||
#include <controllib/block/BlockParam.hpp>
|
#include <controllib/block/BlockParam.hpp>
|
||||||
|
|
||||||
#define GEOFENCE_FILENAME "/fs/microsd/etc/geofence.txt"
|
#define GEOFENCE_FILENAME "/fs/microsd/etc/geofence.txt"
|
||||||
|
|
||||||
class Geofence {
|
class Geofence : public control::SuperBlock
|
||||||
|
{
|
||||||
private:
|
private:
|
||||||
orb_advert_t _fence_pub; /**< publish fence topic */
|
orb_advert_t _fence_pub; /**< publish fence topic */
|
||||||
|
|
||||||
|
@ -85,8 +87,6 @@ public:
|
||||||
int loadFromFile(const char *filename);
|
int loadFromFile(const char *filename);
|
||||||
|
|
||||||
bool isEmpty() {return _verticesCount == 0;}
|
bool isEmpty() {return _verticesCount == 0;}
|
||||||
|
|
||||||
void updateParams();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue