Senet fork
Dependencies: libxDot-mbed5 ISL29011
Fork of Dot-Examples by
Diff: examples/src/auto_ota_example.cpp
- Revision:
- 18:30f96328cfea
- Parent:
- 17:50b6694ba62f
- Child:
- 20:4209abb938c0
--- a/examples/src/auto_ota_example.cpp Mon Oct 31 18:23:19 2016 +0000 +++ b/examples/src/auto_ota_example.cpp Tue Nov 01 09:40:48 2016 -0400 @@ -24,6 +24,8 @@ // if deep_sleep == true, device will enter deepsleep mode static bool deep_sleep = true; +#define SLEEP_SECONDS 300 + mDot* dot = NULL; Serial pc(USBTX, USBRX); @@ -35,23 +37,6 @@ AnalogIn lux(XBEE_AD0); #endif -//#define TEST -#ifdef TEST -int main() { - - pc.baud(115200); - mts::MTSLog::setLogLevel(mts::MTSLog::TRACE_LEVEL); - - while(true) - { - pc.printf("pc.printf(Hello World!)\r\n"); - logInfo("logInfo(HelloWorld!)\r\n"); - wait(5); - } - return 0; -} - -#else int main() { // Custom event handler for automatically displaying RX data @@ -97,7 +82,7 @@ // check the link every count packets // declare the Dot disconnected after threshold failed link checks // for count = 3 and threshold = 5, the Dot will be considered disconnected after 15 missed packets in a row - //update_network_link_check_config(3, 5); + update_network_link_check_config(3, 5); // save changes to configuration logInfo("saving configuration"); @@ -113,10 +98,8 @@ uint16_t light; std::vector<uint8_t> tx_data; - // join network if not joined - if (!dot->getNetworkJoinStatus()) { - join_network(); - } + // join network if not joined if (!dot->getNetworkJoinStatus()) { + join_network(); #if defined(TARGET_XDOT_L151CC) // configure the ISL29011 sensor on the xDot-DK for continuous ambient light sampling, 16 bit conversion, and maximum range @@ -145,10 +128,9 @@ // ONLY ONE of the three functions below should be uncommented depending on the desired wakeup method //sleep_wake_rtc_only(deep_sleep); //sleep_wake_interrupt_only(deep_sleep); - sleep_wake_rtc_or_interrupt(deep_sleep); + sleep_wake_rtc_or_interrupt(deep_sleep, SLEEP_SECONDS); } return 0; } #endif -#endif