20200602
This commit is contained in:
parent
f8909fc353
commit
59ce7ee44d
|
|
@ -704,6 +704,14 @@ void StartNewIteration() {
|
||||||
gCatena.SafePrintf("looks like we timed out waiting for sending to finish...\n", wait_time);
|
gCatena.SafePrintf("looks like we timed out waiting for sending to finish...\n", wait_time);
|
||||||
}
|
}
|
||||||
LMIC_clrTxData();
|
LMIC_clrTxData();
|
||||||
|
// we sleep 10 seconds...
|
||||||
|
start_time = millis();
|
||||||
|
while (send_in_progress && ((millis() - start_time) < 10000))
|
||||||
|
{
|
||||||
|
gCatena.poll();
|
||||||
|
yield();
|
||||||
|
}
|
||||||
|
|
||||||
send_in_progress = false;
|
send_in_progress = false;
|
||||||
}
|
}
|
||||||
wait_time = (uint32_t)((millis() - start_time) / 1000);
|
wait_time = (uint32_t)((millis() - start_time) / 1000);
|
||||||
|
|
@ -765,6 +773,7 @@ void StartNewIteration() {
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
if (! stop_iterations) {
|
||||||
if (config_data.debug_level > 0) {
|
if (config_data.debug_level > 0) {
|
||||||
gCatena.SafePrintf("light sleep; os_setTimedCallback for startNewIterationCb in %d...seconds\n", sleep_time_sec);
|
gCatena.SafePrintf("light sleep; os_setTimedCallback for startNewIterationCb in %d...seconds\n", sleep_time_sec);
|
||||||
}
|
}
|
||||||
|
|
@ -774,6 +783,7 @@ void StartNewIteration() {
|
||||||
startNewIterationCb);
|
startNewIterationCb);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void startSendingUplink(bool firstTime)
|
void startSendingUplink(bool firstTime)
|
||||||
{
|
{
|
||||||
|
|
@ -803,15 +813,27 @@ void startSendingUplink(bool firstTime)
|
||||||
if (config_data.debug_level > 0) {
|
if (config_data.debug_level > 0) {
|
||||||
gCatena.SafePrintf("SendBuffer firstTime\n");
|
gCatena.SafePrintf("SendBuffer firstTime\n");
|
||||||
}
|
}
|
||||||
gLoRaWAN.SendBuffer((uint8_t*)&lora_data_first, sizeof(LORA_data_first), sendBufferDoneCb, NULL, fConfirmed, kUplinkPort);
|
if (gLoRaWAN.SendBuffer((uint8_t*)&lora_data_first, sizeof(LORA_data_first), sendBufferDoneCb, NULL, fConfirmed, kUplinkPort)) {
|
||||||
package_counter++;
|
package_counter++;
|
||||||
|
if (config_data.debug_level > 0) {
|
||||||
|
gCatena.SafePrintf("LMIC.opmode just after SendBuffer (successful): %#x\n", LMIC.opmode);
|
||||||
|
} else {
|
||||||
|
gCatena.SafePrintf("LMIC.opmode just before SendBuffer (failed): %#x\n", LMIC.opmode);
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if (config_data.debug_level > 0) {
|
if (config_data.debug_level > 0) {
|
||||||
gCatena.SafePrintf("LMIC.opmode just before SendBuffer: %#x\n", LMIC.opmode);
|
gCatena.SafePrintf("LMIC.opmode just before SendBuffer: %#x\n", LMIC.opmode);
|
||||||
gCatena.SafePrintf("SendBuffer not firstTime\n");
|
gCatena.SafePrintf("SendBuffer not firstTime\n");
|
||||||
}
|
}
|
||||||
gLoRaWAN.SendBuffer((uint8_t*)&lora_data, sizeof(LORA_data), sendBufferDoneCb, NULL, fConfirmed, kUplinkPort);
|
if (gLoRaWAN.SendBuffer((uint8_t*)&lora_data, sizeof(LORA_data), sendBufferDoneCb, NULL, fConfirmed, kUplinkPort)) {
|
||||||
package_counter++;
|
package_counter++;
|
||||||
|
if (config_data.debug_level > 0) {
|
||||||
|
gCatena.SafePrintf("LMIC.opmode just after SendBuffer (successful): %#x\n", LMIC.opmode);
|
||||||
|
} else {
|
||||||
|
gCatena.SafePrintf("LMIC.opmode just before SendBuffer (failed): %#x\n", LMIC.opmode);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ClearLoraData();
|
ClearLoraData();
|
||||||
|
|
@ -890,15 +912,6 @@ void doSleepAlert(const bool fDeepSleep)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// we wait an extra five seconds...
|
|
||||||
//uint32_t tNow = millis();
|
|
||||||
//while (uint32_t(millis() - tNow) < 5000)
|
|
||||||
//{
|
|
||||||
// gCatena.poll();
|
|
||||||
// yield();
|
|
||||||
//}
|
|
||||||
|
|
||||||
|
|
||||||
if (config_data.debug_level > 0) {
|
if (config_data.debug_level > 0) {
|
||||||
gCatena.SafePrintf("Now it is safe to go to sleep\n");
|
gCatena.SafePrintf("Now it is safe to go to sleep\n");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,7 @@ enum {
|
||||||
|
|
|
|
||||||
\****************************************************************************/
|
\****************************************************************************/
|
||||||
|
|
||||||
static const int32_t fwVersion = 20200601;
|
static const int32_t fwVersion = 20200602;
|
||||||
|
|
||||||
static const byte INIT_PACKAGE_INTERVAL = 100; // send an init package every 100 packages;
|
static const byte INIT_PACKAGE_INTERVAL = 100; // send an init package every 100 packages;
|
||||||
static const byte MAX_VALUES_TO_SEND = 8;
|
static const byte MAX_VALUES_TO_SEND = 8;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue