lmic fork for Senet NAMote

Dependents:   Senet NAMote

Fork of lmic_MOTE_L152RC_2 by Dave Kjendal

Files at this revision

API Documentation at this revision

Comitter:
shaunkrnelson
Date:
Fri Jan 20 20:11:27 2017 +0000
Parent:
16:d5c50bdab1f1
Commit message:
DisablING confirmed retries in config.h with CUSTOM_TXCONF_ATTEMPTS=0

Changed in this revision

config.h Show annotated file Show diff for this revision Revisions of this file
lmic.cpp Show annotated file Show diff for this revision Revisions of this file
lmic.h Show annotated file Show diff for this revision Revisions of this file
diff -r d5c50bdab1f1 -r f90b064f6107 config.h
--- a/config.h	Tue Nov 01 13:20:56 2016 -0400
+++ b/config.h	Fri Jan 20 20:11:27 2017 +0000
@@ -6,7 +6,7 @@
 #define CFG_noassert
 
 // No tx confirm retries
-#define CFG_TXCONF_NO_RETRIES
+#define CUSTOM_TXCONF_ATTEMPTS 0
 
 //#define CHNL_HYBRID     0       /* 0-7 to select block of 8 channels used */
 //define ONLY_HYBRID     false
diff -r d5c50bdab1f1 -r f90b064f6107 lmic.cpp
--- 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
diff -r d5c50bdab1f1 -r f90b064f6107 lmic.h
--- a/lmic.h	Tue Nov 01 13:20:56 2016 -0400
+++ b/lmic.h	Fri Jan 20 20:11:27 2017 +0000
@@ -25,11 +25,8 @@
 #define LMIC_VERSION_BUILD 1431528305
 
 enum { MAX_FRAME_LEN      =  64 };   //!< Library cap on max frame length
-#ifdef CFG_TXCONF_NO_RETRIES
-enum { TXCONF_ATTEMPTS    =   1 };   //!< Transmit attempts for confirmed frames
-#else
+
 enum { TXCONF_ATTEMPTS    =   8 };   //!< Transmit attempts for confirmed frames
-#endif
 
 enum { MAX_MISSED_BCNS    =  20 };   // threshold for triggering rejoin requests
 enum { MAX_RXSYMS         = 100 };   // stop tracking beacon beyond this