Thanks for the feedback.
Some interesting ideas.
I missed some details out. It's been an evolving project, moving from Arduino Pro mini and HC-12 to an ESP32 and nRF25L01, which can only send 32 bytes max per message. So that was the original target. 32 bytes max, sent once per second.
(Because of range issues, I went back to the HC-12 modules, but tried to keep the rest of the code.
The byte count has increased to ~40 as other data has been added).
But.
Each message is of an identical length and only numeric values sent as byte array. (serial.write)
Decimals and other separators are stripped out
IE. Content:- time, date, lat, long
10:03:15 27-05-2026 55.69688 002.50501
Becomes:
0100315270520265569688002505012
The first byte shown here (0) was included as a possible message identifier, in the event of exceeding the 32 byte limit. It is now used for that purpose, identifying first, second & third message, all sent consecutively each second. (Although there is no actual limit on the number of bytes anymore). The final byte shown here (2) contains bit data to flag the polarity of the lat and long values.
Of course, there was no need for any message end identifier when the nRF24L01 was used. It took care of the transmission & reception.
So, back to the HC-12's....
Two bytes added, byte values 13 and 10 for cr/lf (\r\n) end of data identifiers.
Re-construction of the array at the receiver is straightforward. (serial.read).
I considered using crc at one stage, but decided I would like to keep the received data, if at all possible. The problem with using crc is, if its bad, you just toss the message. Hence opting for sending the data 3 times and trying to recover from those, a minimum of lat and long. So that's where the compare is used, on the lat and long data in each of the three messages. If there is some other duff data in each message, which the crc would flag, the message would normally be dumped.
Soooo...
I guess I could use a combination of including crc, and even if all three are bad, still compare the lat and long data and try to recover if there are two the same.
But this doesn't answer the original question, is using \r\n better than just using either \r or \n ?
Ahhhhh...
Now I remember. Because the crc could be a (byte) 10 or (byte) 13, the receive would fail, as someone pointed out.
Thanks.
I think that's answered my question. I do need both \r\n