Chat freely about anything...

User avatar
By sunbelt57
#91704 I'm running the sample app that comes with the SDK (protocols/mqtt/tcp) and in the callback:

Code: Select allstatic esp_err_t mqtt_event_handler_cb(esp_mqtt_event_handle_t event)
{
    esp_mqtt_client_handle_t client = event->client;
    int msg_id;
    // your_context_t *context = event->context;
    switch (event->event_id) {
        ...
        case MQTT_EVENT_DATA:
            //ESP_LOGI(TAG, "MQTT_EVENT_DATA");
            printf("TOPIC=%.*s\r\n", event->topic_len, event->topic);
            printf("DATA=%.*s\r\n", event->data_len, event->data);
            break;


where I print out the data I get some extra info about the MAC address not being set:

Code: Select allDATA=thread 1: 935717689 ...@Base MAC address is not set, read default base MAC address from EFUSE
TOPIC=debug/test2
DATA=thread 2: 528558686 ...@Base MAC address is not set, read default base MAC address from EFUSE
TOPIC=debug/test1
DATA=thread 1: 1227457282 ...@Base MAC address is not set, read default base MAC address from EFUSE
TOPIC=debug/test2
DATA=thread 2: 3574935 ......@Base MAC address is not set, read default base MAC address from EFUSE
TOPIC=debug/test1


Is that something I should be concerted about? It seems to work ok. If not, how can I get run of it other than copying it to a new string and truncating the extra info?
User avatar
By quackmore
#91712 hey man, how's going?

I noticed that message too, it is popping out with every app using wifi (which makes sense cause wifi uses MAC addresses)

I found some details here https://docs.espressif.com/projects/esp-idf/en/release-v3.0/api-reference/system/base_mac_address.html
(keep in mind that's for the generic IDF, so it refers to ESP32 too)

I'm currently ignoring the message and, so far, I think that's safe

I also fear the only way to avoid it is to read the default MAC address with esp_efuse_mac_get_default and set the base MAC address with esp_base_mac_addr_probably before the wifi init

I didn't have time to try that
so if you are going too, please post the results
that will be useful

have a nice Sunday
User avatar
By sunbelt57
#91715 What I had to do was this:

Code: Select allchar temp_str[100];
...
memset(temp_str,0,100);
strncpy(temp_str,(const char *)(event->data),event->data_len);
printf("%s \r\n", temp_str);

memset(temp_str,0,100);
strncpy(temp_str,(const char *)(event->topic),event->topic_len);
printf("%s \r\n", temp_str);

if(strcmp(temp_str,"debug/test1") == 0)
{
   printf("test1\r\n");
}
if(strcmp(temp_str,"debug/test2") == 0)
{
   printf("test2\r\n");
}
if(strcmp(temp_str,"debug/test3") == 0)
{
   printf("test3\r\n");
}


This'll work for now, I guess.
Have a great day!