main/task_wifi.c

changeset 37
358bbd5b608e
parent 32
7717ac1d2f7f
child 44
e52d11b8f252
--- a/main/task_wifi.c	Sat Nov 23 19:10:05 2019 +0100
+++ b/main/task_wifi.c	Sat Nov 23 21:43:14 2019 +0100
@@ -54,7 +54,7 @@
  *        from a timeserver. Sets the global boolean System_TimeOk value. 
  * @param tv is the received time. Not used.
  */
-void time_sync_notification_cb(struct timeval *tv);
+//void time_sync_notification_cb(struct timeval *tv);
 
 /**
  * @brief Array with AP security names
@@ -163,7 +163,7 @@
 	    }
 
 	default:
-	    ESP_LOGI(TAG, "Unknown WiFi event %d", event_id);
+	    ESP_LOGW(TAG, "Unknown WiFi event %d", event_id);
 	    break;
     }
 }
@@ -203,7 +203,7 @@
 	    break;
 
 	default:
-	    ESP_LOGI(TAG, "Unknown IP event %d", event_id);
+	    ESP_LOGW(TAG, "Unknown IP event %d", event_id);
 	    break;
     }
 }
@@ -230,9 +230,6 @@
     xSemaphoreWiFi = xSemaphoreCreateMutex();
     wifi_state = malloc(sizeof(WIFI_State));
     memset(wifi_state, 0x00, sizeof(WIFI_State));
-//    wifi_state->STA_connected = false;
-//    wifi_state->STA_online = false;
-//    wifi_state->STA_rssi = 0;
 
     /* stop dhcp server and start dhcp client */
     ESP_ERROR_CHECK(tcpip_adapter_dhcps_stop(TCPIP_ADAPTER_IF_AP));
@@ -265,16 +262,16 @@
 	    /*
 	     * user requested a disconnect, this will in effect disconnect the wifi
 	     */
-	    ESP_LOGI(TAG, "Request STA disconnect");
+	    ESP_LOGD(TAG, "Request STA disconnect");
 	    ESP_ERROR_CHECK(esp_wifi_disconnect());
 	    xEventGroupWaitBits(xEventGroupWifi, TASK_WIFI_STA_DISCONNECTED, pdFALSE, pdTRUE, portMAX_DELAY );
-	    
+
 	    /* finally: release the scan request bit */
 	    xEventGroupClearBits(xEventGroupWifi, TASK_WIFI_REQUEST_STA_DISCONNECT);
 
 	} else if (uxBits & TASK_WIFI_REQUEST_STA_CONNECT) {
 
-	    ESP_LOGI(TAG, "Request STA connect");
+	    ESP_LOGD(TAG, "Request STA connect");
 	    xEventGroupClearBits(xEventGroupWifi, TASK_WIFI_STA_FAILED);
             _wifi_ScanAPs = true;
             _wifi_ScanDone = false;
@@ -290,7 +287,7 @@
             for (int i = 0; i < _wifi_Scanned; i++) {
 		wifi_ap_record_t ap = accessp_records[i];
 		// Check if we know this AP in the database.
-//		ESP_LOGI(TAG, "%d %-20s ch: %2d rssi: %d %s", i, ap.ssid, ap.primary, ap.rssi, apsec[ap.authmode]);
+		ESP_LOGD(TAG, "%d %-20s ch: %2d rssi: %d %s", i, ap.ssid, ap.primary, ap.rssi, apsec[ap.authmode]);
 		if ((read_station(ap.ssid) >= 0)) {
 		    /* ssid */
 		    size_t sz = sizeof(task_wifi_ConfigSTA->sta.ssid);
@@ -306,7 +303,7 @@
 		/*
 		 * Now connect to the known SSID
 		 */
-	//	ESP_LOGI(TAG, "Connecting to `%s'", task_wifi_ConfigSTA->sta.ssid);
+		ESP_LOGD(TAG, "Connecting to `%s'", task_wifi_ConfigSTA->sta.ssid);
 		ESP_ERROR_CHECK(esp_wifi_set_config(WIFI_IF_STA, task_wifi_ConfigSTA));
 		esp_err_t wifierror = esp_wifi_connect();
 		if (wifierror != ESP_OK) {

mercurial