ver1

Revision:
179:578d8030ba57
Parent:
178:8f7d93f3bbb5
Child:
182:b642f4d0c95b
--- a/plans/ChannelPlan_AU915.cpp	Wed Sep 12 15:04:15 2018 -0500
+++ b/plans/ChannelPlan_AU915.cpp	Tue Sep 18 08:25:04 2018 -0500
@@ -160,8 +160,11 @@
 }
 
 uint8_t ChannelPlan_AU915::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;
@@ -668,9 +671,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