void MQTTRun(void *parm) { Timer timer; MQTTClient *c = (MQTTClient *)parm; TimerInit(&timer); while (1) { TimerCountdownMS(&timer, CONFIG_MQTT_RECV_CYCLE); /* Don't wait too long if no traffic is incoming */ #if CONFIG_MQTT_RECV_CYCLE == 0 /* The smaller cycle, the greater throughput */ esp_task_wdt_reset(); #endif #if defined(MQTT_TASK) MutexLock(&c->mutex); #endif int rc = cycle(c, &timer); if (rc == FAILURE) { ESP_LOGE(TAG, "MQTTRun cycle failed"); #if defined(MQTT_TASK) MutexUnlock(&c->mutex); #endif vTaskDelete(NULL); } #if defined(MQTT_TASK) MutexUnlock(&c->mutex); #endif } }
void loopTask(void *pvParameters) { setup(); for(;;) { if(loopTaskWDTEnabled){ esp_task_wdt_reset(); } loop(); } }