Da ka xi tong.
Dependencies: libmDot mbed-rtos mbed
Fork of mDot_Connect_IoTClub_one_wire_4ch_8_24 by
Diff: main.cpp
- 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"); }