arduino-LoRa: Delay in loop() stops receive
Hi,
I experience a strange issue with the library: if I put a delay in the loop(), the LoRa module fails to receive almost all packets. I use the delay to simulate some long blocking operations. I send 30 bytes packets every 2 seconds.
From the example LoRaReceiver, just added the delay and I get maybe 1 packet out of 10. Without the delay, I receive every packet. Why is that?
void loop() {
delay(100);
// try to parse packet
int packetSize = LoRa.parsePacket();
if (packetSize) {
// received a packet
Serial.print("Received packet '");
// read packet
while (LoRa.available()) {
Serial.print((char)LoRa.read());
}
// print RSSI of packet
Serial.print("' with RSSI ");
Serial.println(LoRa.packetRssi());
}
}
Hardware: LoRa32u4 II board (https://bsfrance.fr/lora-long-range/1345-LoRa32u4-II-Lora-LiPo-Atmega32u4-SX1276-HPD13-868MHZ-EU-Antenna.html)
Thanks, Best regards, Benjamin
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 19 (2 by maintainers)
Just an update, the ISR routine flag messes up with the OLED.display() from SSD1306Wire.h as it is really picky and dos not like to be interrupted or it messes up with the display data, Being so I falled back into a mixed approach of using parsePacket() and when it results in greater than ZERO I read the buffer data and put it back on MODE_RX_CONTINUOUS calling receive();