Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: GroveGPS libmDot-mbed5 ISL29011
Diff: examples/src/auto_ota_example.cpp
- Revision:
- 21:09d05faf0e13
- Parent:
- 17:d4f82e16de5f
- Child:
- 22:d9bc10bbc433
--- a/examples/src/auto_ota_example.cpp Tue May 16 10:47:10 2017 -0500
+++ b/examples/src/auto_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 = true;
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);
@@ -90,9 +108,12 @@
// 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");
if (!dot->saveConfig()) {