Browse Source

Config tweaks to enable the new-style ms5611 driver.

sbg
px4dev 13 years ago
parent
commit
735f8ffa3d
  1. 20
      apps/drivers/ms5611/ms5611.cpp
  2. 2
      nuttx/configs/px4fmu/nsh/appconfig
  3. 8
      nuttx/configs/px4fmu/nsh/defconfig

20
apps/drivers/ms5611/ms5611.cpp

@ -58,6 +58,8 @@
#include <arch/board/up_hrt.h> #include <arch/board/up_hrt.h>
#include <systemlib/perf_counter.h>
#include <drivers/drv_baro.h> #include <drivers/drv_baro.h>
/** /**
@ -123,13 +125,15 @@ private:
int32_t _dT; int32_t _dT;
int64_t _temp64; int64_t _temp64;
int _orbject; int _baro_topic;
unsigned _reads; unsigned _reads;
unsigned _measure_errors; unsigned _measure_errors;
unsigned _read_errors; unsigned _read_errors;
unsigned _buf_overflows; unsigned _buf_overflows;
perf_counter_t _sample_perf;
/** /**
* Test whether the device supported by the driver is present at a * Test whether the device supported by the driver is present at a
* specific address. * specific address.
@ -245,7 +249,8 @@ MS5611::MS5611(int bus) :
_reads(0), _reads(0),
_measure_errors(0), _measure_errors(0),
_read_errors(0), _read_errors(0),
_buf_overflows(0) _buf_overflows(0),
_sample_perf(perf_alloc(PC_ELAPSED, "ms5611_read"))
{ {
// enable debug() calls // enable debug() calls
_debug_enabled = true; _debug_enabled = true;
@ -278,9 +283,9 @@ MS5611::init()
/* if this fails (e.g. no object in the system) that's OK */ /* if this fails (e.g. no object in the system) that's OK */
memset(&b, 0, sizeof(b)); memset(&b, 0, sizeof(b));
_orbject = orb_advertise(ORB_ID(sensor_baro), &b); _baro_topic = orb_advertise(ORB_ID(sensor_baro), &b);
if (_orbject < 0) if (_baro_topic < 0)
debug("failed to create sensor_baro object"); debug("failed to create sensor_baro object");
} }
@ -610,6 +615,8 @@ MS5611::collect()
/* read the most recent measurement */ /* read the most recent measurement */
cmd = 0; cmd = 0;
perf_begin(_sample_perf);
/* 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 */
_reports[_next_report].timestamp = hrt_absolute_time(); _reports[_next_report].timestamp = hrt_absolute_time();
@ -655,7 +662,7 @@ MS5611::collect()
_reports[_next_report].altitude = (44330.0 * (1.0 - pow((press_int64 / 101325.0), 0.190295))); _reports[_next_report].altitude = (44330.0 * (1.0 - pow((press_int64 / 101325.0), 0.190295)));
/* publish it */ /* publish it */
orb_publish(ORB_ID(sensor_baro), _orbject, &_reports[_next_report]); orb_publish(ORB_ID(sensor_baro), _baro_topic, &_reports[_next_report]);
/* post a report to the ring - note, not locked */ /* post a report to the ring - note, not locked */
INCREMENT(_next_report, _num_reports); INCREMENT(_next_report, _num_reports);
@ -670,10 +677,11 @@ MS5611::collect()
poll_notify(POLLIN); poll_notify(POLLIN);
} }
/* update the measurement state machine */ /* update the measurement state machine */
INCREMENT(_measure_phase, MS5611_MEASUREMENT_RATIO + 1); INCREMENT(_measure_phase, MS5611_MEASUREMENT_RATIO + 1);
perf_end(_sample_perf);
return OK; return OK;
} }

2
nuttx/configs/px4fmu/nsh/appconfig

@ -75,7 +75,7 @@ CONFIGURED_APPS += attitude_estimator_ekf
# Communication and Drivers # Communication and Drivers
CONFIGURED_APPS += drivers/device CONFIGURED_APPS += drivers/device
#CONFIGURED_APPS += drivers/ms5611 CONFIGURED_APPS += drivers/ms5611
CONFIGURED_APPS += drivers/mpu6000 CONFIGURED_APPS += drivers/mpu6000
CONFIGURED_APPS += px4/px4io/driver CONFIGURED_APPS += px4/px4io/driver
CONFIGURED_APPS += px4/fmu CONFIGURED_APPS += px4/fmu

8
nuttx/configs/px4fmu/nsh/defconfig

@ -537,10 +537,10 @@ CONFIG_SEM_NNESTPRIO=8
CONFIG_FDCLONE_DISABLE=n CONFIG_FDCLONE_DISABLE=n
CONFIG_FDCLONE_STDIO=y CONFIG_FDCLONE_STDIO=y
CONFIG_SDCLONE_DISABLE=y CONFIG_SDCLONE_DISABLE=y
CONFIG_SCHED_WORKQUEUE=n CONFIG_SCHED_WORKQUEUE=y
CONFIG_SCHED_WORKPRIORITY=50 CONFIG_SCHED_WORKPRIORITY=199
CONFIG_SCHED_WORKPERIOD=(50*1000) CONFIG_SCHED_WORKPERIOD=(5*1000)
CONFIG_SCHED_WORKSTACKSIZE=1024 CONFIG_SCHED_WORKSTACKSIZE=2048
CONFIG_SIG_SIGWORK=4 CONFIG_SIG_SIGWORK=4
CONFIG_SCHED_WAITPID=y CONFIG_SCHED_WAITPID=y
CONFIG_SCHED_ATEXIT=n CONFIG_SCHED_ATEXIT=n

Loading…
Cancel
Save