FF1705 support added
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 2:ffac7b141b72, committed 2016-10-06
- Comitter:
- mfiore
- Date:
- Thu Oct 06 16:44:19 2016 +0000
- Parent:
- 1:c4915e00d2ce
- Child:
- 3:0e3e776e2862
- Commit message:
- save configuration so AUTO_OTA example works properly. clarify some comments and logging.
Changed in this revision
--- a/examples/src/auto_ota_example.cpp Thu Oct 06 14:49:35 2016 +0000
+++ b/examples/src/auto_ota_example.cpp Thu Oct 06 16:44:19 2016 +0000
@@ -40,7 +40,7 @@
// make sure library logging is turned on
dot->setLogLevel(mts::MTSLog::INFO_LEVEL);
- // update configuration if necessary, then display it
+ // update configuration if necessary
// in AUTO_OTA mode the session is automatically saved, so saveNetworkSession and restoreNetworkSession are not needed
if (dot->getJoinMode() != mDot::AUTO_OTA) {
logInfo("changing network join mode to AUTO_OTA");
@@ -49,6 +49,15 @@
}
}
update_ota_config(network_name, network_passphrase, frequency_sub_band, public_network, ack);
+
+ // save changes to configuration
+ // AUTO_OTA must be the saved join mode in order for the session to be properly restored after waking up from deepsleep
+ logInfo("saving configuration");
+ if (!dot->saveConfig()) {
+ logError("failed to save configuration");
+ }
+
+ // display configuration
display_config();
while (true) {
--- a/examples/src/dot_util.cpp Thu Oct 06 14:49:35 2016 +0000
+++ b/examples/src/dot_util.cpp Thu Oct 06 16:44:19 2016 +0000
@@ -7,7 +7,7 @@
logInfo("---------------------");
logInfo("\tdevice ID/EUI: %s", mts::Text::bin2hexString(dot->getDeviceId()).c_str());
logInfo("\tfrequency band: %s", mDot::FrequencyBandStr(dot->getFrequencyBand()).c_str());
- if (dot->getFrequencySubBand() != mDot::EU868) {
+ if (dot->getFrequencySubBand() != mDot::FB_EU868) {
logInfo("\tfrequency sub band: %u", dot->getFrequencySubBand());
}
logInfo("\tpublic network: %s", dot->getPublicNetwork() == true ? "on" : "off");
@@ -116,7 +116,7 @@
dot->setWakePin(WAKE);
}
- logInfo("%ssleeping until rising edge on %s pin", deepsleep ? "deep" : "", deepsleep ? "WAKE" : mDot::pinName2Str(dot->getWakePin()).c_str());
+ logInfo("%ssleeping until interrupt on %s pin", deepsleep ? "deep" : "", deepsleep ? "WAKE" : mDot::pinName2Str(dot->getWakePin()).c_str());
#else
if (deepsleep) {
// for mDot, XBEE_DIO7 pin is the only pin that can wake the processor from deepsleep
@@ -127,7 +127,7 @@
dot->setWakePin(XBEE_DIO7);
}
- logInfo("%ssleeping until rising edge on %s pin", deepsleep ? "deep" : "", deepsleep ? "DIO7" : mDot::pinName2Str(dot->getWakePin()).c_str());
+ logInfo("%ssleeping until interrupt on %s pin", deepsleep ? "deep" : "", deepsleep ? "DIO7" : mDot::pinName2Str(dot->getWakePin()).c_str());
#endif
logInfo("application will %s after waking up", deepsleep ? "execute from beginning" : "resume");
@@ -155,7 +155,7 @@
dot->setWakePin(WAKE);
}
- logInfo("%ssleeping %lus or until rising edge on %s pin", deepsleep ? "deep" : "", delay_s, deepsleep ? "WAKE" : mDot::pinName2Str(dot->getWakePin()).c_str());
+ logInfo("%ssleeping %lus or until interrupt on %s pin", deepsleep ? "deep" : "", delay_s, deepsleep ? "WAKE" : mDot::pinName2Str(dot->getWakePin()).c_str());
#else
if (deepsleep) {
// for mDot, XBEE_DIO7 pin is the only pin that can wake the processor from deepsleep
@@ -166,7 +166,7 @@
dot->setWakePin(XBEE_DIO7);
}
- logInfo("%ssleeping %lus or until rising edge on %s pin", deepsleep ? "deep" : "", delay_s, deepsleep ? "DIO7" : mDot::pinName2Str(dot->getWakePin()).c_str());
+ logInfo("%ssleeping %lus or until interrupt on %s pin", deepsleep ? "deep" : "", delay_s, deepsleep ? "DIO7" : mDot::pinName2Str(dot->getWakePin()).c_str());
#endif
logInfo("application will %s after waking up", deepsleep ? "execute from beginning" : "resume");
@@ -181,8 +181,8 @@
ret = dot->send(data);
if (ret != mDot::MDOT_OK) {
- logError("failed to send light data to gateway [%d][%s]", ret, mDot::getReturnCodeString(ret).c_str());
+ logError("failed to send data to gateway [%d][%s]", ret, mDot::getReturnCodeString(ret).c_str());
} else {
- logInfo("successfully sent light data to gateway");
+ logInfo("successfully sent data to gateway");
}
}
--- a/examples/src/ota_example.cpp Thu Oct 06 14:49:35 2016 +0000
+++ b/examples/src/ota_example.cpp Thu Oct 06 16:44:19 2016 +0000
@@ -51,7 +51,7 @@
display_config();
// restore the saved session if the dot woke from deepsleep mode
- // useful to use with deepsleep because RAM session info is otherwise lost when the dot enters deepsleep
+ // useful to use with deepsleep because session info is otherwise lost when the dot enters deepsleep
if (dot->getStandbyFlag()) {
logInfo("restoring network session from NVM");
dot->restoreNetworkSession();
