Commit Graph

206 Commits

Author SHA1 Message Date
Peter Barker b26cd59da6 AP_RCProtocol: add and use RC_Channel_config.h 2023-03-22 14:25:09 +11:00
Peter Barker 8db14c2bbf AP_RCProtocol: tidy enablement RC FastSBUS support
use the the hwdef to turn it off on IOMCU
2023-03-21 12:08:06 +11:00
Peter Barker 35e3dcd83b AP_RCProtocol: HAL_LOGGING_ENABLED in place of checking build types
We don't care how logging works, just that it does
2023-03-21 08:31:27 +11:00
Peter Barker 440db27807 AP_RCProtocol: correct use of MAX_CHANNELS in SRXL2
This is a little all over the place.  Safe, but ARRAY_SIZE ensures correctness, and we save memory...
2023-03-15 13:33:45 -07:00
Peter Barker d5bca05fb6 AP_RCProtocol: SRXL2 uses own define for max-channels
Different protocol, different count.
2023-03-15 13:33:45 -07:00
Peter Barker 9d099fbcd5 AP_RCProtocol: add option to not include SRXL in build 2023-03-15 22:45:23 +11:00
Andrew Tridgell 988028f765 AP_RCProtocol: on IOMCU don't allow protocol to change once detected
this prevents a crash where in-flight noise causes an incorrect
protocol detection, such as DSM for a SBUS input
2023-02-08 10:08:23 +11:00
Peter Barker 2a263972b2 AP_RCProtocol: iterate over array size rather than to last entry
This can move us towards not instantiating backends (having an _num_backends) at some stage.

More typical of what we do throughout the code, and makes the derefernces on the subsequent lines a lot more comfortable to casual browsing.
2023-01-25 09:14:16 +11:00
Peter Barker c139f7c730 AP_RCProtocol: add and use AP_VIDEOTX_ENABLED 2023-01-24 11:03:27 +11:00
Andy Piper 425f2b946e AP_RCProtocol: check for 3 good frames for CRSF
Move get_link_rate() and get_protocol_string() to CRSF protocol
allow ELRS at 420kbaud to be configured
allow CRSF to bootstrap at ELRS desired baudrate
2022-12-22 18:38:31 +00:00
Peter Barker 64193542ed AP_RCProtocol: allow FRSky to be compiled out 2022-11-15 18:44:45 +11:00
Andy Piper c815f04e97 AP_RCProtocol: add has_uart() 2022-10-18 11:20:25 +11:00
Peter Barker 402d9708a5 AP_RCProtocol: fix examples 2022-08-19 18:33:58 +10:00
Andy Piper 9b8ea8475d AP_RCProtocol: reset UART on RX failure for CRSF
update CRSF timestamps to use microseconds
implement RX liveness protocol and implement for CRSF
2022-06-15 17:20:36 +10:00
Andy Piper fe29324828 AP_RCProtocol: check for bad frames in CRSF decoding. 2022-06-08 17:35:03 +10:00
Andy Piper 89ea5dc12c AP_RCProtocol: flush CRSF telemety writes 2022-04-20 17:38:08 +10:00
Andrew Tridgell 5df38d0298 AP_RCProtocol: added using_uart() method 2022-03-28 17:09:26 +11:00
Andrew Tridgell 522173328c AP_RCProtocol: added failsafe_active() API 2022-03-22 10:30:35 +11:00
Andrew Tridgell 7716754c61 Revert "AP_RCProtocol: change default SBUS frame gap to 4ms"
This reverts commit af9e96c619.

revert as this causes a problem on some receivers such as the Frsky R9

fixes #19899
2022-02-11 08:10:25 +11:00
Andrew Tridgell af9e96c619 AP_RCProtocol: change default SBUS frame gap to 4ms
this is to cope with some newer receivers such as the skydroid H16
which produces SBUS frames with gaps over 2ms

