Pasted as C++ [Remove this paste ]
Description: No description
URL: http://bcas.tv/paste/results/Lf3QLL43.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
@@ -435,28 +422,25 @@
     uint16_t auxState = 0;
     static uint8_t GPSNavReset = 1;
     bool isThrottleLow = false;
+    bool RCready = false;
 
     // calculate rc stuff from serial-based receivers (spek/sbus)
     if (feature(FEATURE_SERIALRX)) {
-        bool ready = false;
         switch (mcfg.serialrx_type) {
             case SERIALRX_SPEKTRUM1024:
             case SERIALRX_SPEKTRUM2048:
-                ready = spektrumFrameComplete();
+                RCready = spektrumFrameComplete();
                 break;
             case SERIALRX_SBUS:
-                ready = sbusFrameComplete();
+                RCready = sbusFrameComplete();
                 break;
         }
-        if (ready)
-            computeRC();
     }
 
-    if ((int32_t)(currentTime - rcTime) >= 0) { // 50Hz
+    if (((int32_t)(currentTime - rcTime) >= 0) || (RCready)) { // 50Hz or data driven
+        RCready = false;
         rcTime = currentTime + 20000;
-        // TODO clean this up. computeRC should handle this check
-        if (!feature(FEATURE_SERIALRX))
-            computeRC();
+        computeRC();
 
         // in 3D mode, we need to be able to disarm by switch at any time
         if (feature(FEATURE_3D)) {