From 91dae1be7ee2fc68e55daeecc493b351850b1f6f Mon Sep 17 00:00:00 2001 From: Teo-CD Date: Sat, 16 Dec 2023 11:45:04 +0000 Subject: [PATCH] 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. --- Assets/Scripts/Arduino_Com.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Assets/Scripts/Arduino_Com.cs b/Assets/Scripts/Arduino_Com.cs index 16c941d..b931200 100644 --- a/Assets/Scripts/Arduino_Com.cs +++ b/Assets/Scripts/Arduino_Com.cs @@ -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.