Baro sim: Cleanup

This commit is contained in:
Lorenz Meier
2016-03-12 11:07:55 +01:00
parent c1321ec721
commit 32368e5eda

View File

@@ -111,12 +111,8 @@ protected:
bool _collect_phase; bool _collect_phase;
unsigned _measure_phase; unsigned _measure_phase;
/* intermediate temperature values per BAROSIM datasheet */ /* last report */
int32_t _TEMP; struct baro_report report;
int64_t _OFF;
int64_t _SENS;
float _P;
float _T;
/* altitude conversion calibration */ /* altitude conversion calibration */
unsigned _msl_pressure; /* in Pa */ unsigned _msl_pressure; /* in Pa */
@@ -202,11 +198,7 @@ BAROSIM::BAROSIM(const char *path) :
_reports(nullptr), _reports(nullptr),
_collect_phase(false), _collect_phase(false),
_measure_phase(0), _measure_phase(0),
_TEMP(0), report{},
_OFF(0),
_SENS(0),
_P(0.0),
_T(0.0),
_msl_pressure(101325), _msl_pressure(101325),
_baro_topic(nullptr), _baro_topic(nullptr),
_orb_class_instance(-1), _orb_class_instance(-1),
@@ -391,7 +383,7 @@ BAROSIM::devRead(void *buffer, size_t buflen)
int int
BAROSIM::devIOCTL(unsigned long cmd, unsigned long arg) BAROSIM::devIOCTL(unsigned long cmd, unsigned long arg)
{ {
PX4_WARN("baro IOCTL %" PRIu64 , hrt_absolute_time()); //PX4_WARN("baro IOCTL %" PRIu64 , hrt_absolute_time());
switch (cmd) { switch (cmd) {
@@ -664,7 +656,6 @@ BAROSIM::collect()
perf_begin(_sample_perf); perf_begin(_sample_perf);
struct baro_report report = {};
/* this should be fairly close to the end of the conversion, so the best approximation of the time */ /* this should be fairly close to the end of the conversion, so the best approximation of the time */
report.timestamp = hrt_absolute_time(); report.timestamp = hrt_absolute_time();
report.error_count = perf_event_count(_comms_errors); report.error_count = perf_event_count(_comms_errors);
@@ -726,12 +717,8 @@ BAROSIM::print_info()
perf_print_counter(_buffer_overflows); perf_print_counter(_buffer_overflows);
PX4_INFO("poll interval: %u usec", m_sample_interval_usecs); PX4_INFO("poll interval: %u usec", m_sample_interval_usecs);
_reports->print_info("report queue"); _reports->print_info("report queue");
PX4_INFO("TEMP: %ld", (long)_TEMP); PX4_INFO("TEMP: %f", (double)report.temperature);
PX4_INFO("SENS: %lld", (long long)_SENS); PX4_INFO("P: %.3f", (double)report.pressure);
PX4_INFO("OFF: %lld", (long long)_OFF);
PX4_INFO("P: %.3f", (double)_P);
PX4_INFO("T: %.3f", (double)_T);
PX4_INFO("MSL pressure: %10.4f", (double)(_msl_pressure / 100.f));
} }
namespace barosim namespace barosim