1
0
Fork 0

Unity: Fix hardcoded page size in ReceiveSerialData()

Remove the hardocded '128' that checked for a full page being received
and replace it with the appropriate constant.
This commit is contained in:
Teo-CD 2023-12-16 11:45:04 +00:00
parent a18c37daa1
commit 91dae1be7e

View file

@ -88,7 +88,7 @@ public class Arduino_Com : MonoBehaviour
_readBytes += _serial.Read(_pageBuffer, _readBytes, PageSize - _readBytes);
// Full page received, check checksum and ACK/NAK, write received page.
if (_readBytes >= 128)
if (_readBytes >= PageSize)
{
Byte[] checksum = new byte[2];
// There might be less than the two characters of the checksum available, loop until complete.