LoRa.parsePacket() -- is there a buffer?

I am sending a packet containing 7 bytes. The receiving unit does a LoRa.read() 6 times after each successful execution of LoRa.parsePacket(). What happens to the unread byte #7? Over the past hour I've sent about 400 of these "long" packets and the receiver doesn't show any sign of overflow or other errors. All the packets (first 6 bytes) are displaying corrrectly.

	packetSize = LoRa.parsePacket();
	if (packetSize) {
		sync_byte = LoRa.read(); // user sync byte sent as data
		if(sync_byte == 0x69) {  
			counter = LoRa.read();
			t1L = LoRa.read();
			t1H = LoRa.read();
			t2L = LoRa.read();
			t2H = LoRa.read();
          }

Does the next received packet clean out the "buffer" or does parsePacket() do that? Or what? I'm thinking of packets as similar to serial communications, where you need to pay attention to either reading or dropping all the bytes in a message.

Parse packet loads all the bytes in the buffer and then you read them

The next call to parse packet clears things up

1 Like

Thanks, that's all I could imagine. So this elicits another question. What happens if you transmit more often than you call parsePacket()? Does the next received packet also "clear" things?

I’m not 100% sure but I don’t think there is a message queue so the new packet overwrites the previously unread one

1 Like

Solved

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.