23 Commits

Author SHA1 Message Date
Lorenz Meier
9409122638 RC tests: Add new test file
This file is using a PX4IO-bound receiver on a DX9
2021-01-01 14:26:36 +01:00
Daniel Agar
95dd2f7e8d rc/dsm: remove system field check, add new validity checks
- unfortunately we can't depend on the system field due to potential
external binding and non-genuine Spektrum equipment
 - reject any DSM frame with duplicate channels
 - add 16 channel mask
 - tighten valid PWM range 990-2010us (±100% travel is 1102-1898µs)
 - update RCTest rejected frame count
2021-01-01 14:26:36 +01:00
Daniel Agar
63a23957b1
rc/dsm: decode improvements
- always check system field for validity
 - reject any data outside of "servo position" valid range from Spektrum specification
 - properly support XPlus channels (12+)
 - debug message if channel count changes
2020-08-02 12:52:16 -04:00
Daniel Agar
c284198bec clang-tidy: partially fix hicpp-use-override 2019-10-28 10:50:31 -04:00
Daniel Agar
3e0a3559a9 cmake use standard mechanisms for settings flags 2018-11-26 14:40:14 -08:00
Daniel Agar
f692ad04d0 boards organization 2018-11-26 14:40:14 -08:00
Mara Bos
10c20b38ad Fix many format strings.
Fixes these invalid format strings:
- A `%d` for a pointer (replaced it by `%p`)
- A 0x%08x (and a 0x%0x8!) for a pointer (replaced by %p)
- 2 cases of `%d` for a `ssize_t` (replaced it by `%zi`)
- 1 case of a %u for an `int` (replaced by %i)
- 3 cases of %d for a `long` (replaced by %ld)
- 19 cases of `%d`, `%i`, `%u` or `%lu` for a `size_t` (replaced it by `%zu`)
- An unused formatting argument (removed it)
- A missing `%d` (added it)
- A missing `%s` (added it)
- 2 cases of `%llu` for a `uint64_t` (replaced it by `"%" PRIu64`)
- 6 cases of giving a string directly as format string (replaced it by `("%s", string)`)
- 2 cases of %*-s, which should probably have been %-*s.
  (Looks like NuttX accepts (the invalid) %*-s, but other platforms don't.)
- A %04x for a `uint32_t` (replaced by "%04" PRIx32)
2018-10-27 12:44:51 +02:00
Beat Küng
1fb5353a60 rc: add unit test for CRSF RC
Also cleanup other RC unit tests
2018-07-28 15:23:09 +02:00
Kurt Kiefer
597372bec9 Gather RSSI data from Spektrum Telemetry receivers
On SPM4649T receivers with firmware versions at least 1.1RC9, the
serial data will contain an rssi value in dbm, as outlined in the
Remote Receiver Interfacing document section 8.3.1.

If the value received is greater than or equal to zero, the receiver
does not support rssi data, and the incoming value will be ignored.
However, if the value is negative, we can use the rssi value.

When we have a valid rssi, it gets mapped to a percentage from 0 to
100 as expected by mavlink. This mapping is constructed as a
logarithmic function over Spektrum's published minimum and maximum
rssi values, -92dBm to -42dBm as 0 to 100:
100 Log10[1 + (x - min) * (9 / (max - min))]

This change updates all calls to the dsm input rountes to return
the rssi value.

Note that one place this doesn't work with the px4io enabled.
There is a comment left in the absence of analog rssi that:
"we do not actually get digital RSSI regs[PX4IO_P_RAW_RC_NRSSI]".
This restriction has been left in place, as removing it exposes a
problem where the frequency of the control tick is greater than
that of valid dsm frames so the rssi isn't valid every cycle.
2018-07-22 08:42:30 +02:00
Daniel Agar
a02caff1bc unit_test inline implementation and remove module build 2017-08-23 08:06:55 +02:00
Peter Duerr
7cf2a49948 Cosmetic fix (silencing cppcheck)
* For some reason cppcheck complains with `fp != nullptr` but accepts truthiness
  of handle by itself.
* Note that the expressions are equivalent according to the C++ standard ("A
  prvalue of arithmetic, unscoped enumeration, pointer, or pointer to member
  type can be converted to a prvalue of type bool. A zero value, null pointer
  value, or null member pointer value is converted to false; any other value is
  converted to true. A prvalue of type std::nullptr_t can be converted to a
  prvalue of type bool; the resulting value is false.")
2017-08-07 22:05:17 +02:00
Daniel Agar
6631e72d6f clang-tidy modernize-redundant-void-arg 2017-02-01 22:15:50 -05:00
Daniel Agar
de128aaa6e dsm rctest fix num_values return 2017-01-30 08:41:26 +01:00
Lorenz Meier
557a57d51a Coverity: Fix RC tests 2017-01-14 07:47:03 -08:00
Lorenz Meier
1a1522d3ff Fix RC unit test 2017-01-03 14:44:45 +01:00
Benoit3
83e9e1c382 The goal of this patch is to allow compatibility with GR12/GR16/GR24 graupner receiver by :
- allowing decoding of SUMD frame with failsafe bit set
- updating stack failsafe state with the sumd failsafe info

Refer to #5817 issue
2016-11-12 14:28:57 +01:00
Lorenz Meier
f9abe39c3a DSM parser: Keep local copy of channel data 2016-10-23 19:58:52 +02:00
Lorenz Meier
f7f406c45d Expand RC test to 2nd receiver with 12 channels 2016-10-19 15:31:54 +02:00
Lorenz Meier
f511d49cc2 Improvements to SITL to make paths more flexible. (#5181) (#5255)
* Path cleanup for SITL.

* Restructured sitl scripts dir.

* Set integration tests to use ekf2 for vtol.

* Fix sitl paths for mac.
2016-08-25 21:47:45 +02:00
James Goppert
818840b576 Path cleanup, low impact changes (#5340)
* Low impact changes from path_cleanup branch.

This is a step towards minimizing the diff with path_cleanup branch.

* Update ecl.

* Revert matrix update.

* Revert ecl and matrix.

* Update sitl gazebo.

* Revert sitl_gazebo and matrix changes.
2016-08-18 15:37:23 -04:00
Lorenz Meier
102f5b54d7 Revert "Improvements to SITL to make paths more flexible. (#5181)"
This reverts commit 699b6a2cb340f4b6ec3979ae7748ff9c56cfdb89.
2016-08-05 21:29:49 +02:00
James Goppert
699b6a2cb3 Improvements to SITL to make paths more flexible. (#5181) 2016-08-05 06:23:59 -04:00
Lorenz Meier
6ab9dc0acf Testing cleanup from Daniel Agar 2016-07-29 13:49:14 +02:00