Skip to content

Commit 6091e52

Browse files
committed
Merge branch 'master' into feature/connection-info
# Conflicts: # library.properties
2 parents b03cb4e + 5d7d0f4 commit 6091e52

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/CayenneArduinoMQTTClient.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ class CayenneArduinoMQTTClient
288288
* @param channel Cayenne channel number
289289
* @param value Value to be sent
290290
*/
291-
void digitalSensorWrite(unsigned int channel, float value)
291+
void digitalSensorWrite(unsigned int channel, int value)
292292
{
293293
virtualWrite(channel, value, F(TYPE_DIGITAL_SENSOR), F(UNIT_DIGITAL));
294294
}

src/CayenneMQTTClient/MQTTClient.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,11 @@ int keepalive(MQTTClient* c)
228228
TimerCountdown(&c->ping_response_timer, c->keepAliveInterval);
229229
c->ping_outstanding = 1;
230230
}
231+
else if (rc == MQTT_FAILURE && TimerIsExpired(&c->last_received_timer))
232+
{
233+
//If the ping packet failed and the last received timer has expired assume we are disconnected
234+
c->isconnected = 0;
235+
}
231236
}
232237
else if (TimerIsExpired(&c->ping_response_timer))
233238
{

0 commit comments

Comments
 (0)