Commit Graph

155 Commits

Author SHA1 Message Date
Lorenz Meier 55e0588661 Eagle: Update to latest param message 2018-01-08 09:27:22 +01:00
Lorenz Meier ac5f856d2d Param parser and XML output: Add support for volatile attribute
This allows to mark parameters as volatile.
2018-01-08 09:27:22 +01:00
Lorenz Meier 7695f79239 Parameters: Add support for volatile parameters
Volatile parameters are ones that do not represent a fundamental configuration change but rather than incrementally changing settings. These include logged flight hours or sensor offsets. Marking them as volatile avoids these parameters forcing time-consuming telemetry updates.
2018-01-08 09:27:22 +01:00
Lorenz Meier fb3c58d85f Param interface: Publish instance count
This helps subscribers to understand if they should update their parameters or not. We will extend this with other flags such as the current save status and alike.
2018-01-08 09:27:22 +01:00
Lorenz Meier bf48a35882 Systemlib: Introduce volatile and level tags for parameters 2018-01-08 09:27:22 +01:00
Daniel Agar 430cdada60 param_export use bson encoder buffer 2018-01-04 09:21:17 +01:00
Daniel Agar 08443c0bfc params add param_find perf counter 2018-01-04 09:21:17 +01:00
Daniel Agar 641129ad4e param add perf counters 2018-01-04 09:21:17 +01:00
Hamish Willee 6bb3e65d23 Make non-wrapping/scrolling table 2017-12-03 14:10:50 +00:00
Hamish Willee c551496a41 Stop parameter names from wrapping in markdown table 2017-12-03 14:10:50 +00:00
Daniel Agar 85a7a0a86a parameters.xml sort parameters by name, sort enums by value 2017-11-22 13:42:54 -05:00
Daniel Agar fc80846825 simplify param scoping and centralize dependencies 2017-11-22 10:36:51 +01:00
Beat Küng 8a693fa13d param: undefine CHECK_PARAM_TYPE after it's used 2017-10-27 10:43:15 +02:00
Beat Küng c35b0aa270 param: redefine type-safe versions for param_get() when used in C++ code 2017-10-27 10:43:15 +02:00
Daniel Agar 2113772443 improve nuttx verbose build 2017-09-29 10:13:51 -04:00
Daniel Agar 545ce9ae24 modules remove extra semicolons 2017-09-16 21:29:52 +01:00
Beat Küng 19e7ba63ee param: use separate param save lock
param save is an expensive operation that can take several 100ms. And
previously it was possible that a param_get() caller was blocked on a
save operation. If this happened due to a param change notification,
important modules, such as sensors, could have been blocked for a longer
period (and affecting the flight performance).
With this patch, this situation is not possible anymore, because a param
save now uses the reader lock and a separate file lock.

However it is still possible that a param_set() needs to wait for a save
operation, thus blocking for a longer time. param_set() thus needs to be
avoided in important modules when the system is armed.
In the case of mavlink it works, since it does not affect the flight if
the mavlink receiver is blocked over a longer time. It is only problematic
if a joystick is used as input or in offboard control.
2017-09-12 08:46:10 +02:00
Daniel Agar 9b5fe8c476 ignore -Wsign-compare per module 2017-09-07 10:27:36 +02:00
Beat Küng 8923664f30 param: seek to the beginning of the file before re-trying a failed export attempt 2017-07-29 23:10:47 +02:00
Beat Küng 931ef189b5 param: grab the shutdown lock while writing params to the file 2017-07-29 23:10:47 +02:00
Beat Küng 7fc20049e0 param_shmem import: don't fail on type mismatch 2017-07-20 18:49:38 +02:00
Beat Küng 2340e7073d param import: don't fail on type mismatch
This can happen for example when a param type is changed from int32 to
float. The type check will then fail if the param is stored and the param
import will be aborted.
Now we just skip the entry and continue loading the rest.
2017-07-20 18:49:38 +02:00
Daniel Agar 8b3fb1e999 param fix parameters.xml dependency 2017-06-19 20:24:09 +02:00
Daniel Agar bd60f87283 move param jinja templates into relevant module 2017-06-12 12:18:53 -04:00
Daniel Agar 4937449890 move parameter unittest into systemcmds 2017-06-12 12:18:53 -04:00
Daniel Agar f26cd01d16 param gen reorganize and fix DISABLE_PARAMS_MODULE_SCOPING 2017-06-12 12:18:53 -04:00
Daniel Agar 768faa1ae3 clang-tidy param avoid malloc(0) 2017-06-02 19:35:18 -04:00
David Sidrane 6aadc75d18 Removed interrupt based locking on FMUv4 HW
The ramtron driver already calls SPI_LOCK when accessing the
  FRAM.

  Removed the interrupt lockout and anabled the SPI_LOCK
  in the ms5611 driver on any HW where the
  PX4_SPI_BUS_BARO == PX4_SPI_BUS_RAMTRON
