main/task_mqtt.c

changeset 16
e38ffa806e84
parent 12
7dc9003f86a8
child 23
58a328e91881
equal deleted inserted replaced
15:83314e7b1b4a 16:e38ffa806e84
89 /* 89 /*
90 * First count, then sent the data. 90 * First count, then sent the data.
91 */ 91 */
92 if (xSemaphoreTake(xSemaphorePcounter, 10) == pdTRUE) { 92 if (xSemaphoreTake(xSemaphorePcounter, 10) == pdTRUE) {
93 count_pub++; 93 count_pub++;
94 printf(" up %d\n", count_pub); 94 //printf(" up %d\n", count_pub);
95 xSemaphoreGive(xSemaphorePcounter); 95 xSemaphoreGive(xSemaphorePcounter);
96 } else { 96 } else {
97 ESP_LOGE(TAG, "Missed lock 1"); 97 ESP_LOGE(TAG, "Missed lock 1");
98 } 98 }
99 99
286 case MQTT_EVENT_PUBLISHED: 286 case MQTT_EVENT_PUBLISHED:
287 ESP_LOGI(TAG, "MQTT_EVENT_PUBLISHED, msg_id=%d", event->msg_id); 287 ESP_LOGI(TAG, "MQTT_EVENT_PUBLISHED, msg_id=%d", event->msg_id);
288 if (xSemaphoreTake(xSemaphorePcounter, 10) == pdTRUE) { 288 if (xSemaphoreTake(xSemaphorePcounter, 10) == pdTRUE) {
289 if (count_pub) { 289 if (count_pub) {
290 count_pub--; 290 count_pub--;
291 printf("down %d\n", count_pub); 291 //printf("down %d\n", count_pub);
292 } 292 }
293 xSemaphoreGive(xSemaphorePcounter); 293 xSemaphoreGive(xSemaphorePcounter);
294 } else { 294 } else {
295 ESP_LOGE(TAG, "Missed lock 2"); 295 ESP_LOGE(TAG, "Missed lock 2");
296 } 296 }

mercurial