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: libxDot-dev-mbed5-deprecated ISL29011
Fork of Dot-Examples by
Dot-Examples rev. 31:7ec180e84cb6 have been tested with xdot-library 3.0.0-19-gb6c0ba2 and mbed-os-5.6.2
Revision 15:364df461110f, committed 2016-10-11
- Comitter:
- Mike Fiore
- Date:
- Tue Oct 11 16:33:45 2016 -0500
- Parent:
- 14:19fae4509473
- Child:
- 16:a3832552dfe1
- Commit message:
- disable ACKs and enable network link checks for OTA and AUTO_OTA examples
Changed in this revision
--- a/examples/inc/dot_util.h Tue Oct 11 13:53:32 2016 -0500 +++ b/examples/inc/dot_util.h Tue Oct 11 16:33:45 2016 -0500 @@ -20,6 +20,8 @@ void update_peer_to_peer_config(uint8_t *network_address, uint8_t *network_session_key, uint8_t *data_session_key, uint32_t tx_frequency, uint8_t tx_datarate, uint8_t tx_power); +void update_network_link_check_config(uint8_t link_check_count, uint8_t link_check_threshold); + void join_network(); void sleep_wake_rtc_only(bool deepsleep);
--- a/examples/src/auto_ota_example.cpp Tue Oct 11 13:53:32 2016 -0500
+++ b/examples/src/auto_ota_example.cpp Tue Oct 11 16:33:45 2016 -0500
@@ -16,7 +16,7 @@
static uint8_t network_key[] = { 0x1F, 0x33, 0xA1, 0x70, 0xA5, 0xF1, 0xFD, 0xA0, 0xAB, 0x69, 0x7A, 0xAE, 0x2B, 0x95, 0x91, 0x6B };
static uint8_t frequency_sub_band = 0;
static bool public_network = false;
-static uint8_t ack = 1;
+static uint8_t ack = 0;
// deepsleep consumes slightly less current than sleep
// in sleep mode, IO state is maintained, RAM is retained, and application will resume after waking up
@@ -72,6 +72,13 @@
update_ota_config_name_phrase(network_name, network_passphrase, frequency_sub_band, public_network, ack);
//update_ota_config_id_key(network_id, network_key, frequency_sub_band, public_network, ack);
+ // configure network link checks
+ // 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
+ update_network_link_check_config(3, 5);
+
// save changes to configuration
logInfo("saving configuration");
if (!dot->saveConfig()) {
--- a/examples/src/dot_util.cpp Tue Oct 11 13:53:32 2016 -0500
+++ b/examples/src/dot_util.cpp Tue Oct 11 16:33:45 2016 -0500
@@ -251,6 +251,25 @@
}
}
+void update_network_link_check_config(uint8_t link_check_count, uint8_t link_check_threshold) {
+ uint8_t current_link_check_count = dot->getLinkCheckCount();
+ uint8_t current_link_check_threshold = dot->getLinkCheckThreshold();
+
+ if (current_link_check_count != link_check_count) {
+ logInfo("changing link check count from %u to %u", current_link_check_count, link_check_count);
+ if (dot->setLinkCheckCount(link_check_count) != mDot::MDOT_OK) {
+ logError("failed to set link check count to %u", link_check_count);
+ }
+ }
+
+ if (current_link_check_threshold != link_check_threshold) {
+ logInfo("changing link check threshold from %u to %u", current_link_check_threshold, link_check_threshold);
+ if (dot->setLinkCheckThreshold(link_check_threshold) != mDot::MDOT_OK) {
+ logError("failed to set link check threshold to %u", link_check_threshold);
+ }
+ }
+}
+
void join_network() {
int32_t j_attempts = 0;
int32_t ret = mDot::MDOT_ERROR;
--- a/examples/src/ota_example.cpp Tue Oct 11 13:53:32 2016 -0500
+++ b/examples/src/ota_example.cpp Tue Oct 11 16:33:45 2016 -0500
@@ -16,7 +16,7 @@
static uint8_t network_key[] = { 0x1F, 0x33, 0xA1, 0x70, 0xA5, 0xF1, 0xFD, 0xA0, 0xAB, 0x69, 0x7A, 0xAE, 0x2B, 0x95, 0x91, 0x6B };
static uint8_t frequency_sub_band = 0;
static bool public_network = false;
-static uint8_t ack = 1;
+static uint8_t ack = 0;
// deepsleep consumes slightly less current than sleep
// in sleep mode, IO state is maintained, RAM is retained, and application will resume after waking up
@@ -70,6 +70,13 @@
// network KEY = cmac(network passphrase)
update_ota_config_name_phrase(network_name, network_passphrase, frequency_sub_band, public_network, ack);
//update_ota_config_id_key(network_id, network_key, frequency_sub_band, public_network, ack);
+
+ // configure network link checks
+ // 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
+ update_network_link_check_config(3, 5);
// save changes to configuration
logInfo("saving configuration");
