109 Commits

Author SHA1 Message Date
Stephan Brown
67a484ac34 Make parameter generation also depend on the scripts that run. Address some review comments. 2017-01-06 09:58:58 +01:00
Stephan Brown
92b2395ff6 param: Fix another off by 1 error and a formatting issue. 2017-01-06 09:58:58 +01:00
Stephan Brown
bf57e86dc2 param: Fix an off by 1 issue and some style fixes. 2017-01-06 09:58:58 +01:00
Stephan Brown
99228bdeb1 param: Use utarray_find when looking for changed parameters and use a binary search for finding param handles by name. 2017-01-06 09:58:58 +01:00
Lorenz Meier
2cfcf3402e Systemlib: Header cleanup 2016-12-27 21:00:51 +01:00
David Sidrane
1781801151 Scope irq_state to function using it 2016-12-21 08:34:22 +01:00
Henry Zhang
309c256e9e fix param interface (#5797)
* param: fix bug when param value is changed to 'zero' for the first time, it won't be saved.

* param: revert incorrectly removed code.
2016-11-06 14:45:17 +01:00
Carlo Wood
baf89f4398 Clean up of px4_defines.h (remove math.h)
This patch reorders px4_defines.h to make it more readable (I think)
but more importantly, cleans up the #include <math.h>/<cmath>
and [std::]isfinite stuff.

My main goal was to completely get rid of including math.h/cmath,
because that doesn't really belong in a header that is supposed to
define macro's and is included in almost every source file (if not
all).

I'm not sure what it did before ;) (pun intended), but now it does
the following:

PX4_ISFINITE is only used in C++ code (that was already the case,
but hereby is official; for C code just use 'isfinite()') and is
defined to be std::isfinite, except on __PX4_QURT because that uses
the HEXAGON toolset which (erroneously) defines isfinite as macro.

I would have liked to remove PX4_ISFINITE completely from the code
and just use std::isfinite whereever that is needed, but that would
have required changing the libecl submodule, and at the moment I'm
getting tired of changing submodules... so maybe something for the
future.

Also, all includes of <math.h> or <cmath> have been removed except
for __PX4_NUTTX. Like the HEXAGON toolset NuttX currently defines
isfinite as macro for C++. So, we could have solved this in the
same was as __P4_QURT; but since we can fix NuttX ourselves I chose
to add a kludge to px4_defines.h instead that fixes this problem,
until the time that NuttX can be fixed (again postponing changing
a submodule). The kludge still demands including <cmath>, thus.

After removal of the math header file, it needed to be included
in source files that actually need it, of course.

Finally, I had a look at the math macro's (like M_PI, M_PI_F,
M_DEG_TO_RAD etc). These are sometimes (erroneously) defined in
certain math.h header files (like both, hexagon and nuttx).
This is incorrect: neither the C nor the C++ standard defines
math constants (neither as macro nor otherwise). The "problem"
here was that px4_defines.h defined some of the M_*_F float
constants in terms of the M_* double constant, which are
sometimes not defined either thus. So, I cleaned this up by
defining the M_*_F math constants as float literals in px4_defines.h,
except when they are defined in math.h for that platform.
This means that math.h has to be always included when using those
constants, but well; not much difference there as those files
usually also need/use the macro NAN (which *is* a standard macro
defined by math.h).

Finally finally, DEFAULT_PARAM_FILE was removed as it isn't
used anymore.

