try second time if first try fails (SendBuffer)
This commit is contained in:
parent
7c8a52cafe
commit
d0389af061
|
|
@ -783,17 +783,37 @@ void startSendingUplink(bool firstTime)
|
||||||
fConfirmed = true;
|
fConfirmed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gCatena.poll();
|
||||||
|
|
||||||
if (firstTime) {
|
if (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);
|
bool success = gLoRaWAN.SendBuffer((uint8_t*)&lora_data_first, sizeof(LORA_data_first), sendBufferDoneCb, NULL, fConfirmed, kUplinkPort);
|
||||||
|
// we try a second time if not successful...
|
||||||
|
if (! success) {
|
||||||
|
if (config_data.debug_level > 0) {
|
||||||
|
gCatena.SafePrintf("SendBuffer was not successful, we try a second time...\n");
|
||||||
|
}
|
||||||
|
gCatena.poll();
|
||||||
|
delay(500);
|
||||||
|
gLoRaWAN.SendBuffer((uint8_t*)&lora_data_first, sizeof(LORA_data_first), sendBufferDoneCb, NULL, fConfirmed, kUplinkPort);
|
||||||
|
}
|
||||||
package_counter++;
|
package_counter++;
|
||||||
} else {
|
} else {
|
||||||
if (config_data.debug_level > 0) {
|
if (config_data.debug_level > 0) {
|
||||||
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);
|
bool success = gLoRaWAN.SendBuffer((uint8_t*)&lora_data, sizeof(LORA_data), sendBufferDoneCb, NULL, fConfirmed, kUplinkPort);
|
||||||
|
// we try a second time if not successful...
|
||||||
|
if (! success) {
|
||||||
|
if (config_data.debug_level > 0) {
|
||||||
|
gCatena.SafePrintf("SendBuffer was not successful, we try a second time...\n");
|
||||||
|
}
|
||||||
|
gCatena.poll();
|
||||||
|
delay(500);
|
||||||
|
gLoRaWAN.SendBuffer((uint8_t*)&lora_data, sizeof(LORA_data), sendBufferDoneCb, NULL, fConfirmed, kUplinkPort);
|
||||||
|
}
|
||||||
package_counter++;
|
package_counter++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue