ver1

Revision:
179:578d8030ba57
Parent:
178:8f7d93f3bbb5
Child:
182:b642f4d0c95b
--- a/plans/ChannelPlan_US915.cpp	Wed Sep 12 15:04:15 2018 -0500
+++ b/plans/ChannelPlan_US915.cpp	Tue Sep 18 08:25:04 2018 -0500
@@ -159,8 +159,10 @@
 
 uint8_t ChannelPlan_US915::HandleJoinAccept(const uint8_t* buffer, uint8_t size) {
 
-    if (size > 17) {
-        // TODO: Handle future channel mask settings
+    if (size > 17 && buffer[28] == 0x01) {
+        for (int i = 13; i < size - 5; i += 2) {
+            SetChannelMask((i-13)/2, buffer[i+1] << 8 | buffer[i]);
+        }
     }
 
     return LORA_OK;
@@ -678,9 +680,11 @@
     }
 
     if (GetSettings()->Network.ADREnabled) {
-        GetSettings()->Session.TxDatarate = datarate;
-        GetSettings()->Session.TxPower = TX_POWERS[power];
-        GetSettings()->Session.Redundancy = nbRep;
+        if (status == 0x07) {
+            GetSettings()->Session.TxDatarate = datarate;
+            GetSettings()->Session.TxPower = TX_POWERS[power];
+            GetSettings()->Session.Redundancy = nbRep;
+        }
     } else {
         logDebug("ADR is disabled, DR and Power not changed.");
         status &= 0xFB; // TxPower KO