shorter suback timeout
This commit is contained in:
parent
bb240928e8
commit
9ed79466b2
@ -31,6 +31,7 @@ static char *dtostrf (double val, signed char width, unsigned char prec, char *s
|
||||
#endif
|
||||
|
||||
void printBuffer(uint8_t *buffer, uint16_t len) {
|
||||
DEBUG_PRINTER.print('\t');
|
||||
for (uint16_t i=0; i<len; i++) {
|
||||
if (isprint(buffer[i]))
|
||||
DEBUG_PRINTER.write(buffer[i]);
|
||||
@ -41,7 +42,9 @@ void printBuffer(uint8_t *buffer, uint16_t len) {
|
||||
DEBUG_PRINTER.print("0");
|
||||
DEBUG_PRINTER.print(buffer[i],HEX);
|
||||
DEBUG_PRINTER.print("], ");
|
||||
if (i % 8 == 7) DEBUG_PRINTER.println();
|
||||
if (i % 8 == 7) {
|
||||
DEBUG_PRINTER.print("\n\t");
|
||||
}
|
||||
}
|
||||
DEBUG_PRINTER.println();
|
||||
}
|
||||
@ -216,7 +219,7 @@ int8_t Adafruit_MQTT::connect() {
|
||||
// TODO: The Server is permitted to start sending PUBLISH packets matching the
|
||||
// Subscription before the Server sends the SUBACK Packet. (will really need to use callbacks - ada)
|
||||
|
||||
len = processPacketsUntil(buffer, MQTT_CTRL_SUBACK, CONNECT_TIMEOUT_MS);
|
||||
len = processPacketsUntil(buffer, MQTT_CTRL_SUBACK, SUBACK_TIMEOUT_MS);
|
||||
if ((len != 5) || (buffer[0] != (MQTT_CTRL_SUBACK << 4))) {
|
||||
continue; // retry!
|
||||
}
|
||||
|
@ -30,7 +30,9 @@
|
||||
#endif
|
||||
|
||||
// Uncomment/comment to turn on/off debug output messages.
|
||||
//#define MQTT_DEBUG
|
||||
#define MQTT_DEBUG
|
||||
// Uncomment/comment to turn on/off error output messages.
|
||||
#define MQTT_ERROR
|
||||
|
||||
// Set where debug messages will be printed.
|
||||
#define DEBUG_PRINTER Serial
|
||||
@ -71,6 +73,7 @@
|
||||
#define CONNECT_TIMEOUT_MS 6000
|
||||
#define PUBLISH_TIMEOUT_MS 500
|
||||
#define PING_TIMEOUT_MS 500
|
||||
#define SUBACK_TIMEOUT_MS 500
|
||||
|
||||
// Adjust as necessary, in seconds. Default to 5 minutes.
|
||||
#define MQTT_CONN_KEEPALIVE 300
|
||||
|
@ -82,7 +82,7 @@ bool Adafruit_MQTT_Client::sendPacket(uint8_t *buffer, uint16_t len) {
|
||||
// send 250 bytes at most at a time, can adjust this later based on Client
|
||||
|
||||
uint16_t sendlen = min(len, 250);
|
||||
Serial.print("Sending: "); Serial.println(sendlen);
|
||||
//Serial.print("Sending: "); Serial.println(sendlen);
|
||||
ret = client->write(buffer, sendlen);
|
||||
DEBUG_PRINT(F("Client sendPacket returned: ")); DEBUG_PRINTLN(ret);
|
||||
len -= ret;
|
||||
|
Loading…
Reference in New Issue
Block a user