Read Error 10 years ago
parent
commit
167967c88b
1 changed files with 33 additions and 8 deletions
  1. 33
    8
      frsky_arduino_rx_complete.ino

+ 33
- 8
frsky_arduino_rx_complete.ino View File

12
 #include <avr/interrupt.h>
12
 #include <avr/interrupt.h>
13
 #include <EEPROM.h>
13
 #include <EEPROM.h>
14
 #include "iface_cc2500.h"
14
 #include "iface_cc2500.h"
15
-//#define DEBUG
16
-//#define DEBUG0
17
-//#define DEBUG1
18
-//#define DEBUG2
19
-//#define DEBUG3
20
-//#define DEBUG4
21
-//#define DEBUG5
15
+#define DEBUG
16
+#define DEBUG0
17
+#define DEBUG1
18
+#define DEBUG2
19
+#define DEBUG3
20
+#define DEBUG4
21
+#define DEBUG5
22
 #define FAILSAFE
22
 #define FAILSAFE
23
 #define SPIBB
23
 #define SPIBB
24
 //#define SPIHW
24
 //#define SPIHW
102
 boolean debug = false;
102
 boolean debug = false;
103
 int count = 0;
103
 int count = 0;
104
 uint16_t c[8];
104
 uint16_t c[8];
105
-
105
+boolean debug2 = true;
106
+boolean debug3 = false;
106
 
107
 
107
 void setup()
108
 void setup()
108
 {
109
 {
381
                     cc2500_readFifo((uint8_t *)ccData, ccLen);
382
                     cc2500_readFifo((uint8_t *)ccData, ccLen);
382
                     if (ccData[ccLen - 1] & 0x80) {
383
                     if (ccData[ccLen - 1] & 0x80) {
383
                         if (ccData[2] == 0x01) {
384
                         if (ccData[2] == 0x01) {
385
+                          if(debug2) {
386
+                            //Serial.print(" ccData[2] = ");
387
+                            //Serial.println(ccData[2]);
388
+                          }
384
                             if ((ccData[3] == txid[0]) && (ccData[4] == txid[1])) {
389
                             if ((ccData[3] == txid[0]) && (ccData[4] == txid[1])) {
390
+                              if(debug2) 
391
+                              {
392
+                                Serial.print("ccData[5] = ");
393
+                                Serial.println(ccData[5]);
394
+                                Serial.print("bindIdx = ");
395
+                                Serial.println(bindIdx);                      
396
+                              }
385
                                 if (ccData[5] == bindIdx) {
397
                                 if (ccData[5] == bindIdx) {
386
                                     for (uint8_t n = 0; n < 5; n++) {
398
                                     for (uint8_t n = 0; n < 5; n++) {
399
+                                      if(debug3) 
400
+                                      {
401
+                                        Serial.print("ccData[6 + n] = ");
402
+                                        Serial.println(ccData[6 + n]);
403
+                                        Serial.print("ccData[ccLen - 3] = ");
404
+                                        Serial.println(ccData[ccLen - 3]);                      
405
+                                      }
387
                                         if (ccData[6 + n] == ccData[ccLen - 3]) {
406
                                         if (ccData[6 + n] == ccData[ccLen - 3]) {
388
                                             eol = true;
407
                                             eol = true;
408
+                                            #if defined(DEBUG)
409
+                                                Serial.print("listLength: ");
410
+                                                Serial.println(listLength);
411
+                                            #endif
389
                                             listLength = ccData[5] + n;
412
                                             listLength = ccData[5] + n;
390
                                             break;
413
                                             break;
391
                                         }
414
                                         }
406
     }
429
     }
407
 
430
 
408
     #if defined(DEBUG)
431
     #if defined(DEBUG)
432
+        listLength = 47;
433
+        Serial.println("jumpIdx list: ");
409
         for (uint8_t jumpIdx = 0; jumpIdx < (listLength); jumpIdx++) {
434
         for (uint8_t jumpIdx = 0; jumpIdx < (listLength); jumpIdx++) {
410
             Serial.print(" ");
435
             Serial.print(" ");
411
             Serial.print(hopData[jumpIdx], HEX);
436
             Serial.print(hopData[jumpIdx], HEX);

Loading…
Cancel
Save