fix: 字符串对比问题。
This commit is contained in:
parent
35d0ffe0c1
commit
596144d2c7
11
main/mqtt.c
11
main/mqtt.c
@ -72,15 +72,16 @@ static void mqtt_event_handler(void *handler_args, esp_event_base_t base,
|
||||
break;
|
||||
case 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);
|
||||
ESP_LOGE(MQTT_TAG, "AAA MQTT_DESKTOP_ONLINE_BIT");
|
||||
} else if (strcmp(event->topic, MQTT_KEY_DESKTOP_COLORS)) {
|
||||
ESP_LOGE(MQTT_TAG, "AAA MQTT_DESKTOP_SENDING_BIT");
|
||||
} else if (strncmp(event->topic, MQTT_KEY_DESKTOP_COLORS,
|
||||
event->topic_len) == 0) {
|
||||
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);
|
||||
}
|
||||
break;
|
||||
case MQTT_EVENT_ERROR:
|
||||
ESP_LOGI(MQTT_TAG, "MQTT_EVENT_ERROR");
|
||||
|
Loading…
Reference in New Issue
Block a user