97 // wifi_event_sta_disconnected_t* disconnected = (wifi_event_sta_disconnected_t*) event_data; |
97 // wifi_event_sta_disconnected_t* disconnected = (wifi_event_sta_disconnected_t*) event_data; |
98 // ESP_LOGI(TAG, "Event STA disconnected, reason:%d", disconnected->reason); |
98 // ESP_LOGI(TAG, "Event STA disconnected, reason:%d", disconnected->reason); |
99 if (xSemaphoreTake(xSemaphoreWiFi, 35) == pdTRUE) { |
99 if (xSemaphoreTake(xSemaphoreWiFi, 35) == pdTRUE) { |
100 wifi_state->STA_connected = false; |
100 wifi_state->STA_connected = false; |
101 wifi_state->STA_online = false; |
101 wifi_state->STA_online = false; |
102 //wifi_state->STA_rssi = 0; |
|
103 xSemaphoreGive(xSemaphoreWiFi); |
102 xSemaphoreGive(xSemaphoreWiFi); |
104 } else { |
103 } else { |
105 ESP_LOGE(TAG, "wifi_event_handler() lock error WIFI_EVENT_STA_DISCONNECTED"); |
104 ESP_LOGE(TAG, "wifi_event_handler() lock error WIFI_EVENT_STA_DISCONNECTED"); |
106 } |
105 } |
107 if (ready_mqtt()) |
106 if (ready_mqtt()) |
149 wifi_state->STA_online = false; |
148 wifi_state->STA_online = false; |
150 xSemaphoreGive(xSemaphoreWiFi); |
149 xSemaphoreGive(xSemaphoreWiFi); |
151 } else { |
150 } else { |
152 ESP_LOGE(TAG, "got_ip_event_handler() lock error IP_EVENT_STA_LOST_IP"); |
151 ESP_LOGE(TAG, "got_ip_event_handler() lock error IP_EVENT_STA_LOST_IP"); |
153 } |
152 } |
154 connect_mqtt(false); |
153 if (ready_mqtt()) |
155 break; |
154 connect_mqtt(false); |
156 |
|
157 case IP_EVENT_AP_STAIPASSIGNED: |
|
158 ESP_LOGI(TAG, "IP_EVENT_AP_STAIPASSIGNED"); |
|
159 break; |
155 break; |
160 |
156 |
161 default: |
157 default: |
162 ESP_LOGW(TAG, "Unknown IP event %d", (int)event_id); |
158 ESP_LOGW(TAG, "Unknown IP event %d", (int)event_id); |
163 break; |
159 break; |