fix: 字符串对比问题。
This commit is contained in:
parent
35d0ffe0c1
commit
596144d2c7
13
main/mqtt.c
13
main/mqtt.c
@ -72,15 +72,16 @@ static void mqtt_event_handler(void *handler_args, esp_event_base_t base,
|
|||||||
break;
|
break;
|
||||||
case MQTT_EVENT_DATA:
|
case MQTT_EVENT_DATA:
|
||||||
ESP_LOGI(MQTT_TAG, "MQTT_EVENT_DATA");
|
ESP_LOGI(MQTT_TAG, "MQTT_EVENT_DATA");
|
||||||
if (strcmp(event->topic, MQTT_KEY_BOARD_ONLINE)) {
|
if (strncmp(event->topic, MQTT_KEY_DESKTOP_ONLINE, event->topic_len) ==
|
||||||
|
0) {
|
||||||
xEventGroupSetBits(s_mqtt_event_group, MQTT_DESKTOP_ONLINE_BIT);
|
xEventGroupSetBits(s_mqtt_event_group, MQTT_DESKTOP_ONLINE_BIT);
|
||||||
ESP_LOGE(MQTT_TAG, "AAA MQTT_DESKTOP_ONLINE_BIT");
|
} else if (strncmp(event->topic, MQTT_KEY_DESKTOP_COLORS,
|
||||||
} else if (strcmp(event->topic, MQTT_KEY_DESKTOP_COLORS)) {
|
event->topic_len) == 0) {
|
||||||
ESP_LOGE(MQTT_TAG, "AAA MQTT_DESKTOP_SENDING_BIT");
|
|
||||||
xEventGroupSetBits(s_mqtt_event_group, MQTT_DESKTOP_SENDING_BIT);
|
xEventGroupSetBits(s_mqtt_event_group, MQTT_DESKTOP_SENDING_BIT);
|
||||||
|
} else {
|
||||||
|
printf("TOPIC=%.*s\r\n", event->topic_len, event->topic);
|
||||||
|
printf("DATA=%.*s\r\n", event->data_len, event->data);
|
||||||
}
|
}
|
||||||
printf("TOPIC=%.*s\r\n", event->topic_len, event->topic);
|
|
||||||
printf("DATA=%.*s\r\n", event->data_len, event->data);
|
|
||||||
break;
|
break;
|
||||||
case MQTT_EVENT_ERROR:
|
case MQTT_EVENT_ERROR:
|
||||||
ESP_LOGI(MQTT_TAG, "MQTT_EVENT_ERROR");
|
ESP_LOGI(MQTT_TAG, "MQTT_EVENT_ERROR");
|
||||||
|
Loading…
Reference in New Issue
Block a user