From 3acad86d346a2a99893e03a0d69e4974b8344d5a Mon Sep 17 00:00:00 2001 From: Gustav Wiberg <52791556+Guswib@users.noreply.github.com> Date: Sat, 2 Nov 2024 11:21:21 +0100 Subject: [PATCH 1/3] Update SensirionShdlcTxFrame.cpp --- src/SensirionShdlcTxFrame.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/SensirionShdlcTxFrame.cpp b/src/SensirionShdlcTxFrame.cpp index fc8c4c9..dba0c68 100644 --- a/src/SensirionShdlcTxFrame.cpp +++ b/src/SensirionShdlcTxFrame.cpp @@ -38,7 +38,8 @@ uint16_t SensirionShdlcTxFrame::begin(uint8_t command, uint8_t address, uint8_t dataLength) { - _buffer[_index++] = 0x7e; + _index=0; + _buffer[_index] = 0x7e; uint16_t error = addUInt8(address); error |= addUInt8(command); error |= addUInt8(dataLength); From 451d4eb3b7b1727c5d95329166654bcc2340d396 Mon Sep 17 00:00:00 2001 From: Gustav Wiberg <52791556+Guswib@users.noreply.github.com> Date: Sat, 2 Nov 2024 11:23:01 +0100 Subject: [PATCH 2/3] Update SensirionShdlcTxFrame.cpp the begin function sets the index to 0. --- src/SensirionShdlcTxFrame.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SensirionShdlcTxFrame.cpp b/src/SensirionShdlcTxFrame.cpp index dba0c68..c75e8db 100644 --- a/src/SensirionShdlcTxFrame.cpp +++ b/src/SensirionShdlcTxFrame.cpp @@ -38,7 +38,7 @@ uint16_t SensirionShdlcTxFrame::begin(uint8_t command, uint8_t address, uint8_t dataLength) { - _index=0; + _index=0; //sets the index to point towards the start of the buffer. _buffer[_index] = 0x7e; uint16_t error = addUInt8(address); error |= addUInt8(command); From b74158446b23e3ec05770c5b040fe03e92dfd84a Mon Sep 17 00:00:00 2001 From: Gustav Wiberg <52791556+Guswib@users.noreply.github.com> Date: Sat, 2 Nov 2024 12:07:16 +0100 Subject: [PATCH 3/3] SensirionShdlcCommunication::receiveFrame Fixes issues when an error frame is read, and the datalength-values is not 0. --- CHANGELOG.rst | 2 ++ src/SensirionShdlcCommunication.cpp | 19 +++++++++++-------- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 3796359..fba55c6 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -8,6 +8,8 @@ and this project adheres to `Semantic Versioning