solves #178 bugfix when sending frames > 63 byte, missing masking of … (#179)

* 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 %
This commit is contained in:
SirSydom 2022-02-24 10:13:02 +01:00 committed by GitHub
parent a306174878
commit d27f420217
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -579,7 +579,8 @@ DptMedium TpUartDataLinkLayer::mediumType() const
bool TpUartDataLinkLayer::sendSingleFrameByte() bool TpUartDataLinkLayer::sendSingleFrameByte()
{ {
uint8_t cmd[2]; uint8_t cmd[2];
uint8_t idx = _TxByteCnt / 64;
uint8_t idx = _TxByteCnt >> 6;
if (_sendBuffer == NULL) if (_sendBuffer == NULL)
return false; return false;
@ -594,9 +595,9 @@ bool TpUartDataLinkLayer::sendSingleFrameByte()
} }
if (_TxByteCnt != _sendBufferLength - 1) if (_TxByteCnt != _sendBufferLength - 1)
cmd[0] = U_L_DATA_START_CONT_REQ | _TxByteCnt; cmd[0] = U_L_DATA_START_CONT_REQ | (_TxByteCnt & 0x3F);
else else
cmd[0] = U_L_DATA_END_REQ | _TxByteCnt; cmd[0] = U_L_DATA_END_REQ | (_TxByteCnt & 0x3F);
cmd[1] = _sendBuffer[_TxByteCnt]; cmd[1] = _sendBuffer[_TxByteCnt];
#ifdef DBG_TRACE #ifdef DBG_TRACE