#include #include #include #include #include #include #include #include #include #include #include #include #include "send.h" #include "pirSensor.h" static EventGroupHandle_t mainEventGroup; void app_main(void) { static const char *TAG = "main"; EventBits_t uxBits; mainEventGroup = xEventGroupCreate(); //Get the derived MAC address for each network interface uint8_t macAddr[6] = {0};; ESP_ERROR_CHECK_WITHOUT_ABORT(esp_read_mac(&macAddr[0], ESP_MAC_WIFI_STA)); ESP_LOGI("WIFI_STA MAC", "0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x", macAddr[0], macAddr[1], macAddr[2], macAddr[3], macAddr[4], macAddr[5]); ESP_LOGI(TAG, "Starting program"); //Initialize NVS esp_err_t ret = nvs_flash_init(); if((ret == ESP_ERR_NVS_NO_FREE_PAGES) || (ret == ESP_ERR_NVS_NEW_VERSION_FOUND)) { ESP_ERROR_CHECK(nvs_flash_erase()); ret = nvs_flash_init(); } ESP_ERROR_CHECK(ret); ESP_LOGI(TAG, "Done nvs_flash_init"); initSendEspNow(); initPirSensor(); while(1) { uxBits = xEventGroupWaitBits( mainEventGroup, 0xFFu, pdFALSE, pdFALSE, portMAX_DELAY); } }