Flow driver: Handle rotation parameter if present

This commit is contained in:
Lorenz Meier
2016-03-14 09:29:53 +01:00
parent 6708069a97
commit 3e1f5c232b

View File

@@ -62,6 +62,7 @@
#include <systemlib/perf_counter.h> #include <systemlib/perf_counter.h>
#include <systemlib/err.h> #include <systemlib/err.h>
#include <systemlib/param/param.h>
#include <conversion/rotation.h> #include <conversion/rotation.h>
@@ -255,6 +256,17 @@ PX4FLOW::init()
/* sensor is ok, but we don't really know if it is within range */ /* sensor is ok, but we don't really know if it is within range */
_sensor_ok = true; _sensor_ok = true;
/* get rotation */
param_t rot = param_find("SENS_FLOW_ROT");
/* only set it if the parameter exists */
if (rot != PARAM_INVALID) {
int32_t val = 0;
param_get(rot, &val);
_sensor_rotation = (enum Rotation)val;
}
return ret; return ret;
} }