@@ -107,8 +107,81 @@ Crossfire
107107 mySerial.begin(CRSF_BAUDRATE);
108108 SerialIO *receiver = new crsf(mySerial);
109109
110+ Monitoring Communication
111+ ========================
112+ You can monitor the communication status on certain protocols, to ensure reliability of the received channel data.
113+
114+ SBus
115+ ----
116+
117+ Serial Communication
118+ ^^^^^^^^^^^^^^^^^^^^
119+ You can monitor the serial communication using the `getSerialConnectionStatus() ` method on the `receiver ` instance.
120+ This method returns `true ` if the serial communication is running without errors, otherwise it returns `false `.
121+
122+ .. code-block :: cpp
123+
124+ #include <SerialIO.h>
125+
126+ rc_channels_t channelData;
127+ sbus receiver(&Serial);
128+
129+ // within your setup routine
130+ receiver.begin();
131+
132+ // within your program loop
133+ receiver.processIncoming();
134+ receiver.getChannel(&channelData);
135+
136+ bool serialConnectionStatus = receiver.getSerialConnectionStatus();
137+
138+ if(!serialConnectionStatus) {
139+ // handle failsafe of channelData
140+ }
141+
142+
143+ Radio connection
144+ ^^^^^^^^^^^^^^^^
145+ You can monitor the radio connection of the receiver using the `getFailsafe() ` method on the `receiver ` instance.
146+ The failsafe indicates when the receiver has lost connection to the transmitter.
147+ When the failsafe is activated, the channel data might be set to predefined values or hold the last known values.
148+
149+ You can also monitor the quality of the connection with `getFramelost() ` method on the `receiver ` instance.
150+ Usually lost frame indicates when a frame is lost between the transmitter an receiver.
151+ Failsafe activation requires that many frames ahs been lost in a row.
152+
153+ .. note ::
154+ Some receivers might not provide any failsafe or frame loss information via SBus protocol.
155+ In that case, the methods will always return `false `.
156+
157+ .. code-block :: cpp
158+
159+ #include <SerialIO.h>
160+
161+ rc_channels_t channelData;
162+ sbus receiver(&Serial);
163+
164+ // within your setup routine
165+ receiver.begin();
166+
167+ // within your program loop
168+ receiver.processIncoming();
169+ receiver.getChannel(&channelData);
170+
171+ bool failsafe = receiver.getFailsafe();
172+ bool frameLost = receiver.getFramelost();
173+
174+ if(failsafe) {
175+ // handle failsafe of channelData
176+ }
177+
178+ if(frameLost) {
179+ // handle frame lost event
180+ }
181+
182+
110183 See Also
111- ^^^^^^^^
184+ ========
112185- :cpp:class: `SerialIO `
113186- :cpp:class: `sbus `
114187- :cpp:class: `crsf `
0 commit comments