Closed
Description
Strange behavior, I tried altering the LoRaDuplexCallback example, integrating it into my TTGO Lora board. Sender is sending as expected, and data is reaching my receiver node, but the Callback is not getting triggered. Code segment looks like this..
setup()
{
...
LoRa.onReceive(onReceive); //register the Callback
LoRa.receive();
Serial.println("LoRa init succeeded.");
...
}
void onReceive(int packetSize) {
...
//IT NEVER prints this line or any other code
Serial.println("Received packet size:"+(String)packetSize );
...
}
If however I place the receive inside the main Loop() as below it works?
{
int rssi = LoRa.packetRssi();
Serial.print("Received packet '");
Serial.println("Packet RCVD "+String(packetSize)+"bytes" );
// read packet
String packet=""; // Clear packet
while (LoRa.available())
packet += (char)LoRa.read(); // Assemble new packet
Serial.println(packet);
}
Do I need to do anything else beside register the OnReceive for it to work?
Hardware: TTGO Lora OLED v.1
Metadata
Metadata
Assignees
Labels
No labels