Commit Graph

25 Commits

Author SHA1 Message Date
Lorenz Meier
b05294d4b4 Accel sim: Fix ioctl interface 2015-11-14 00:05:45 +01:00
Lorenz Meier
b50c332c76 Accel sim: Code style 2015-11-12 15:32:40 +01:00
Lorenz Meier
dda6ec3d5f Fix missing errno header 2015-11-12 15:28:26 +01:00
Mark Charlebois
efd9995a10 Ported more simulated sensors to DriverFramework
Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2015-11-10 07:45:13 -08:00
Mark Charlebois
40c079efa8 Ported accelsim, gyrosim and adcsim to DriverFramework
Need to handle _pub_blocked flag in DriverFramework as a PX4
specific implementation.

Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2015-11-09 10:26:28 -08:00
Mark Charlebois
8d59d08ad6 Removed unnecessary header files from accelsim
Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2015-10-29 12:21:52 -07:00
Mark Charlebois
a5c002ac2e Removed more accelsim deadcode
Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2015-10-29 12:17:24 -07:00
Mark Charlebois
21ef602b5a More accelsim cleanup
Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2015-10-29 12:12:38 -07:00
Mark Charlebois
474e376f96 Removed deadcode from accelsim
Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2015-10-29 12:04:19 -07:00
Lorenz Meier
0b7f6902a9 POSIX Sim drivers: Fix formatting 2015-10-19 13:35:32 +02:00
Lorenz Meier
59f71452d7 Sensor sim: Initialize sensor data to zero 2015-09-20 12:55:48 +02:00
Lorenz Meier
ddd1b82240 Simulated sensors: Publish valid data initially 2015-09-20 11:36:11 +02:00
Mark Charlebois
83bcb95999 POSIX: Added sleep command
The baro was not fully initialized when the sensors module tried to
open it. Added a sleep command and a sleep 2 to rc.S so the baro
is initialized by the time the sensors module tried to read it.

Fixed other noisy errors

Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2015-06-11 17:28:46 -07:00
tumbili
aef3f37ae0 enable reading sensor data from simulator module for SITL 2015-06-08 22:21:58 -07:00
Mark Charlebois
5e95b83eff POSIX: Fixes for HRT implementation of simulated HW clock polling
There is a race condition for the accel and mag polling rates.
Whichever one gets set first, the other will be uninitialized.

Set the mag polling rate to 1ms if uninitilized.

Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2015-06-02 16:55:34 +00:00
Mark Charlebois
cced8ed69e POSIX: added hrt_queue for handling fast periodic events
The workqueues measure time in ticks  which is typically 10ms.
Some interrupt events in Nuttx occur at about 1ms so a more
granular workqueue is needed for POSIX.

Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2015-06-02 16:55:33 +00:00
Mark Charlebois
1ca05aaa64 orb_advert_t changed to void * and checks changed to nullptr
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>
2015-05-27 14:42:49 -07:00
Mark Charlebois
180c8b0cb0 Missed another < 0 check
Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2015-05-27 14:41:33 -07:00
Mark Charlebois
a734fc96d1 extensive orb_advert_t fixes
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>
2015-05-27 14:41:33 -07:00
Lorenz Meier
2d090ddde4 Accelsim: Add ringbuffer namespace 2015-05-25 09:59:45 +02:00
Mark Charlebois
ffdc9d629c POSIX: Improved logging
The warnx and warn calls map to PX4_WARN.
Calls to errx or err genrtate a compile error.

The px4_log.h file implements a new log format:

For DEBUG and INFO:
<level> <msg>

For ERROR and WARN:
<level> <msg> (file filepath line linenum)

The verbosity can be changed by setting the macro to use
either linux_log or linux_log_verbose in px4_log.h

Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2015-05-19 09:19:24 -07:00
Mark Charlebois
09718fa324 Revamped debug macros
Created px4_debug,h to define:

PX4_DBG
PX4_INFO
PX4_WARN
PX4_ERR

These enable OS specific mappings to be made, filtering, etc.

Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2015-04-27 21:58:54 -07:00
Mark Charlebois
d913ec8dc9 Changed device::px4_device_handle_t to device::file_t
This change allowed the _posix.cpp file changes to be merged
back into the original files.

Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2015-04-24 17:49:35 -07:00
Mark Charlebois
93dea668dc Posix: make simulated devices always pass self tests
To facilitate testing, the simulated devices always return OK for
self tests.

rc.S was also upated to set CAL_XXXY_ID to the devid so tests pass the
calibration check.

Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2015-04-21 23:29:07 -07:00
Mark Charlebois
f3b5076d70 Linux to posix conversion
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>
2015-04-21 09:53:09 -07:00