#include "freertos/FreeRTOS.h" #include "freertos/task.h" #include "esp_log.h" #include "config.h" #include "wifi.h" #include "mqtt.h" #include "readTemps.h" #include "rxTimer.h" #include "receiver.h" // Chip info: // This is esp32 chip with 2 CPU cores, WiFi/BT/BLE, silicon revision 1, 4MB external flash void app_main(void) { ESP_LOGI("MAIN", "IRTransceiver ESP32. Core:%d",xPortGetCoreID()); // Wait for stable environment vTaskDelay(1000.0 / portTICK_PERIOD_MS); rxTimerInit(); // First we start the Timer (which samples Rx and handles uS-delays) #ifdef ENABLE_DS18B20 initTempReadings(); #endif #ifdef WIFI_ENABLED initWifi(); // Init WIFI #endif #ifdef MQTT_ENABLED mqtt_init(); #endif initReceiver(); // Init receiver-task TickType_t vLastWakeTime = xTaskGetTickCount(); // Do an initial delay to make the different tasks to work out of sync to each other (not send all data at same time) vTaskDelayUntil( &vLastWakeTime, 30000 / portTICK_PERIOD_MS ); // ---------------- MAIN WHILE ------------------- while(1) { vTaskDelayUntil( &vLastWakeTime, 60000 / portTICK_PERIOD_MS ); } vTaskDelete(NULL); }