mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-06-30 12:50:35 +08:00
geofence: make better use of Block class for updating parameters
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user