Fork to see if I can get working

Dependencies:   BufferedSerial OneWire WinbondSPIFlash libxDot-dev-mbed5-deprecated

Fork of xDotBridge_update_test20180823 by Matt Briggs

Revision:
95:aa9908d459c2
Parent:
91:8196900df6fe
--- a/xDotBridge/src/CommProtocolPeerBrute.cpp	Wed Nov 22 01:11:36 2017 +0000
+++ b/xDotBridge/src/CommProtocolPeerBrute.cpp	Tue Nov 28 16:15:23 2017 +0000
@@ -9,7 +9,7 @@
 #include "dot_util.h"
 #include "util.h"
 #include "MyLog.h"
-#include "ChannelPlan.h"
+#include "ChannelPlans.h"
 
 // wireless bridge protocol
 const uint8_t TX_PWR = 20; // 20 dBm
@@ -57,6 +57,7 @@
 
 //    myLogInfo("defaulting Dot configuration");
 //    dot->resetConfig();
+//    dot->setWakePin(GPIO0);
 
     // Common Configuration
     dot->setAesEncryption(true);  // Enable encryption
@@ -86,7 +87,7 @@
             // DR6 : SF7 @ 250kHz
             // DR0 - DR5 (125kHz channels) available but much slower
             tx_frequency = 869850000;
-            tx_datarate = mDot::DR6;
+            tx_datarate = lora::DR_6;
             // the 869850000 frequency is 100% duty cycle if the total power is under 7 dBm - tx power 4 + antenna gain 3 = 7
             tx_power = 4;
             break;
@@ -94,7 +95,6 @@
         case lora::ChannelPlan::US915:
         case lora::ChannelPlan::AU915_OLD:
         case lora::ChannelPlan::AU915:
-        default:
             // 500kHz channels achieve highest throughput
             // DR8 : SF12 @ 500kHz
             // DR9 : SF11 @ 500kHz
@@ -104,10 +104,13 @@
             // DR13 : SF7 @ 500kHz
             // DR0 - DR3 (125kHz channels) available but much slower
             tx_frequency = 915500000;
-            tx_datarate = mDot::DR13;
+            tx_datarate = lora::DR_13;
             // 915 bands have no duty cycle restrictions, set tx power to max
             tx_power = 20;
             break;
+        default:
+        	logError("ChannelPlan Error!!!");
+			return cmdError;
     }
     // in PEER_TO_PEER mode there is no join request/response transaction
     // as long as both Dots are configured correctly, they should be able to communicate
@@ -123,8 +126,9 @@
         return cmdError;
     }
 
-//    myLogInfo("defaulting Dot configuration");
-//    dot->resetConfig();
+    myLogInfo("defaulting Dot configuration"); // TEST
+    dot->resetConfig();
+    dot->setWakePin(GPIO0);
 
     // Common Configuration
     dot->setAesEncryption(true);  // Enable encryption
@@ -133,8 +137,6 @@
     dot->setClass("C"); // Set class C
     dot->setTxPower(TX_PWR);
     dot->setPreserveSession(false);
-//    dot->setDownLinkCounter(0);
-//    dot->setUpLinkCounter(1);
     // TODO break out in a utility function
     // update configuration if necessary
     myLogDebug("Setting up peer to peer configuration");
@@ -156,7 +158,7 @@
             // DR6 : SF7 @ 250kHz
             // DR0 - DR5 (125kHz channels) available but much slower
             tx_frequency = 869850000;
-            tx_datarate = mDot::DR6;
+            tx_datarate = lora::DR_6;
             // the 869850000 frequency is 100% duty cycle if the total power is under 7 dBm - tx power 4 + antenna gain 3 = 7
             tx_power = 4;
             break;
@@ -164,7 +166,6 @@
         case lora::ChannelPlan::US915:
         case lora::ChannelPlan::AU915_OLD:
         case lora::ChannelPlan::AU915:
-        default:
             // 500kHz channels achieve highest throughput
             // DR8 : SF12 @ 500kHz
             // DR9 : SF11 @ 500kHz
@@ -174,10 +175,14 @@
             // DR13 : SF7 @ 500kHz
             // DR0 - DR3 (125kHz channels) available but much slower
             tx_frequency = 915500000;
-            tx_datarate = mDot::DR13;
+            tx_datarate = lora::DR_13;
             // 915 bands have no duty cycle restrictions, set tx power to max
             tx_power = 20;
             break;
+        default:
+        	logError("ChannelPlan Error!!!");
+			return cmdError;
+
     }
     update_peer_to_peer_config(pair_network_address, pair_network_session_key, pair_data_session_key, tx_frequency, tx_datarate, tx_power);
     dot->saveConfig(); // This is required for network settings to apply