2017-05-03 08:17:12 +02:00
Beat Küng 694bf48422 system: add generic shutdown API 2017-04-20 10:01:51 +02:00
jwilson 57fa031e2b Fixes problem preventing params on snapdragon platforms from being saved to flash memory. 2017-04-20 09:06:13 +02:00
Beat Küng 044a767235 param: add PARAM_NO_AUTOSAVE: if defined, do not depend on LP work queue
Some NuttX configs do not have the work queues enabled.
2017-04-06 11:49:03 +02:00
Beat Küng dffba3e03b param: move variable definitions to the top of the file 2017-04-06 11:49:03 +02:00
Beat Küng a0e2b0c5a2 param: add param_control_autosave to enable/disable autosave 2017-04-06 11:49:03 +02:00
Beat Küng f3e9739ab0 param export: use writer lock
to protect against concurrent writes to the same file
2017-04-06 11:49:03 +02:00
Beat Küng a5cdff06d5 param: implement rate-limited autosave
- add a saving delay of 300ms
- save at most once every 2 seconds
2017-04-06 11:49:03 +02:00
Beat Küng f6d9d77f60 param_notify_changes: set unsaved to true
This will make sure that commmander will save the params.
2017-03-14 21:43:30 +01:00
Beat Küng 0e650638e4 param: implement RW locking
This allows concurrent read access, which are much more common; reducing
potential lock contention and increasing concurrency.

Taking a lock is expensive, and the reader lock is now even more expensive.
An RCU synchronization scheme would reduce the overhead of the readers to
increasing/decreasing an atomic counter.
Thus this should only be an intermediate step until we move towards RCU.

Tested on SITL & Pixracer.
2017-03-14 21:30:53 +01:00
Beat Küng b4290b6b52 params: make param_t uint16_t on NuttX
param_t is only used as an offset and we have <1000 params, so an uint16_t
is enough.
This saves roughly 1KB of RAM. We only do that on NuttX because normal
integers have better performance in general.
Previously on amd64, this was even 64bits because it was an uintptr_t.
2017-03-14 21:30:53 +01:00
Julian Oes 0c926106f1 param_shmem.c: comment out locking on Snappy
The param locking doesn't seem to be working on Snapdragon, so let's
just comment it out again.
2017-03-08 15:44:31 +01:00
Beat Küng cfa84954ea param_get: add null-pointer check
If param_find() returned PARAM_INVALID, and this was directly passed to
param_get(), param_get_value_ptr() returned null and we read garbage data
(or segfaulted on systems with virtual memory).
On px4fmu-v2, this happened for the param ATT_VIBE_THRESH in sensors.
Because of the recently added parameter scoping, this param got pruned, as
it's defined in attitude_estimator_q.

credits for finding this go to Jeyong Shin (jeyong).
2017-02-25 11:02:15 +01:00
Beat Küng a4050db766 param: comment what the lock is needed for 2017-02-17 11:27:08 +01:00
Beat Küng df8f0da70c param & param_shmem: enable locking
We need to protect access to the param_values array. This is dynamically
allocated and resized (utarray_reserve() calls realloc). If some thread
was iterating the array while another was resizing the array, the first one
would iterate on a freed array, thus accessing invalid memory.

On NuttX this could lead to hardfaults in rare conditions.

Unfortunately we need to initialize the semaphore on startup, by calling
sem_init(). This adds a param_init() method called by every board/config
that uses the params (at least I think I've found all of them)
2017-02-17 11:27:08 +01:00
Beat Küng fa3a6b890c param & flashparam param_export: use value directly instead of calling param_get
This call is not needed, and will avoid deadlocks when locking is enabled.
2017-02-17 11:27:08 +01:00
Beat Küng 42967df63f param command: use param_* calls even if flash-based params are enabled
This will ensure proper locking.
2017-02-17 11:27:08 +01:00
Beat Küng 32ed939ea4 param_shmem: readd dropped static to function definition 2017-02-03 13:57:48 +01:00
Beat Küng a802caca87 param: add param_notify_changes() method
Can be used for example after several calls to
param_set_no_notification() to avoid unnecessary system notifications,
as it is an expensive change.
2017-02-03 13:57:48 +01:00
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