#include #include #include #include #include #include "freertos/FreeRTOS.h" #include "freertos/task.h" #include "esp_sleep.h" #include "esp_log.h" #include "driver/uart.h" #include "driver/rtc_io.h" #include "esp_intr_alloc.h" #include "esp_attr.h" #include "driver/timer.h" #include #include "esp_intr_alloc.h" #include "receiver.h" #include "rxTimer.h" #include "toshiba_ir.h" #include "wifi.h" uint32_t dataArr[1000]; uint32_t dataArrIdx = 0; static int convertToSignedTemp(unsigned int value) { //int signValue; return ( (value >> 11) == 0 )? value : ((-1 ^ 0xFFF) | value); } void receiverTask(void *pvParameter) { ESP_LOGI("RX", "Receiver task starting."); uint32_t width; while (1) { while( xQueueReceive( rxQueue, &width, portMAX_DELAY ) == pdTRUE ) { /*dataArr[dataArrIdx++] = width; if( dataArrIdx == 1000 ) dataArrIdx=0; // Receive the Toshiba IR int64_t data = nextPulseToshiba_ir(width); if( data != -1 ) { int value = convertToSignedTemp( data & 0xFFF ); unsigned char id = (data>>12) & 0x007; ESP_LOGI("RX", "ClasO: %u %4.1f",data,id, (float)value/10); //sprintf(dataStr,"",data); #ifdef WIFI_ENABLED sendUDPMessage(dataStr, true); #endif } */ } } vTaskDelete(NULL); } void initReceiver() { gpio_pad_select_gpio(GPIO_RX_DATA); gpio_set_direction(GPIO_RX_DATA, GPIO_MODE_INPUT); //ClasO_ResetDecoder(); ESP_LOGI("RX", "Receiver has been initialized."); xTaskCreatePinnedToCore(&receiverTask, "receiverTask", 8192, NULL, tskIDLE_PRIORITY + 5, NULL, 0); }