First stab at IOCTL driven offset handling (in PA) for all airspeed sensors. Untested

This commit is contained in:
Lorenz Meier
2013-07-10 20:58:47 +02:00
parent 71ca3ec449
commit dc600e7d65
4 changed files with 53 additions and 39 deletions
+14 -3
View File
@@ -129,7 +129,7 @@ private:
bool _sensor_ok;
int _measure_ticks;
bool _collect_phase;
int _diff_pres_offset;
float _diff_pres_offset;
orb_advert_t _airspeed_pub;
@@ -358,6 +358,19 @@ ETSAirspeed::ioctl(struct file *filp, int cmd, unsigned long arg)
/* XXX implement this */
return -EINVAL;
case AIRSPEEDIOCSSCALE: {
struct airspeed_scale *s = (struct airspeed_scale*)arg;
_diff_pres_offset = s->offset_pa;
return OK;
}
case AIRSPEEDIOCGSCALE: {
struct airspeed_scale *s = (struct airspeed_scale*)arg;
s->offset_pa = _diff_pres_offset;
s->scale = 1.0f;
return OK;
}
default:
/* give it to the superclass */
return I2C::ioctl(filp, cmd, arg);
@@ -464,8 +477,6 @@ ETSAirspeed::collect()
uint16_t diff_pres_pa = val[1] << 8 | val[0];
// XXX move the parameter read out of the driver.
param_get(param_find("SENS_DPRES_OFF"), &_diff_pres_offset);
if (diff_pres_pa < _diff_pres_offset + MIN_ACCURATE_DIFF_PRES_PA) {
diff_pres_pa = 0;