From a0520d3265814b34ccbbdd897f41f5fcee3d633e Mon Sep 17 00:00:00 2001 From: Todd Treece Date: Thu, 1 Oct 2015 12:00:56 -0400 Subject: [PATCH] default to MQTT_PROTOCOL_LEVEL 4 --- Adafruit_MQTT.cpp | 6 +++--- Adafruit_MQTT.h | 6 ++++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Adafruit_MQTT.cpp b/Adafruit_MQTT.cpp index 5558a65..5a9c5f2 100644 --- a/Adafruit_MQTT.cpp +++ b/Adafruit_MQTT.cpp @@ -119,13 +119,13 @@ int8_t Adafruit_MQTT::connect() { // Connect to the server. if (!connectServer()) return -1; - + // Construct and send connect packet. uint8_t len = connectPacket(buffer); if (!sendPacket(buffer, len)) return -1; - // Read connect response packet and verify it + // Read connect response packet and verify it len = readPacket(buffer, 4, CONNECT_TIMEOUT_MS); if (len != 4) return -1; @@ -143,7 +143,7 @@ int8_t Adafruit_MQTT::connect() { uint8_t len = subscribePacket(buffer, subscriptions[i]->topic, subscriptions[i]->qos); if (!sendPacket(buffer, len)) return -1; - + // Get SUBACK len = readPacket(buffer, 5, CONNECT_TIMEOUT_MS); DEBUG_PRINT(F("SUBACK:\t")); diff --git a/Adafruit_MQTT.h b/Adafruit_MQTT.h index e18110e..f093254 100644 --- a/Adafruit_MQTT.h +++ b/Adafruit_MQTT.h @@ -29,7 +29,7 @@ #endif // Uncomment/comment to turn on/off debug output messages. -//#define MQTT_DEBUG +#define MQTT_DEBUG // Set where debug messages will be printed. #define DEBUG_PRINTER Serial @@ -45,7 +45,9 @@ #define DEBUG_PRINTBUFFER(buffer, len) {} #endif -#define MQTT_PROTOCOL_LEVEL 3 +#ifndef MQTT_PROTOCOL_LEVEL + #define MQTT_PROTOCOL_LEVEL 4 +#endif #define MQTT_CTRL_CONNECT 0x01 #define MQTT_CTRL_CONNECTACK 0x02