_baro_topic can be null in init sequence
init call collect before the topic is inited.
I think this pattern is repeated in other drivers. I would suggest
allowing null in orb_publish to just return.
It makes more sense to set the optimization flags on a platform basis
instead of individually for each module. This allows for different
optimization options for SITL, NuttX, Snapdragon, etc.
this reduces self-heating of the sensor which reduces the amount of
altitude change when warming up. Apparently some individual sensors
are severely affected by this.
Unfortunately it raises the noise level, but Paul is confident it
won't be a significant issue
These functions used vprintf which is not available on all platforms.
They also do not enable line and file debug output.
Changed to macros that preserve the output format. Uses new macro that
can be used to implement per object, runtime selectable logging
Signed-off-by: Mark Charlebois <charlebm@gmail.com>
The existing orb_advert_t use thoughout the code sometimes tries
to treat it as a file descriptor and there are checks for < 0
and ::close calls on orb_advert_t types which is an invalid use
of an object pointer, which is what orb_advert_t really is.
Initially I had changed the -1 initializations to 0 but it was
suggested that this should be nullptr. That was a good recommendation
but the definition of orb_advert_t had to change to void * because
you cannot initialize a uintptr_t as nullptr.
Signed-off-by: Mark Charlebois <charlebm@gmail.com>
The calls to orb_advertise were being mishandled throughout the code.
There were ::close() calls on memory pointers, there were checks
against < 0 when it is a pointer to a object and values larger than
0x7ffffffff are valid. Some places orb_advert_t variables were
being initialized as 0 other places as -1.
The orb_advert_t type was changed to uintptr_t so the pointer value
would not be wrapped as a negative number. This was causing a failure
on ARM.
Tests for < 0 were changed to == 0 since a null pointer is the valid
representation for error, or uninitialized.
Signed-off-by: Mark Charlebois <charlebm@gmail.com>
Changed "linux" target to "posix". Most of the changes are shared with
QuRT and with OSX. The Linux specific parts are in for i2c which uses
<linux/i2c.h> and <linux/i2c-dev.h>.
There is also a check for __PX4_LINUX in mavlink for a tty ioctl that is
not supported.
Signed-off-by: Mark Charlebois <charlebm@gmail.com>
The MS5611_SIM class is supposed to simulate data from a real
ms5611. An externl simulator could provide an interface to
call to get data that would be returned from a transfer() call.
Signed-off-by: Mark Charlebois <charlebm@gmail.com>
The getopt command uses global variables and is not thread safe.
Created a minimal px4_getopt version that supports options with
or without an arg, and random placement of options on the command line.
This version modifies the order of the args in argv as does the
POSIX version of getopt.
This assumes that argv[0] is the program name. Nuttx may not support
that properly in task_spawn.
Signed-off-by: Mark Charlebois <charlebm@gmail.com>
The simulated device satisfies the factory pattern used by
MS5611 to create a specific I2C or SPI device instance.
For now the functions just return true, but should/could
return simulated data.
Signed-off-by: Mark Charlebois <charlebm@gmail.com>
I have not been able to unravel why nullptr is passed as the device
path to the constructor of ms5611_i2c.
This crashes the VDev code as it expects to create a virtual driver
with the device path passed as devname. It causes VDev to do a
strncmp with null.
Using /vdev/ms5611_i2c as the name for the now.
Signed-off-by: Mark Charlebois <charlebm@gmail.com>
To avoid confusion when a real device and a virtual device is
being used, changed CDev to VDev for Linux.
Signed-off-by: Mark Charlebois <charlebm@gmail.com>