Hello,
I am trying to send data a couple of times to The Things Stack.
It seems that the data is only sending on the first request and I believe that I may have the incorrect idea of how data should be sent.
I should also mention I am on region AS923 Japan. I just saw: AS923 on TTNv3 keeps exchanging LinkADRReq - LinkADRAns NACK and doesn't use one channel · Issue #686 · mcci-catena/arduino-lmic · GitHub and wonder if this has anything to do with my data not being recieved. I am not sure because I am able to make a connection.
Here is my code:
// Send ALL THE DATA!!!!
Serial.println(data_to_send.size());
LoRaWANSetup();
do
{
LoRaWAN_DataType& temp = *data_to_send.back(); // Reference Last item in vector
Serial.print("About to send: ");
Serial.println(temp.getPrefix());
LoRaWANSetData(temp.getDataToSend(), sizeof(temp.getDataToSend()) + 1, temp.getDataPort());
do
{
LoRaWANLoop();
} while (!LoRaWAN_SendComplete);
data_to_send.pop_back(); // Remove Last item in vector
} while (data_to_send.size());
I know this is a lot specific to my stuff, but basically this loops through a vector and sends the data (temp.getDataToSend() in byte format). When the data is sent, it sets LoRaWAN_SendComplete to TRUE.
that happens here:
case EV_TXCOMPLETE:
Serial.println(F("EV_TXCOMPLETE (includes waiting for RX windows)"));
if (LMIC.txrxFlags & TXRX_ACK)
Serial.println(F("Received ack"));
if (LMIC.dataLen)
{
Serial.print(F("Received "));
Serial.print(LMIC.dataLen);
Serial.println(F(" bytes of payload"));
}
// Schedule next transmission
os_setTimedCallback(&sendjob, os_getTime() + sec2osticks(TX_INTERVAL), do_send);
LoRaWAN_SendComplete = true;
break;
Then we POP the last element out of the vector and if there are remaining elements, we do it all over gain.
My question is if I am doing this correctly? Or Am I totally off base with how I am going about this?
This results in me seeing:
EV_TXSTART
EV_TXCOMPLETE (includes waiting for RX windows)
EV_TXSTART
EV_TXCOMPLETE (includes waiting for RX windows)
EV_TXSTART
EV_TXCOMPLETE (includes waiting for RX windows)
EV_TXSTART
EV_TXCOMPLETE (includes waiting for RX windows)
EV_TXSTART
EV_TXCOMPLETE (includes waiting for RX windows)
EV_TXSTART
EV_TXCOMPLETE (includes waiting for RX windows)
EV_TXSTART
EV_TXCOMPLETE (includes waiting for RX windows)
EV_TXSTART
EV_TXCOMPLETE (includes waiting for RX windows)
and never getting any data
Thank you very much for any assistance!
-Kevin Cantrell