Fix WiFiGeneric event handler (#3412)

This commit is contained in:
Mikhail Khalizev 2019-11-11 16:24:50 +03:00 committed by Me No Dev
parent 188560e7f3
commit ec63d09e54

View File

@ -54,10 +54,10 @@ static TaskHandle_t _network_event_task_handle = NULL;
static EventGroupHandle_t _network_event_group = NULL; static EventGroupHandle_t _network_event_group = NULL;
static void _network_event_task(void * arg){ static void _network_event_task(void * arg){
system_event_t *event = NULL; system_event_t event;
for (;;) { for (;;) {
if(xQueueReceive(_network_event_queue, &event, portMAX_DELAY) == pdTRUE){ if(xQueueReceive(_network_event_queue, &event, portMAX_DELAY) == pdTRUE){
WiFiGenericClass::_eventCallback(arg, event); WiFiGenericClass::_eventCallback(arg, &event);
} }
} }
vTaskDelete(NULL); vTaskDelete(NULL);
@ -65,7 +65,7 @@ static void _network_event_task(void * arg){
} }
static esp_err_t _network_event_cb(void *arg, system_event_t *event){ static esp_err_t _network_event_cb(void *arg, system_event_t *event){
if (xQueueSend(_network_event_queue, &event, portMAX_DELAY) != pdPASS) { if (xQueueSend(_network_event_queue, event, portMAX_DELAY) != pdPASS) {
log_w("Network Event Queue Send Failed!"); log_w("Network Event Queue Send Failed!");
return ESP_FAIL; return ESP_FAIL;
} }
@ -82,7 +82,7 @@ static bool _start_network_event_task(){
xEventGroupSetBits(_network_event_group, WIFI_DNS_IDLE_BIT); xEventGroupSetBits(_network_event_group, WIFI_DNS_IDLE_BIT);
} }
if(!_network_event_queue){ if(!_network_event_queue){
_network_event_queue = xQueueCreate(32, sizeof(system_event_t *)); _network_event_queue = xQueueCreate(32, sizeof(system_event_t));
if(!_network_event_queue){ if(!_network_event_queue){
log_e("Network Event Queue Create Failed!"); log_e("Network Event Queue Create Failed!");
return false; return false;