mirror of
https://github.com/Genaker/LoraSA.git
synced 2026-08-06 08:53:15 +02:00
Fixup CRC16 to detect missing sequences of zeros
This commit is contained in:
+2
-1
@@ -123,6 +123,7 @@ String _wrap_str(String);
|
||||
#define POLY 0x1021
|
||||
uint16_t crc16(String v, uint16_t c)
|
||||
{
|
||||
c ^= 0xffff;
|
||||
for (int i = 0; i < v.length(); i++)
|
||||
{
|
||||
uint16_t ch = v.charAt(i);
|
||||
@@ -140,7 +141,7 @@ uint16_t crc16(String v, uint16_t c)
|
||||
}
|
||||
}
|
||||
|
||||
return c;
|
||||
return c ^ 0xffff;
|
||||
}
|
||||
|
||||
void ReadlineComms::_onReceive()
|
||||
|
||||
Reference in New Issue
Block a user