rssi test for 915

Dependencies:   libmDot915 mbed-rtos mbed

Fork of rssi_test by wireless sensor

Revision:
11:1ecd1cdca9ef
Parent:
10:79124c0a5952
Child:
12:b31e43c9fb15
--- a/main.cpp	Sat Aug 13 10:27:50 2016 +0000
+++ b/main.cpp	Mon Aug 15 03:02:36 2016 +0000
@@ -150,6 +150,13 @@
             // send the data to the gateway
             if ((ret = dot->send(data)) != mDot::MDOT_OK) {
                logError("failed to send", ret, mDot::getReturnCodeString(ret).c_str());
+               // attempt to join the network
+               logInfo("rejoin network");
+               if ((ret = dot->joinNetworkOnce()) != mDot::MDOT_OK) {
+                  logError("failed to re-join network %d:%s", ret, mDot::getReturnCodeString(ret).c_str());
+                  // in the 868 (EU) frequency band, we need to wait until another channel is available before transmitting again
+                  //osDelay(std::max((uint32_t)2000, (uint32_t)dot->getNextTxMs()));
+               }           
             } else {
             logInfo("successfully sent data to gateway");
             }