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 <piyush@espressif.com>
This commit is contained in:
Piyush Shah
2017-11-15 13:04:21 +05:30
parent b83792f504
commit 371c66f188

View File

@@ -65,22 +65,22 @@ static const char *TAG = "scan";
static esp_err_t event_handler(void *ctx, system_event_t *event) static esp_err_t event_handler(void *ctx, system_event_t *event)
{ {
switch(event->event_id) { switch (event->event_id) {
case SYSTEM_EVENT_STA_START: case SYSTEM_EVENT_STA_START:
ESP_LOGI(TAG, "SYSTEM_EVENT_STA_START"); ESP_LOGI(TAG, "SYSTEM_EVENT_STA_START");
ESP_ERROR_CHECK(esp_wifi_connect()); ESP_ERROR_CHECK(esp_wifi_connect());
break; break;
case SYSTEM_EVENT_STA_GOT_IP: case SYSTEM_EVENT_STA_GOT_IP:
ESP_LOGI(TAG, "SYSTEM_EVENT_STA_GOT_IP"); ESP_LOGI(TAG, "SYSTEM_EVENT_STA_GOT_IP");
ESP_LOGI(TAG, "got ip:%s\n", ESP_LOGI(TAG, "got ip:%s\n",
ip4addr_ntoa(&event->event_info.got_ip.ip_info.ip)); ip4addr_ntoa(&event->event_info.got_ip.ip_info.ip));
break; break;
case SYSTEM_EVENT_STA_DISCONNECTED: case SYSTEM_EVENT_STA_DISCONNECTED:
ESP_LOGI(TAG, "SYSTEM_EVENT_STA_DISCONNECTED"); ESP_LOGI(TAG, "SYSTEM_EVENT_STA_DISCONNECTED");
ESP_ERROR_CHECK(esp_wifi_connect()); ESP_ERROR_CHECK(esp_wifi_connect());
break; break;
default: default:
break; break;
} }
return ESP_OK; return ESP_OK;
} }
@@ -94,14 +94,14 @@ static void wifi_scan(void)
wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT(); wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT();
ESP_ERROR_CHECK(esp_wifi_init(&cfg)); ESP_ERROR_CHECK(esp_wifi_init(&cfg));
wifi_config_t wifi_config = { wifi_config_t wifi_config = {
.sta = { .sta = {
.ssid = DEFAULT_SSID, .ssid = DEFAULT_SSID,
.password = DEFAULT_PWD, .password = DEFAULT_PWD,
.scan_method = DEFAULT_SCAN_METHOD, .scan_method = DEFAULT_SCAN_METHOD,
.sort_method = DEFAULT_SORT_METHOD, .sort_method = DEFAULT_SORT_METHOD,
.threshold.rssi = DEFAULT_RSSI, .threshold.rssi = DEFAULT_RSSI,
.threshold.authmode = DEFAULT_AUTHMODE, .threshold.authmode = DEFAULT_AUTHMODE,
}, },
}; };
ESP_ERROR_CHECK(esp_wifi_set_mode(WIFI_MODE_STA)); ESP_ERROR_CHECK(esp_wifi_set_mode(WIFI_MODE_STA));
ESP_ERROR_CHECK(esp_wifi_set_config(ESP_IF_WIFI_STA, &wifi_config)); ESP_ERROR_CHECK(esp_wifi_set_config(ESP_IF_WIFI_STA, &wifi_config));