622 Commits

Author SHA1 Message Date
Daniel Agar
24b26e53b9 cmake organize code coverage handling and base 2017-06-02 19:35:18 -04:00
Daniel Agar
768faa1ae3 clang-tidy param avoid malloc(0) 2017-06-02 19:35:18 -04:00
Daniel Agar
64ed96d81a clang-tidy readability-simplify-boolean-expr 2017-06-02 19:35:18 -04:00
bresch
cdd7c57ded Multicopter mixer: When saturating, compute the new yaw value based on
the reduced thrust value
2017-05-30 12:01:42 +07:00
priseborough
519e903347 systemlib: Add circuit breaker parameter for position error checks 2017-05-03 08:37:14 +02: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
Matthias Grob
fac34de11e mixer_multirotor: switched to math::constrain (#7073)
- a local implementation was used before which is not necessary
2017-04-26 15:25:05 -04:00
Lorenz Meier
4d8b5e60c3 System: Set new logger system as the default
This will upgrade systems to the new .ulog format used by http://logs.px4.io and supported by Flight Plot
2017-04-24 10:12:23 +02:00
David Sidrane
0754e8f8bc Bugfix:hrt is used before it is initalized.
sched_note_{suspend|resume} were calling hrt_absolute_time before
   it hrt_init is called. This can lead to register access before
   clocking is enabled. The result is a hardfault.
2017-04-22 07:57:37 +02:00
Daniel Agar
c1d9972244 commander add parameter COM_ARM_MIS_REQ
- arm without mission on by default
2017-04-20 11:18:32 -04: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
Nate Weibley
6a99281501 Incorporate @bkueng's feedback, inhibit bogus output on first pass 2017-04-19 17:24:55 +02:00
Nate Weibley
56f4f2b41f Fix top output, indentation for #7020
Previously load stats were stored outside of the printloop, but
with the refactoring to save memory state was reset and used in
the first loop before the actual load calculations were valid.

Fixed by moving the summary info to the bottom of the top printout
after everything is computed. Also restructured the callback to
not depend on a line counter and fixed astyle glitches.
2017-04-19 17:24:55 +02:00
crashmatt
304aeddf03 TinyBson - Compatibility with cpp compiler
Changed "private" keyword used for argument to "priv"
2017-04-19 08:29:23 +02:00
Daniel Agar
83cf4fb16e cmake multi_tables.py dependency 2017-04-10 23:31:56 +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
e75f5a4642 perf_counter: add perf_print_counter_buffer & perf_iterate_all
These can be used to print the perf counters to a buffer.
2017-04-01 20:19:52 +02:00
Beat Küng
446c734edc perf_counter: use a mutex to protect concurrent access to the perf_counters linked list
perf_counters is read from and written to by different threads and thus
requires synchronization. Without it we risk accessing invalid memory.

There are still remaining issues (see comment in code), they will not lead
to a crash however.
2017-04-01 20:19:52 +02:00
Beat Küng
4b01e5b6b6 printload: add print_load_buffer() method
Instead of printing to an fd, this prints to a buffer and calls a callback
for each line. To avoid code duplication, the print_load has been refactored
to print to a buffer first, then print to an fd. The overhead is not
noticable, and the behavior of print_load is unchanged.
2017-04-01 20:19:52 +02:00
Beat Küng
9f3043f9ca printload: store total_runtime in a separate loop
Because during the printf, the total_runtime could be changed by another
task. This is still not entirely race-free though.
2017-04-01 20:19:52 +02:00
Beat Küng
23d0355979 printload: reduce memory usage of print_load_s
assuming CONFIG_MAX_TASKS = 32, this saves 256B of RAM
2017-04-01 20:19:52 +02:00
Beat Küng
c46274043f printload: use sched_lock to protect access to tcb
what could have gone wrong before? A scheduling switch during the printload
could have led to a task exit, rendering the tcb invalid. After switching
back, printload would access invalid memory.

This keeps the sched_lock() section as small as possible, just grabbing the
tcb variables we need.
2017-04-01 20:19:52 +02:00
Beat Küng
4a7e02c640 systemlib/visibility.h: remove this file
This is duplicated in src/include/visibility and is directly included via
compiler flag '-include'
2017-03-29 23:02:09 +02:00
Beat Küng
f60dfbbb40 perf: remove unused event_overruns, reduce type of delta times to 32bits
32 bits are still enough to measure elapsed times up to 1 hour.

Testing on Pixracer: I counted 73 allocations and 39 frees during bootup,
resulting in 2kB RAM usage after boot. This patch reduce this by ~0.5kB.
2017-03-20 09:11:34 +01: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
José Roberto de Souza
75e7cfcbe8 modules: flashparams: Change size to uint32_t
So flash sector of 64Kbyes and 128Kbytes can also be used.
2017-03-10 11:31:07 +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
Lorenz Meier
5c524e15f8 Battery params: Enforce system reboot 2017-02-27 16:37:08 +01:00
Lorenz Meier
029c6de4a9 Battery estimator: Warn on dangerously low levels.
We need to differentiate between a level where the user should act and where we are about to fall out of the sky (emergency). This helps performing more suitable failsafe actions.
2017-02-27 09:03:20 +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
68bee1b847 flashparams: remove the locking stubs
locking will be done in the params module
2017-02-17 11:27:08 +01:00
Kabir Mohammed
569251dc2e mavlink_receiver : Add external estimator interface 2017-02-15 21:47:51 +01:00
Paul Riseborough
22c8c59829 Thermal Calibration - add parameter required to control max starting temperature 2017-02-12 09:21:37 +01:00
Paul Riseborough
93a70c2d0b systemlib: Fix parameter name error 2017-02-12 09:21:37 +01:00
Paul Riseborough
c901c4b39e Thermal Calibration - add parameter required to control minimum starting temperature 2017-02-12 09:21:37 +01:00
Paul Riseborough
693cc4a533 Update SYS_CAL_TEMP parameter name and description
We will be adding another parameter to set min starting temp, so this name needs to be made less generic.
Fixes typographical errors in the description
2017-02-12 09:21:37 +01:00
Daniel Agar
317595cff3 SYS_COMPANION add 115200 normal telem 2017-02-08 08:35:29 +01:00
David Sidrane
3668047e6c board_serial uses simpler common bord indentity api 2017-02-04 22:27:04 +01:00
Beat Küng
ffacc6f64a param SYS_STCK_EN: enable stack checking by default 2017-02-04 12:15:59 +01:00