Update default keepalive to 5 minutes, add reset on ping fail to CC3k sketch.

This commit is contained in:
Tony DiCola 2015-06-12 12:59:14 -07:00
parent a33dac3249
commit 08f05456ec
2 changed files with 6 additions and 4 deletions

View File

@ -62,8 +62,8 @@
#define PUBLISH_TIMEOUT_MS 500 #define PUBLISH_TIMEOUT_MS 500
#define PING_TIMEOUT_MS 500 #define PING_TIMEOUT_MS 500
// Adjust as necessary, in seconds // Adjust as necessary, in seconds. Default to 5 minutes.
#define MQTT_CONN_KEEPALIVE 15 #define MQTT_CONN_KEEPALIVE 300
// Largest full packet we're able to send. // Largest full packet we're able to send.
// Need to be able to store at least ~90 chars for a connect packet with full // Need to be able to store at least ~90 chars for a connect packet with full

View File

@ -129,8 +129,10 @@ void loop() {
// Try to ping the MQTT server // Try to ping the MQTT server
/* /*
if (! mqtt.ping(3) ) { if (! mqtt.ping(3) ) {
// MQTT pings failed, lets reconnect // MQTT pings failed, let's reconnect by forcing a watchdog reset.
Serial.println("Ping fail!"); Serial.println("Ping fail! Resetting...");
Watchdog.enable(8000);
delay(10000);
} }
*/ */