fp

Dependencies:   libmDot-mbed5 ISL29011

Revision:
21:09d05faf0e13
Parent:
15:364df461110f
Child:
24:d80afce304c6
--- a/examples/src/dot_util.cpp	Tue May 16 10:47:10 2017 -0500
+++ b/examples/src/dot_util.cpp	Fri Jun 09 08:31:21 2017 -0500
@@ -19,8 +19,9 @@
     logInfo("=====================");
     logInfo("version ------------------ %s", dot->getId().c_str());
     logInfo("device ID/EUI ------------ %s", mts::Text::bin2hexString(dot->getDeviceId()).c_str());
-    logInfo("frequency band ----------- %s", mDot::FrequencyBandStr(dot->getFrequencyBand()).c_str());
-    if (dot->getFrequencySubBand() != mDot::FB_EU868) {
+    logInfo("default channel plan ----- %s", mDot::FrequencyBandStr(dot->getDefaultFrequencyBand()).c_str());
+    logInfo("current channel plan ----- %s", mDot::FrequencyBandStr(dot->getFrequencyBand()).c_str());
+    if (lora::ChannelPlan::IsPlanFixed(dot->getFrequencyBand())) {
         logInfo("frequency sub band ------- %u", dot->getFrequencySubBand());
     }
     logInfo("public network ----------- %s", dot->getPublicNetwork() ? "on" : "off");
@@ -49,7 +50,12 @@
     }
     logInfo("TX datarate -------------- %s", mDot::DataRateStr(dot->getTxDataRate()).c_str());
     logInfo("TX power ----------------- %lu dBm", dot->getTxPower());
-    logInfo("atnenna gain ------------- %u dBm", dot->getAntennaGain());
+    logInfo("antenna gain ------------- %u dBm", dot->getAntennaGain());
+    logInfo("LBT ---------------------- %s", dot->getLbtTimeUs() ? "on" : "off");
+    if (dot->getLbtTimeUs()) {
+	logInfo("LBT time ----------------- %lu us", dot->getLbtTimeUs());
+	logInfo("LBT threshold ------------ %d dBm", dot->getLbtThreshold());
+    }
 }
 
 void update_ota_config_name_phrase(std::string network_name, std::string network_passphrase, uint8_t frequency_sub_band, bool public_network, uint8_t ack) {
@@ -73,11 +79,13 @@
         }
     }
     
-    if (current_frequency_sub_band != frequency_sub_band) {
-        logInfo("changing frequency sub band from %u to %u", current_frequency_sub_band, frequency_sub_band);
-        if (dot->setFrequencySubBand(frequency_sub_band) != mDot::MDOT_OK) {
-            logError("failed to set frequency sub band to %u", frequency_sub_band);
-        }
+    if (lora::ChannelPlan::IsPlanFixed(dot->getFrequencyBand())) {
+	if (current_frequency_sub_band != frequency_sub_band) {
+	    logInfo("changing frequency sub band from %u to %u", current_frequency_sub_band, frequency_sub_band);
+	    if (dot->setFrequencySubBand(frequency_sub_band) != mDot::MDOT_OK) {
+		logError("failed to set frequency sub band to %u", frequency_sub_band);
+	    }
+	}
     }
     
     if (current_public_network != public_network) {
@@ -119,11 +127,13 @@
         }
     }
     
-    if (current_frequency_sub_band != frequency_sub_band) {
-        logInfo("changing frequency sub band from %u to %u", current_frequency_sub_band, frequency_sub_band);
-        if (dot->setFrequencySubBand(frequency_sub_band) != mDot::MDOT_OK) {
-            logError("failed to set frequency sub band to %u", frequency_sub_band);
-        }
+    if (lora::ChannelPlan::IsPlanFixed(dot->getFrequencyBand())) {
+	if (current_frequency_sub_band != frequency_sub_band) {
+	    logInfo("changing frequency sub band from %u to %u", current_frequency_sub_band, frequency_sub_band);
+	    if (dot->setFrequencySubBand(frequency_sub_band) != mDot::MDOT_OK) {
+		logError("failed to set frequency sub band to %u", frequency_sub_band);
+	    }
+	}
     }
     
     if (current_public_network != public_network) {