Skip to content

Commit 5e3abd4

Browse files
fix: Cover the case for SOC without MAC address
We need to cover for the case where the available MAC isn't defined in soc caps. E.g. A new target is being introduced but the support isn't complete yet.
1 parent 37cb056 commit 5e3abd4

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

lib/platform_esp32_idf.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,13 @@ char *platform_create_id_string(void)
2525
uint8_t mac[6];
2626
char *id_string = calloc(1, MAX_ID_STRING);
2727
ESP_MEM_CHECK(TAG, id_string, return NULL);
28+
#ifndef MAC_TYPE
29+
ESP_LOGW(TAG, "Soc doesn't provide MAC, client could be disconnected in case of device with same name in the broker.");
30+
sprintf(id_string, "esp_mqtt_client_id");
31+
#else
2832
esp_read_mac(mac, MAC_TYPE);
2933
sprintf(id_string, "ESP32_%02x%02X%02X", mac[3], mac[4], mac[5]);
34+
#endif
3035
return id_string;
3136
}
3237

0 commit comments

Comments
 (0)