Skip to content

Commit 3a56b86

Browse files
authored
Merge pull request #268 from brentru/fix-registration-bug
Fix registration UID bug
2 parents 00a13c9 + a0ce0c0 commit 3a56b86

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

library.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=Adafruit WipperSnapper Beta
2-
version=1.0.0-beta.35
2+
version=1.0.0-beta.36
33
author=Adafruit
44
maintainer=Adafruit <[email protected]>
55
sentence=Arduino client for Adafruit.io WipperSnapper

src/Wippersnapper.cpp

+10-4
Original file line numberDiff line numberDiff line change
@@ -1074,15 +1074,21 @@ bool Wippersnapper::buildWSTopics() {
10741074
}
10751075
snprintf(WS.sUID, sizeof(WS.sUID), "%02d%02d%02d", WS._macAddr[0],
10761076
WS._macAddr[1], WS._macAddr[2]);
1077-
// Set device UID
1077+
1078+
// Set machine_name
10781079
WS._boardId = BOARD_ID;
1080+
// Conversion to match integer UID sent by encodePubRegistrationReq()
1081+
int32_t iUID = atoi(WS.sUID);
1082+
char mac_uid[13];
1083+
itoa(iUID, mac_uid, 10);
1084+
10791085
_device_uid = (char *)malloc(sizeof(char) + strlen("io-wipper-") +
1080-
strlen(WS._boardId) + strlen(WS.sUID));
1086+
strlen(WS._boardId) + strlen(mac_uid) + 1);
10811087
strcpy(_device_uid, "io-wipper-");
10821088
strcat(_device_uid, WS._boardId);
1083-
strcat(_device_uid, WS.sUID);
1089+
strcat(_device_uid, mac_uid);
10841090

1085-
// Initialize MQTT client
1091+
// Initialize MQTT client with UID as the ClientID
10861092
setupMQTTClient(_device_uid);
10871093

10881094
// Global registration topic

src/Wippersnapper.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
#endif
6161

6262
#define WS_VERSION \
63-
"1.0.0-beta.35" ///< WipperSnapper app. version (semver-formatted)
63+
"1.0.0-beta.36" ///< WipperSnapper app. version (semver-formatted)
6464

6565
// Reserved Adafruit IO MQTT topics
6666
#define TOPIC_IO_THROTTLE "/throttle" ///< Adafruit IO Throttle MQTT Topic

0 commit comments

Comments
 (0)