NinjaFlight
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Receiver

RC Interface (Radio Control)

RC is a higher level interface to the low level RX functions. While RX is able to provide support for reading various receivers, RC set of functions allows you to check if certain stick combinations are active and also supports configurable functions that are triggered when a certain channel is in a certain range. To the application RC module provides an interface similar to that of a keyboard. It allows checking if a certain combination is active using rc_key_pressed() and it also supports callback listener (struct rc_event_listener) through which it can notify the application when a certain key transitions from one state to another.

RX (Lower level receiver)

RX module is responsible for interfacing with various types of receivers. It does so by using system calls (struct system_calls) and supports interpreting pwm/ppm as well as serial receivers. The main responsibility of this module is to provide uniform access to receivers which usually involves remapping channels to a layout that is standard for the rest of Ninjaflight. This module also provides basic failsafe functionality by allowing user to configure how each channel responds to signal loss (it is possible to set a static value, keep previously received value or reset the channel to default value).This is a summary of automatic tests that are done against the receiver module to guarantee that the module behaves according to the requirements set forth below.

Receiver Unit Tests

This is a summary of automatic tests that are done against the receiver module to guarantee that the module behaves according to the requirements set forth below.
  • RX should output data on 16 channels. If hardware supports less then rx should output failsafe values on the remaining channels. If supplied channel is out of range then rx should output midrc.
  • On startup all receiver channels should return failsafe values. As new channels are connected rx will return the received values. However as any of the channels lose signal rx should hold the value for a timeout and then mark the rx as not heathy and return failsafe for that single channel. As the channel is connected again, rx should become heathy. RX should report that it has signal until all channels are lost.
  • Upon signal loss (all channels first valid then invalid) all channels should be outputting failsafe values.
  • Each channel shall have configurable failsafe that can output one of three alternatives: 1) auto: all channels are set to midrc except throttle. 2) hold: holds old channel information. 3) set: failsafe returnes a user configurable value. For safety reasons, non-aux channels should only support AUTO mode.
  • Receiver shall support channel remapping using a string that specifies ordering of the channels. Incoming signal shall be mapped from supplied configuration into standard "AERT12345678abcdefgh" channel ordering.
  • RX outputs shall be represented by microsecond interval in range of rx_min_usec* to rx_max_usec. If any inputs are outside of this range then they should be properly constrianed.