Here it is ...
Dependencies: libxDot-mbed5 TSL2561
Fork of Dot-Examples by
Diff: examples/src/ota_example.cpp
- Revision:
- 37:4818522075f8
- Parent:
- 36:5529d26e97e6
- Child:
- 38:401bd606d2dd
--- a/examples/src/ota_example.cpp Wed Jul 25 10:39:56 2018 -0400 +++ b/examples/src/ota_example.cpp Wed Jul 25 14:23:40 2018 -0400 @@ -37,7 +37,7 @@ // in sleep mode, IO state is maintained, RAM is retained, and application will resume after waking up // in deepsleep mode, IOs float, RAM is lost, and application will start from beginning after waking up // if deep_sleep == true, device will enter deepsleep mode -static bool deep_sleep = false; +static bool deep_sleep = true; mDot* dot = NULL; lora::ChannelPlan* plan = NULL; @@ -155,12 +155,11 @@ uint8_t light_data = get_light_data(); //pc.printf("pseudo-light data: %d\r\n", light_data); - pc.printf("hour: %d\r\n", ++counter); + pc.printf("\r\nhour: %d\r\n", ++counter); // clean out char buffer strcpy(buffer, "XXXX"); - // pc.printf("char buffer X: %s\r\n", buffer); // convert to ascii char && push to vector ascii_converter(buffer, light_data, &tx_data, &pc); @@ -169,12 +168,6 @@ if( counter < 12) tx_data.push_back(' '); - // set the data_rate (from forum) - //dot->setTxDataRate(lora::DR_2); - - //send_data(tx_data, &pc); - //pc.printf("size: %d\r\n", tx_data.size()); - //pc.printf("capacity: %d\r\n", tx_data.capacity()); // if going into deepsleep mode, save the session so we don't need to join again after waking up // not necessary if going into sleep mode since RAM is retained @@ -184,7 +177,7 @@ } // ONLY ONE of the three functions below should be uncommented depending on the desired wakeup method - //sleep_wake_rtc_only(deep_sleep); + sleep_wake_rtc_only(deep_sleep, 30, &pc); //sleep_wake_interrupt_only(deep_sleep); //sleep_wake_rtc_or_interrupt(deep_sleep); } @@ -198,15 +191,15 @@ pc.printf("\r\n"); pc.printf("capacity tx_data: %d\r\n", tx_data.capacity()); - //tx_data.resize(tx_data.size()); - //tx_data.resize(); + //tx_data.reserve(tx_data.size()); + //pc.printf("cap resized: %d\r\n", tx_data.capacity()); pc.printf("sized tx_data: %d\r\n", tx_data.size()); //actually send the data pc.printf("sending data\r\n"); // set the data_rate (from forum) - dot->setTxDataRate(lora::DR_2); + dot->setTxDataRate(lora::DR_1); int retVal = send_data(tx_data, &pc); //while(retVal == 1) //retVal = send_data(tx_data, &pc);