diff --git a/main/app_main.cpp b/main/app_main.cpp index f7740a0..f384938 100644 --- a/main/app_main.cpp +++ b/main/app_main.cpp @@ -68,6 +68,15 @@ reaction_structer_t reaction_structer = { .reaction_start_time = 0, }; +/*********************************************************************************************************************** + * *******************************************************wifi******************************************************** * + ***********************************************************************************************************************/ +wifi_structer_t wifi_structer = { + .wifi_connect_flag = false, + .wifi_distribution_network_flag = false, + .wifi_max_connect_num = 10, +}; + static void T_all_light_init(void) { T_power_light_init(&power_state_light_structer); @@ -105,6 +114,14 @@ void process_key_event(void) void process_key_long_press_event(void) { + /* 配网 */ + if (!wifi_structer.wifi_distribution_network_flag) + { + if (T_wifi_distribution_network()) + { + wifi_structer.wifi_distribution_network_flag = true; + } + } } void T_reaction_schedule(void) diff --git a/main/wifi.c b/main/wifi.c index 9a60655..f6e7ee8 100644 --- a/main/wifi.c +++ b/main/wifi.c @@ -1,12 +1,12 @@ /** * @file wifi.c * @author Finny (tianjialong0106@163.com) - * @brief + * @brief * @version 0.1 * @date 2022-09-26 - * + * * @copyright Copyright (c) 2022 - * + * */ #include "wifi.h" @@ -15,7 +15,9 @@ #define WIFI_NAME "ZWSD_ESP32" #define WIFI_PASSWORD "zwsdzwsd" -void T_wifi_init(void) {} +static wifi_structer_t *wifi_structer_s; + +void T_wifi_init(wifi_structer_t *wifi_structer) { wifi_structer_s = wifi_structer; } void T_wifi_registered_cb(void) {} @@ -25,4 +27,6 @@ void T_wifi_disconnect(void) {} bool T_wifi_connect_timeout(void) { return true; } -void T_wifi_send_data(void) {} \ No newline at end of file +void T_wifi_send_data(void) {} + +bool T_wifi_distribution_network(void) {} \ No newline at end of file diff --git a/main/wifi.h b/main/wifi.h index 6b371db..1d2e3cd 100644 --- a/main/wifi.h +++ b/main/wifi.h @@ -5,12 +5,14 @@ typedef struct { bool wifi_connect_flag; + bool wifi_distribution_network_flag; uint8_t wifi_max_connect_num; } wifi_structer_t; -void T_wifi_init(void); +void T_wifi_init(wifi_structer_t *wifi_structer); void T_wifi_registered_cb(void); void T_wifi_connect(void); void T_wifi_disconnect(void); bool T_wifi_connect_timeout(void); -void T_wifi_send_data(void); \ No newline at end of file +void T_wifi_send_data(void); +bool T_wifi_distribution_network(void); \ No newline at end of file