Skip to content

Commit 2c667d9

Browse files
Fapikoben-willmore
authored andcommitted
Use ternary operator to set retain bit rather than relying on compiler definition of 0/1
1 parent 1e33ece commit 2c667d9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Adafruit_MQTT.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -782,7 +782,7 @@ uint16_t Adafruit_MQTT::publishPacket(uint8_t *packet, const char *topic,
782782
len += bLen; // remaining len excludes header byte & length field
783783

784784
// Now you can start generating the packet!
785-
p[0] = MQTT_CTRL_PUBLISH << 4 | qos << 1;
785+
p[0] = MQTT_CTRL_PUBLISH << 4 | qos << 1 | (retain ? 1 : 0);
786786
p++;
787787

788788
// fill in packet[1] last

0 commit comments

Comments
 (0)