Echo example of class C devices receiving downlink and sending as next uplink
Dependencies: libmDot-mbed5 ISL29011
Diff: examples/src/auto_ota_example.cpp
- Revision:
- 2:ffac7b141b72
- Parent:
- 1:c4915e00d2ce
- Child:
- 3:0e3e776e2862
diff -r c4915e00d2ce -r ffac7b141b72 examples/src/auto_ota_example.cpp --- 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) {