Fixed up init sequence of all sensors - we can publish in interrupt context, but not advertise! All advertisements now contain valid data

This commit is contained in:
Lorenz Meier
2014-01-14 15:40:46 +01:00
parent 1f5eda37ab
commit d199710651
8 changed files with 186 additions and 112 deletions
+3 -12
View File
@@ -184,18 +184,9 @@ ETSAirspeed::collect()
report.voltage = 0;
report.max_differential_pressure_pa = _max_differential_pressure_pa;
/* announce the airspeed if needed, just publish else */
if (_class_instance == CLASS_DEVICE_PRIMARY && !(_pub_blocked)) {
if (_airspeed_pub > 0) {
/* publish it */
orb_publish(ORB_ID(differential_pressure), _airspeed_pub, &report);
} else {
_airspeed_pub = orb_advertise(ORB_ID(differential_pressure), &report);
if (_airspeed_pub < 0)
debug("failed to create differential_pressure publication");
}
if (_airspeed_pub > 0 && !(_pub_blocked)) {
/* publish it */
orb_publish(ORB_ID(differential_pressure), _airspeed_pub, &report);
}
new_report(report);