1
0
mirror of https://github.com/adafruit/Adafruit_MQTT_Library.git synced 2025-09-08 03:27:30 +03:00

Use ternary operator to set retain bit rather than relying on compiler definition of 0/1

This commit is contained in:
Lucas Jandrew
2020-02-26 13:06:21 -05:00
committed by Ben Willmore
parent 1e33ece844
commit 2c667d9a30

View File

@@ -782,7 +782,7 @@ uint16_t Adafruit_MQTT::publishPacket(uint8_t *packet, const char *topic,
len += bLen; // remaining len excludes header byte & length field
// Now you can start generating the packet!
p[0] = MQTT_CTRL_PUBLISH << 4 | qos << 1;
p[0] = MQTT_CTRL_PUBLISH << 4 | qos << 1 | (retain ? 1 : 0);
p++;
// fill in packet[1] last