From d27f4202177a9137491cfc8f98aa559d29103c1b Mon Sep 17 00:00:00 2001 From: SirSydom Date: Thu, 24 Feb 2022 10:13:02 +0100 Subject: [PATCH] =?UTF-8?q?solves=20#178=20bugfix=20when=20sending=20frame?= =?UTF-8?q?s=20>=2063=20byte,=20missing=20masking=20of=20=E2=80=A6=20(#179?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * solves #178 bugfix when sending frames > 63 byte, missing masking of upper bits after sending a U_DataOffset * also masked U_L_DATA_END_REQ correctly * used bit masking instead of % --- src/knx/tpuart_data_link_layer.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/knx/tpuart_data_link_layer.cpp b/src/knx/tpuart_data_link_layer.cpp index ce6d5d7..e163d57 100644 --- a/src/knx/tpuart_data_link_layer.cpp +++ b/src/knx/tpuart_data_link_layer.cpp @@ -579,7 +579,8 @@ DptMedium TpUartDataLinkLayer::mediumType() const bool TpUartDataLinkLayer::sendSingleFrameByte() { uint8_t cmd[2]; - uint8_t idx = _TxByteCnt / 64; + + uint8_t idx = _TxByteCnt >> 6; if (_sendBuffer == NULL) return false; @@ -594,9 +595,9 @@ bool TpUartDataLinkLayer::sendSingleFrameByte() } if (_TxByteCnt != _sendBufferLength - 1) - cmd[0] = U_L_DATA_START_CONT_REQ | _TxByteCnt; + cmd[0] = U_L_DATA_START_CONT_REQ | (_TxByteCnt & 0x3F); else - cmd[0] = U_L_DATA_END_REQ | _TxByteCnt; + cmd[0] = U_L_DATA_END_REQ | (_TxByteCnt & 0x3F); cmd[1] = _sendBuffer[_TxByteCnt]; #ifdef DBG_TRACE