Basic xdot code to check how many memory is available for user APP after initializing libxdot lorawan stack

Revision:
21:09d05faf0e13
Parent:
17:d4f82e16de5f
Child:
22:d9bc10bbc433
diff -r 9ea0f3385ab3 -r 09d05faf0e13 examples/src/ota_example.cpp
--- a/examples/src/ota_example.cpp	Tue May 16 10:47:10 2017 -0500
+++ b/examples/src/ota_example.cpp	Fri Jun 09 08:31:21 2017 -0500
@@ -29,6 +29,7 @@
 static uint8_t frequency_sub_band = 0;
 static bool public_network = false;
 static uint8_t ack = 0;
+static bool adr = true;
 
 // deepsleep consumes slightly less current than sleep
 // in sleep mode, IO state is maintained, RAM is retained, and application will resume after waking up
@@ -37,6 +38,7 @@
 static bool deep_sleep = false;
 
 mDot* dot = NULL;
+lora::ChannelPlan* plan = NULL;
 
 Serial pc(USBTX, USBRX);
 
@@ -55,7 +57,23 @@
 
     mts::MTSLog::setLogLevel(mts::MTSLog::TRACE_LEVEL);
     
-    dot = mDot::getInstance();
+#if CHANNEL_PLAN == CP_US915
+    plan = new lora::ChannelPlan_US915();
+#elif CHANNEL_PLAN == CP_AU915
+    plan = new lora::ChannelPlan_AU915();
+#elif CHANNEL_PLAN == CP_EU868
+    plan = new lora::ChannelPlan_EU868();
+#elif CHANNEL_PLAN == CP_KR920
+    plan = new lora::ChannelPlan_KR920();
+#elif CHANNEL_PLAN == CP_AS923
+    plan = new lora::ChannelPlan_AS923();
+#elif CHANNEL_PLAN == CP_AS923_JAPAN
+    plan = new lora::ChannelPlan_AS923_Japan();
+#endif
+    assert(plan);
+
+    dot = mDot::getInstance(plan);
+    assert(dot);
 
     // attach the custom events handler
     dot->setEvents(&events);
@@ -89,8 +107,11 @@
         // network link checks are a good alternative to requiring the gateway to ACK every packet and should allow a single gateway to handle more Dots
         // check the link every count packets
         // declare the Dot disconnected after threshold failed link checks
-        // for count = 3 and threshold = 5, the Dot will be considered disconnected after 15 missed packets in a row
+        // for count = 3 and threshold = 5, the Dot will ask for a link check response every 5 packets and will consider the connection lost if it fails to receive 3 responses in a row
         update_network_link_check_config(3, 5);
+
+        // enable or disable Adaptive Data Rate
+        dot->setAdr(adr);
     
         // save changes to configuration
         logInfo("saving configuration");