Fork of Semtech LoRaWAN stack

Fork of LoRaWAN-lib by canuck lehead

Branch:
v4.2.0
Revision:
12:d09ccf69cc93
Parent:
11:507de2ecd2b3
Child:
13:90a55bd536a1
--- a/LoRaMac.cpp	Fri Aug 26 16:10:43 2016 -0400
+++ b/LoRaMac.cpp	Mon Aug 29 14:28:26 2016 -0400
@@ -2461,7 +2461,16 @@
                         channelsMask[0] = chMask;
                     }
 #elif defined( USE_BAND_915 ) || defined( USE_BAND_915_HYBRID )
-                    if( chMaskCntl == 6 )
+                    if( chMaskCntl < 4 )
+                    {
+                        channelsMask[chMaskCntl] = chMask;
+                    }
+                    else if( chMaskCntl == 5 )
+                    {
+                        // RFU
+                        linkAdrStatus &= 0xFE; // Channel mask KO
+                    }
+                    else if( chMaskCntl == 6 )
                     {
                         // Enable all 125 kHz channels
                         for( uint8_t i = 0, k = 0; i < LORA_MAX_NB_CHANNELS - 8; i += 16, k++ )
@@ -2474,10 +2483,8 @@
                                 }
                             }
                         }
-
                         // channel mask applied to 500 kHz channels
-                        channelsMask[4] = chMask;
-                        chMaskCntl = 4;
+                        channelsMask[4] =  chMask; 
                     }
                     else if( chMaskCntl == 7 )
                     {
@@ -2488,13 +2495,7 @@
                         channelsMask[3] = 0x0000;
 
                         // channel mask applied to 500 kHz channels
-                        channelsMask[4] = chMask;
-                        chMaskCntl = 4;
-                    }
-                    else if( chMaskCntl == 5 )
-                    {
-                        // RFU
-                        linkAdrStatus &= 0xFE; // Channel mask KO
+                        channelsMask[4] =  chMask; 
                     }
 #else
     #error "Please define a frequency band in the compiler options."