From 371c66f18811aaa05e6e6e6d353f0f3b3bcbe0da Mon Sep 17 00:00:00 2001 From: Piyush Shah Date: Wed, 15 Nov 2017 13:04:21 +0530 Subject: [PATCH] wifi_scan_example: Indentation Fixes - Trailing white spaces removed - Re-formatted switch-case Basic indentation fixes were done using tools/format.sh and switch-case formatting was done manually (to identify different levels for "switch" and "case") Signed-off-by: Piyush Shah --- examples/wifi/scan/main/scan.c | 50 +++++++++++++++++----------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/examples/wifi/scan/main/scan.c b/examples/wifi/scan/main/scan.c index f48464886d..28c5a704f3 100644 --- a/examples/wifi/scan/main/scan.c +++ b/examples/wifi/scan/main/scan.c @@ -9,12 +9,12 @@ /* this example shows how to use all channel scan or fast scan to connect - In the fast scan mode, scan will end after find matched AP, in this mode, you - can set the threshold of auth mode and signal, the filter will ignore the AP + In the fast scan mode, scan will end after find matched AP, in this mode, you + can set the threshold of auth mode and signal, the filter will ignore the AP whose auth mode and rssi below the threshold. - In the all channel scan, scan will end after scan all the channel, and will + In the all channel scan, scan will end after scan all the channel, and will the best AP to connect, you can sort by signal or auth mode, auth mode is follow - the rule WPA2>WPA>WEP. + the rule WPA2>WPA>WEP. */ #include "freertos/FreeRTOS.h" #include "freertos/event_groups.h" @@ -65,22 +65,22 @@ static const char *TAG = "scan"; static esp_err_t event_handler(void *ctx, system_event_t *event) { - switch(event->event_id) { - case SYSTEM_EVENT_STA_START: - ESP_LOGI(TAG, "SYSTEM_EVENT_STA_START"); - ESP_ERROR_CHECK(esp_wifi_connect()); - break; - case SYSTEM_EVENT_STA_GOT_IP: - ESP_LOGI(TAG, "SYSTEM_EVENT_STA_GOT_IP"); - ESP_LOGI(TAG, "got ip:%s\n", - ip4addr_ntoa(&event->event_info.got_ip.ip_info.ip)); - break; - case SYSTEM_EVENT_STA_DISCONNECTED: - ESP_LOGI(TAG, "SYSTEM_EVENT_STA_DISCONNECTED"); - ESP_ERROR_CHECK(esp_wifi_connect()); - break; - default: - break; + switch (event->event_id) { + case SYSTEM_EVENT_STA_START: + ESP_LOGI(TAG, "SYSTEM_EVENT_STA_START"); + ESP_ERROR_CHECK(esp_wifi_connect()); + break; + case SYSTEM_EVENT_STA_GOT_IP: + ESP_LOGI(TAG, "SYSTEM_EVENT_STA_GOT_IP"); + ESP_LOGI(TAG, "got ip:%s\n", + ip4addr_ntoa(&event->event_info.got_ip.ip_info.ip)); + break; + case SYSTEM_EVENT_STA_DISCONNECTED: + ESP_LOGI(TAG, "SYSTEM_EVENT_STA_DISCONNECTED"); + ESP_ERROR_CHECK(esp_wifi_connect()); + break; + default: + break; } return ESP_OK; } @@ -90,18 +90,18 @@ static void wifi_scan(void) { tcpip_adapter_init(); ESP_ERROR_CHECK(esp_event_loop_init(event_handler, NULL)); - + wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT(); ESP_ERROR_CHECK(esp_wifi_init(&cfg)); wifi_config_t wifi_config = { - .sta = { - .ssid = DEFAULT_SSID, - .password = DEFAULT_PWD, + .sta = { + .ssid = DEFAULT_SSID, + .password = DEFAULT_PWD, .scan_method = DEFAULT_SCAN_METHOD, .sort_method = DEFAULT_SORT_METHOD, .threshold.rssi = DEFAULT_RSSI, .threshold.authmode = DEFAULT_AUTHMODE, - }, + }, }; ESP_ERROR_CHECK(esp_wifi_set_mode(WIFI_MODE_STA)); ESP_ERROR_CHECK(esp_wifi_set_config(ESP_IF_WIFI_STA, &wifi_config));