Skip to content
This repository was archived by the owner on Jan 6, 2023. It is now read-only.

Commit aecf386

Browse files
authored
Fix bugs (#203)
* Fix for when message is empty * Updates IDE version for CI
1 parent ef62e0b commit aecf386

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ addons:
1818
- clang-format-5.0
1919
env:
2020
global:
21-
# - ARDUINO_IDE_VERSION="1.8.10"
21+
- ARDUINO_IDE_VERSION="1.8.13"
2222
- PRETTYNAME="Google Cloud IoT Arduino Library"
2323
# Optional, will default to "$TRAVIS_BUILD_DIR/Doxyfile"
2424
# - DOXYFILE: $TRAVIS_BUILD_DIR/Doxyfile

examples/Esp8266-lwmqtt/esp8266_mqtt.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,17 @@
2929
#include <CloudIoTCoreMqtt.h>
3030
#include "ciotc_config.h" // Wifi configuration here
3131

32+
3233
// !!REPLACEME!!
3334
// The MQTT callback function for commands and configuration updates
3435
// Place your message handler code here.
3536
void messageReceivedAdvanced(MQTTClient *client, char topic[], char bytes[], int length)
3637
{
37-
Serial.printf("incoming: %s - %s\n", topic, length > 0 ? bytes : "[empty]");
38+
if (length > 0){
39+
Serial.printf("incoming: %s - %s\n", topic, bytes);
40+
} else {
41+
Serial.printf("0\n"); // Success but no message
42+
}
3843
}
3944
///////////////////////////////
4045

0 commit comments

Comments
 (0)