without this change we get can RC failsafes constantly
2022-01-29 15:09:29 +11:00
yaapu 55bfa41d13 AP_RC_Protocol: added ExpressLRS support 2021-12-22 18:48:49 +11:00
yaapu 76bd10bf02 AP_RCProtocol: added custom telemetry frame types and subtypes to debug trace 2021-12-22 18:48:49 +11:00
Andrew Tridgell 47590a55ff AP_RCProtocol: allow changes of serial settings between protocols
if we are searching for new protocols then allow for baudrate table
changes
2021-12-21 11:07:44 +11:00
Jaaaky 91e3441c6d AP_RCProtocol: Fix multi #include's 2021-12-21 10:38:46 +11:00
Hwurzburg eaa557106a AP_RCProtocol: add RC option to report CRSF LQ as RSSI
Co-author: Jules Gilson <julesgilson@yahoo.co.uk>
2021-12-21 10:04:33 +11:00
Andy Piper 5224468ec6 AP_RCProtocol: process CRSF crc per-byte 2021-12-01 19:04:19 +11:00
Peter Barker 409147a291 AP_RCProtocol: add support for DJI Fast SBUS
It's just SBUS... but with increased opportunities for corruption
2021-11-18 17:19:04 +11:00
Peter Barker 411ed0f50e AP_RCProtocol: use data structure for serial configurations 2021-11-16 22:06:24 +11:00
Peter Barker c1cdfb448c AP_RCProtocol: move uart flow control set out of CRSF code
11:32 AM] AndrewTridgell: @Peter Barker we should disable flow control when we first add the uart - none of the RC protocols use flow control
[11:32 AM] AndrewTridgell: the blocking writes call isn't needed
[11:32 AM] Peter Barker: Thanks, I'll make a patch.
2021-11-16 22:06:24 +11:00
Peter Barker 5e18f98b8e AP_RCProtocol: number all of the RC Protocols supported
Needed this as soon as we got the RC_PROTOCOL bitmask
2021-11-12 09:00:45 +11:00
Peter Barker 7c774d02bb AP_RCProtocol: remove pointless 100kbaud speed change
added.opened is set to false.  Next time we check_added_uart, the baud
rate is unconditionally set in each of the phases.  Thus this line has
no effect except to confuse the reader
2021-11-10 07:04:47 +11:00
Peter Barker 63f87a863c AP_RCProtocol: use switch statement for 3-frame check
Forces new protocol implementer to consider whether a 3-frame check is
required
2021-11-09 09:06:45 +11:00
Andrew Tridgell 67fd862a8c AP_RCProtocol: check for RC protocol switching enable
by default don't allow protocol switching after initial protocol is
found
2021-10-15 19:29:23 -04:00
Andrew Tridgell d8c0d82857 AP_RCProtocol: allow DSM bind using uart RX pin directly 2021-10-12 15:47:51 +11:00
Andy Piper 8035b92e6e AP_RCProtocol: increase CRSF frame timeout to account for scheduling delays 2021-08-31 08:18:32 +10:00
Andrew Tridgell 0bdbdcec21 AP_RCProtocol: mark logger Write() calls as streaming where appropriate 2021-08-18 10:20:03 +10:00
Andrew Tridgell 36dcc0d16d AP_RCProtocol: make SBUS frame gap configurable 2021-08-10 10:08:05 +10:00
Andy Piper 293bb7704e AP_RCProtocol: implementation of CRSF v3
add CRSF command frame types
allow CRSF baud rate changes
record CRSF version being processed
2021-08-04 17:26:18 +10:00
Hwurzburg c5f53fc0b6 AP_RCProtocol: add Link Quality reporting to RC protocols 2021-07-16 13:27:38 +10:00
Andy Piper dd310fd12f AP_RCProtocol: move AP_VideoTX to AP_VideoTX 2021-02-23 11:43:32 +11:00
Patrick José Pereira 8f96580e9d AP_RCProtocol: Add missing const in member functions
Signed-off-by: Patrick José Pereira <patrickelectric@gmail.com>
2021-02-03 18:45:14 +11:00
Andy Piper 881fd4f37c AP_HAL_ChibiOS: use buffered writes for CRSF telemetry 2021-02-03 18:28:28 +11:00
Andy Piper f6a2d20579 AP_RCProtocol: add tracer 250Hz mode 2021-01-20 18:06:24 +11:00
yaapu 5ef20aec27 AP_RCProtocol: added support for passthrough telemetry over crossfire 2021-01-20 18:06:24 +11:00
Andy Piper 27d7c73c8e AP_RCProtocol: rc_protocols_mask must be set before bootstrap occurs 2021-01-04 20:04:19 +11:00
Andrew Tridgell 9fcf36bad9 AP_RCProtocol: save memory in IO firmware
disable FPort2 to save memory.
Disable SBUS_NI as it is not needed on IOMCU as it has a dedicated
inverter
2020-12-28 08:27:23 +11:00
Andy Piper e6d0e38129 AP_RCProtocol: allow handshake to initiate RC connection. Support listen-only SRXL2 devices.
only bootstrap when SRXL2 is the only configured protocol (RC_PROTOCOLS=256)
remove spurious 0 initializers
2020-12-16 18:06:49 +11:00
yaapu c530df7e31 AP_RCProtocol: added fport2 24ch test 2020-12-01 15:05:02 +11:00
yaapu 7e9458b53a AP_RCProtocol: fport2 fixes
Fixed 16ch fport2 telemetry and enabled bidir support.
Fixed 24ch fport2, had to disable telemetry on 24ch for timing is too tight and telemetry would be unreliable.
2020-12-01 15:05:02 +11:00
Andy Piper 7f3f135dc5 AP_RCProtocol: add debug for further CRSF messages
add better frame debug info to CRSF
2020-11-11 18:13:11 +11:00
Andrew Tridgell 2dd58c8ed1 AP_RCProtocol: send null pkts for FPort2
when we have no data to send, we should send an empty packet to ensure
the receiver schedules us for data as often as possible
2020-10-28 19:51:45 +11:00
Andrew Tridgell 20c4f1950b AP_RCProtocol: added FPort protocol test 2020-10-28 09:00:34 +11:00
Andrew Tridgell df5105e20b AP_RCProtocol: added FPort2 protocol test 2020-10-28 09:00:34 +11:00
Andrew Tridgell a8770a5a82 AP_RCProtocol: added FPort2 protocol support 2020-10-28 09:00:34 +11:00
yaapu 4dec72a230 AP_RCProtocol: added support for frsky fport bidirectional telemetry 2020-10-27 10:17:53 +11:00
yaapu f33d197b16 AP_RCProtocol: fix fport rssi 2020-09-29 09:04:38 +10:00
Andy Piper 1f3c24d436 AP_RCProtocol: put back DSM VTX control and logging, add tests 2020-09-02 17:10:59 +10:00
Andrew Tridgell 2bac4b1d97 AP_RCProtocol: fixed up DSM decoder test suite
reverted values from new decoder and added another example
2020-08-24 16:32:35 +10:00
Andrew Tridgell 78c4e27259 AP_RCProtocol: reverted DSM protocol decoder
the new decoder done by Andy is much nicer looking code, but fails to
correctly parse several valid DSM setups, and parses both SBUS and
FPort as DSM, breaking setups that were previously working
2020-08-24 16:32:35 +10:00
Andrew Tridgell 6e1aeb905f AP_RCProtocol: added another DSM satellite protocol 2020-08-24 16:32:35 +10:00
Andrew Tridgell 1560c33418 AP_RCProtocol: fixed support for spektrum satellite receivers
this was broken by the recent DSM protocol decoder change
2020-08-24 16:32:35 +10:00
Andrew Tridgell 2779b26e6e AP_RCProtocol: fixed the "3 good frames" test
require 3 consecutive good frames, not 3 frames total, to declare the
weak protocols as detected
2020-08-24 16:32:35 +10:00
Andrew Tridgell 380e9d3075 AP_RCProtocol: greatly increase robustness of DSM decoding
this prevents other protocols being decoded as DSM
2020-08-24 16:32:35 +10:00
Andrew Tridgell e0ec46f06d AP_RCProtocol: support a mask of enabled RC protocols 2020-08-24 16:32:35 +10:00
Andy Piper ce970dcf75 AP_RCProtocol: process CRSF link statistics frames to get RSSI 2020-08-06 18:24:46 +10:00
Peter Barker 8f77536c08 AP_RCProtocol: fix segfault in example due to lack of VideoTX singleton 2020-07-31 07:55:09 +10:00
Andy Piper b697a44aed AP_RCProtocol: configure VTX when a SRXL2 VTX packet is received
support DSM VTX control
2020-07-14 16:50:08 +10:00
Andy Piper 80e1c0ebb0 AP_RCProtocol: decode DSM frame markers to avoid timing related jitters especially in SITL
complete re-write of DSM decoding
2020-07-13 19:36:49 +10:00
Andy Piper 4e88adf86e AP_RCProtocol: TBS CRSF implementation
refactor rc channels decoding into backend
refactor SBUS to use decode_11bit_channels()
only support big-endian
don't include CRSF in iomcu
2020-07-07 18:48:06 +10:00
Andrew Tridgell 21937a7830 AP_RCProtocol: fixed alignment errors in SRXL2
invalid alignment used
2020-07-07 10:23:00 +10:00
Andy Piper 6162605388 AP_RCProtocol: ignore SRXL2 dbm rssi value like BF does 2020-07-07 09:03:40 +10:00
Andy Piper acff7daba5 AP_RCProtocol: scale SRXL2 using published conversion values. switch SRXL2 channels to match ArduPilot 2020-05-24 07:45:01 +10:00
Andy Piper 167e1d12d7 AP_RCProtocol: disable flow-control and buffered-writes for SRXL2 uart
switched spm_srxl.c to C++ compilation
Correctly set budget for half-duplex writes
Tidy PACKED and other externalities
disable SRXL2 on IOMCU and softserial - SRXL2 is a serial half-duplex protocol-only
fixed buffer overrun in SRXL2 parser
fix bugs in decoder sketch and allow output to SITL
2020-05-05 09:23:15 +10:00
Andy Piper e3a88f686d AP_RCTelemetry: Spektrum telemetry library and telemetry abstraction
add support for temperature, battery voltage, battery current, flight pack
altitiude, airspeed, attitude and compass, GPS, ESC telemetry based on BLHeli
status messages and QOS packets.
refactor into AP_Telemetry
conditionally compile based on HAL_MINIMIZE_FEATURES
don't initialize spektrum telemetry if there is no RC uart
2020-05-05 09:23:15 +10:00
Andy Piper 68c6a3b03d AP_RCProtocol: SRXL2 support 2020-05-05 09:23:15 +10:00
Andrew Tridgell 7e835d1037 AP_RCProtocol: fixed buffer overflow in st24 parser
found using random data injection in SITL
2020-04-21 06:02:29 +10:00
Peter Barker 061c3ecb7f AP_RCProtocol: add documentation for RCDA message 2020-04-14 07:34:59 +10:00
Andrew Tridgell 087da57858 AP_RCProtocol: added logging of RC prototol input bytes 2020-03-24 09:10:36 +09:00
Andrew Tridgell 6b35497129 AP_RCProtocol: moved fport variables into class
reduced pollution of global namespace
2020-03-20 12:37:52 +11:00
Andrew Tridgell a1069d85cb AP_RCProtocol: fixed bug in FPort parser
if we got invalid frame->type values we would overrun the buffer and
cause memory corruption. This was the cause of the bug Polarijet found
2020-03-20 12:37:52 +11:00
yaapu b4bdc76a53 AP_RCProtocol: handle 0x10 and 0x00 frames, check scheduler delay and fix incoming crc
Respond to 0x10 when the rx is controlling bandwidth, else respond only to 0x00
but in this case never exceed a max number of consecutive frames.
Always respond to polling and if necessary send a null frame.
moved delay check after get_telem_data() to account for scheduler time
align incoming to outgoing crc
2020-02-21 09:29:15 +11:00
Andrew Tridgell 8e67c3459a AP_RCProtocol: added multi-channel read() API
and use pulse_input_enable() to disable pulse input when not needed
2020-01-31 11:09:07 +11:00
yaapu 88f0d54574 AP_RCProtocol: fport downlink packet: fixed CRC and added missing PACKED attribute 2020-01-22 06:58:29 +11:00
Peter Barker 4d6f6c09fb AP_RCProtocol: add missing break statement 2020-01-15 13:55:42 +11:00
Andrew Tridgell 74ca9033e2 AP_RCProtocol: fixed support for 22ms multi-frame DSM 2020-01-09 17:38:52 +11:00
Andrew Tridgell 39b738e407 AP_RCProtocol: expand test suite for multi-frame protocols 2020-01-09 17:38:52 +11:00
Andrew Tridgell 5588229f68 AP_RCProtocol: fixed scaling on FPort RSSI
make it match OpenTX
2020-01-09 07:08:11 +11:00
Andrew Tridgell f8847bf569 AP_RCProtocol: auto-create Frsky_Telem object when needed for FPort 2020-01-02 09:52:57 +11:00
Andrew Tridgell 33182a9f11 AP_RCProtocol: use RC_OPTIONS fport pad option 2020-01-02 09:52:57 +11:00
Andrew Tridgell fd5ff97b59 AP_RCProtocol: support FPort telemetry data
get SPort data from AP_FrSky_Telem
2020-01-02 09:52:57 +11:00
Andrew Tridgell a72eaabc96 AP_RCProtocol: support FPort RSSI 2020-01-02 09:52:57 +11:00
Andrew Tridgell 9332c08c46 AP_RCProtocol: added FPort protocol support 2020-01-02 09:52:57 +11:00
Andy Piper afa232cc7e AP_RCProtocol: fix example compile on macos 2019-12-30 13:02:04 +11:00
Mirko Denecke fe46dc34d4 AP_RCProtocol: remove duplicated definition from protocol_detected 2019-10-31 08:24:30 +11:00
Andrew Tridgell aa20be4270 AP_RCProtocol: fixed SUMD with 16 channels
with 16 channels it is more than 3ms per frame
2019-09-07 10:02:26 +10:00
Andrew Tridgell c8de2ec9c7 AP_RCProtocol: added update() method for use by SITL 2019-09-06 08:51:45 +10:00
Andrew Tridgell 2b856abdd1 AP_RCProtocol: support an additional uart on RC input
this will allow for any UART to be configured as an additional RC
input source
2019-09-06 08:51:45 +10:00
Mirko Denecke 633eb11bfd AP_RCProtocol: IBUS remove unused field 2019-07-22 09:12:57 +09:00
murata 954e6a0c50 AP_RCProtocol: Match output type and variable type 2019-07-16 10:11:13 +10:00
PraiseSatan bad5fb418d AP_RCProtocol: added ibus RX support to recieve channel data from ibus transmitters. 2019-07-07 20:49:18 +10:00