Skip to content

Commit

Permalink
Fix packet byte datatype (#1)
Browse files Browse the repository at this point in the history
On bk7231t, having currentByte as a char causes a problem when receiving packet types >= 8 (in the packet the type is in the high nibble, ie 0x80), when byte shifting >> 4 they get sign extended so we end up with packet type 0xf9 instead of 0x9 for suback.
  • Loading branch information
kayvenm authored Sep 14, 2023
1 parent 9442e15 commit 2354ce2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/AsyncMqttClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ void AsyncMqttClient::_onAck(AsyncClient* client, size_t len, uint32_t time) {
void AsyncMqttClient::_onData(AsyncClient* client, char* data, size_t len) {
(void)client;
size_t currentBytePosition = 0;
char currentByte;
uint8_t currentByte;
do {
switch (_parsingInformation.bufferState) {
case AsyncMqttClientInternals::BufferState::NONE:
Expand Down Expand Up @@ -895,4 +895,4 @@ uint16_t AsyncMqttClient::publish(const char* topic, uint8_t qos, bool retain, c

const char* AsyncMqttClient::getClientId() {
return _clientId;
}
}

0 comments on commit 2354ce2

Please sign in to comment.