All in all I think the resulting px4_defines.h is nice, giving me
much less the feeling of a nearly unmaintainable and over time
slowly growing collection of kludges and hacks.
2016-10-28 08:41:30 +02:00
Julian Oes
623b99327d param: lock the bus as short as possible (#5187)
Since the FRAM and the baro are on the same bus on the Pixracer, we
currently need to lock down everything (instead of just this SPI bus)
for the time when the params are written.
Therefore, we need to keep this locking as short as possible.

This change makes the locking even shorter by moving all param_get and
param_name and param_size calls out of the lock.
2016-08-01 02:15:21 -07:00
David Sidrane
5e8d6375c9 Back Port nuttx_v3 FLASH based parameter hooks 2016-07-13 20:42:05 +02:00
Daniel Agar
b8b855f2aa param.c fix style 2016-06-26 17:36:45 -04:00
Lorenz Meier
3c2bd4f6dd Param interface: Only mark as changed if value changed 2016-06-26 22:29:14 +02:00
jwilson
a73ac821ab Fixes shared memory locking bug and eliminates the need for an AppsProm driver to reserve a shared memory region. 2016-06-22 08:57:06 +02:00
Julian Oes
11cc17b63a param_shmem: be less verbose 2016-06-07 22:10:56 +02:00
Julian Oes
93ada40bf9 param_shmem: removed a printf 2016-06-07 22:10:56 +02:00
Lorenz Meier
7398164fcc Updated PX4 use / API of low level GPIO and other hardware-centric system facilities 2016-05-28 14:56:17 +02:00
Daniel Agar
2487dbfc92 remove Wpacked and cleanup unused warning flags 2016-05-19 21:49:34 +02:00
Daniel Agar
9c32792017 param_test link libmsg_gen 2016-05-14 11:27:07 +02:00
Daniel Agar
76387b1693 uorb autogeneration 2016-05-14 11:27:07 +02:00
Daniel Agar
d85e7732b4 fix param_test 2016-05-13 13:01:42 +02:00
Lorenz Meier
192510ee1c FMUv4 compile fix 2016-05-05 14:09:03 +02:00
Julian Oes
e3c9135ac2 param_shmem: fix bug where params didn't stick
There was the case where a param was changed on the Linux side but the
change did not get saved on the DSP side because the param was not in
the local list of changed params on the DSP side. On save, the param
index is now refreshed, and param_get is called on all params that have
changed. This is a hacky workaround but resolves the problem for now.
2016-04-26 10:21:01 +02:00
Julian Oes
a302e79bb6 param_shmem: be less chatty, printf cleanup 2016-04-24 20:03:10 +02:00
Julian Oes
22847e49e7 param_shmem: fix style 2016-04-12 13:15:50 +02:00
Julian Oes
9cfffc9747 param_shmem: do fsync after param write 2016-04-12 13:15:50 +02:00
Julian Oes
60d66dc23f param_shmem: before saving update the param 2016-04-05 13:02:53 +02:00
Julian Oes
4a1e9d610b param_shmem: fix the "unknown param id" bug
The recent workaround to flag all params as used did not include
param_for_used_index(). However, this function got used in the case if
one param had not been received by QGC and was requested by its index.
2016-03-22 20:38:11 +01:00
Julian Oes
61baef4b65 param_shmem: fix format 2016-03-18 11:26:29 +00:00
Julian Oes
06d7a9c491 param_shmem: fixes for params on Snapdragon
On Snapdragon we can't yet use the "used" mask for parameters and
therefore need to send all of them down to the ground station. All
params were set to used in an earlier commit but the count and index
function didn't reflect this change. This is fixed now, therefore we can
successfully receive all params in QGC.
2016-03-18 11:26:29 +00:00
Julian Oes
881a2a5860 param_shmem: make all params used
This is a workaround for the fact that the used information is not
shared between the ADSP and the Linux side on the Snapdragon. By
flagging all params used, we can at least receive them on QGC.
2016-03-10 22:26:31 +01:00
jwilson
75fad09263 Fixed problem causing a failure to obtain the shared memory lock on the AppsProc. 2016-02-19 16:59:49 +01:00
jwilson
4adfea7fa9 Resolved shared memory parameter problems and removed additional debug code. 2016-02-19 16:59:49 +01:00
Julian Oes
4b2be9c9d4 param_shmem: remove debug noise 2016-02-19 16:59:46 +01:00
Mark Charlebois
791ec37f43 Code formatter fixes
Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2016-02-19 16:59:46 +01:00
Mark Charlebois
caa94d58a6 Manually integrated Jim's changes from integrate2_jim branch
Signed-off-by: Jim Wilson <jywilson99@hotmail.com>
Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2016-02-19 16:59:46 +01:00
Mark Charlebois
dab1f835c7 Code cleanup and ifdefs required for qurt build
Code that was previously out of tree that was #if 0, is now #ifdef __PX4_QURT.
These changes were required for flight using the qurt build.

Changes include code cleanup for shmem_posix.c.

Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2016-02-19 16:59:45 +01:00
Mark Charlebois
8b22bde071 Code format fixes
Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2016-02-19 16:59:45 +01:00
Mark Charlebois
014f15d8b0 Rebase changes on upstream master
This brings in many of the changes from the PX4 fork on ATLFLight.

Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2016-02-19 16:59:43 +01:00
Mark Charlebois
fea910d45a Code cleanup and ifdefs required for qurt build
Code that was previously out of tree that was #if 0, is now #ifdef __PX4_QURT.
These changes were required for flight using the qurt build.

Changes include code cleanup for shmem_posix.c.

Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2016-02-19 16:59:43 +01:00
Mark Charlebois
5846a22a8f Code format fixes
Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2016-02-19 16:59:42 +01:00
Mark Charlebois
9f3bf8e9f4 Rebase changes on upstream master
This brings in many of the changes from the PX4 fork on ATLFLight.

Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2016-02-19 16:59:41 +01:00
Nate Weibley
0419a99f00 New param hashing spec
- When listing all params, lead with _HASH_CHECK value for cache load
 - When set value on _HASH_CHECK is rx'd, stop any ongoing listing req
2016-02-18 18:51:17 +01:00
Lorenz Meier
f52ce2001d Param lib: fix code style 2016-01-23 14:29:15 +01:00
Lorenz Meier
4b893053a0 param: Lock read operation 2016-01-23 13:32:52 +01:00
Lorenz Meier
c18d31ce41 Param write: Support locking the bus 2016-01-23 13:23:53 +01:00
Lorenz Meier
f460e95554 Param: Increase robustness of default save command 2016-01-22 14:21:09 +01:00
Lorenz Meier
3a43038583 Params: Provide set and save API 2016-01-22 11:35:56 +01:00
Nate Weibley
8a4699c656 Fix style 2015-10-12 15:26:11 -04:00
Nate Weibley
d7274ac5f0 Enable hash check of used parameters to verify integrity of GCS local copy 2015-10-12 13:40:14 -04:00
Daniel Agar
2529f07d44 restore format check 2015-10-06 18:28:30 -04:00