From 0b2ffdf4b7c69c04bf8565c7360881a5bc3d1474 Mon Sep 17 00:00:00 2001 From: Snorky Date: Thu, 9 Jan 2025 19:30:41 +0100 Subject: [PATCH] First commit --- main/wifi_connect.c | 6 +++--- main/wifi_connect.h | 8 +++----- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/main/wifi_connect.c b/main/wifi_connect.c index 257bc42..dfeafb7 100644 --- a/main/wifi_connect.c +++ b/main/wifi_connect.c @@ -29,7 +29,7 @@ static void event_handler(void* arg, esp_event_base_t event_base, if (event_base == WIFI_EVENT && event_id == WIFI_EVENT_STA_START) { esp_wifi_connect(); } else if (event_base == WIFI_EVENT && event_id == WIFI_EVENT_STA_DISCONNECTED) { - if (s_retry_num < EXAMPLE_ESP_MAXIMUM_RETRY) { + if (s_retry_num < CONFIG_ESP_MAXIMUM_RETRY) { esp_wifi_connect(); s_retry_num++; ESP_LOGI(TAG, "retry to connect to the AP"); @@ -72,8 +72,8 @@ void wifi_init_sta(void) wifi_config_t wifi_config = { .sta = { - .ssid = EXAMPLE_ESP_WIFI_SSID, - .password = EXAMPLE_ESP_WIFI_PASS, + .ssid = CONFIG_ESP_WIFI_SSID, + .password = CONFIG_ESP_WIFI_PASS, /* Authmode threshold resets to WPA2 as default if password matches WPA2 standards (password len => 8). * If you want to connect the device to deprecated WEP/WPA networks, Please set the threshold value * to WIFI_AUTH_WEP/WIFI_AUTH_WPA_PSK and set the password with length and format matching to diff --git a/main/wifi_connect.h b/main/wifi_connect.h index 184c996..ddb1e39 100644 --- a/main/wifi_connect.h +++ b/main/wifi_connect.h @@ -1,11 +1,9 @@ #include "esp_event.h" -#define EXAMPLE_ESP_WIFI_SSID "Freebox_nomap" -#define EXAMPLE_ESP_WIFI_PASS "anthedoniconfutarissuggestu2insignans" -/* #define EXAMPLE_ESP_WIFI_SSID "TheGame" -#define EXAMPLE_ESP_WIFI_PASS "totototoQ" */ -#define EXAMPLE_ESP_MAXIMUM_RETRY 3 +#define CONFIG_ESP_WIFI_SSID "YourSSID" +#define CONFIG_ESP_WIFI_PASS "YourPASSWORD" +#define CONFIG_ESP_MAXIMUM_RETRY 3 #if CONFIG_ESP_WPA3_SAE_PWE_HUNT_AND_PECK #define ESP_WIFI_SAE_MODE WPA3_SAE_PWE_HUNT_AND_PECK