#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" #include "ir_transmit.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); #ifdef RX_TIMER rxTimerInit(); // First we start the Timer (which samples Rx and handles uS-delays) #endif #ifdef ENABLE_DS18B20 initTempReadings(); #endif #ifdef WIFI_ENABLED initWifi(); // Init WIFI #endif #ifdef MQTT_ENABLED mqtt_init(); #endif #ifdef IR_RECEIVER initReceiver(); // Init receiver-task #endif initIrTransmit(); 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, 1000 / portTICK_PERIOD_MS ); ESP_LOGI("MAIN","Lets go..."); // ---------------- MAIN WHILE ------------------- while(1) { vTaskDelayUntil( &vLastWakeTime, 1000 / portTICK_PERIOD_MS ); ESP_LOGI("MAIN","Send IR Tx Data"); uint8_t data[8]; xQueueSend( toshibaTxQueue, &data, 0 ); } vTaskDelete(NULL); }