lmic fork for Senet NAMote

Dependents:   Senet NAMote

Fork of lmic_MOTE_L152RC_2 by Dave Kjendal

Revision:
17:f90b064f6107
Parent:
16:d5c50bdab1f1
--- a/lmic.cpp	Tue Nov 01 13:20:56 2016 -0400
+++ b/lmic.cpp	Fri Jan 20 20:11:27 2017 +0000
@@ -11,7 +11,8 @@
 
 //! \file
 #include "lmic.h"
-#include "debug.h"  // tmp wbr
+#include "debug.h"  
+#include "config.h"
 
  #define JOIN_REQ_DEBUG    
  #define JA_DEBUG
@@ -49,6 +50,13 @@
 DEFINE_LMIC;
 DECL_ON_LMIC_EVENT;
 
+// confirmed uplink retransmission count override
+#ifdef CUSTOM_TXCONF_ATTEMPTS
+#define _TXCONF_ATTEMPTS CUSTOM_TXCONF_ATTEMPTS
+#else
+#define _TXCONF_ATTEMPTS TXCONF_ATTEMPTS
+#endif
+
 
 // Fwd decls.
 static void engineUpdate(void);
@@ -350,17 +358,11 @@
 //  - indexed by retry count
 //  - return steps to lower DR
 static const u1_t DRADJUST[2+TXCONF_ATTEMPTS] = {
-#ifndef CFG_TXCONF_NO_RETRIES 
+
     // normal frames - 1st try / no retry
-    0,0,0
+    0,
     // confirmed frames
-    //0,0,1,0,1,0,1,0,0
-#else
-    // normal frames - 1st try / no retry
-    0,0,0
-    // confirmed frames
-    //0,0,1,0,1,0,1,0,0
-#endif
+    0,0,1,0,1,0,1,0,0
 };
 
 
@@ -1903,7 +1905,7 @@
     if( LMIC.dataLen == 0 ) {
       norx:
         if( LMIC.txCnt != 0 ) {
-            if( LMIC.txCnt < TXCONF_ATTEMPTS ) {
+            if( (_TXCONF_ATTEMPTS > 0) && (LMIC.txCnt < _TXCONF_ATTEMPTS )) {
                 LMIC.txCnt += 1;
                 setDrTxpow(DRCHG_NOACK, lowerDR(LMIC.datarate, DRADJUST[LMIC.txCnt]), KEEP_TXPOW);
                 // Schedule another retransmission