diff --git a/components/FluxPower/CMakeLists.txt b/components/FluxPower/CMakeLists.txt index 824ac41..9f7dce6 100644 --- a/components/FluxPower/CMakeLists.txt +++ b/components/FluxPower/CMakeLists.txt @@ -1,3 +1,3 @@ idf_component_register(SRCS "FluxPower.c" - REQUIRES driver freertos esp_adc FluxUI lvgl + REQUIRES driver freertos esp_adc FluxUI lvgl FluxWifi INCLUDE_DIRS ".") diff --git a/components/FluxPower/FluxPower.c b/components/FluxPower/FluxPower.c index c05fbe9..1d2fae9 100644 --- a/components/FluxPower/FluxPower.c +++ b/components/FluxPower/FluxPower.c @@ -1,6 +1,8 @@ #include #include "FluxPower.h" +#include "FluxWifi.h" + static const char *TAG = "POWER_IO"; /*电量变化引起的界面控件参数变化*/ @@ -39,9 +41,8 @@ void powerTask(void) lv_slider_set_value(ui_Home_SliderHeaderBat,Bat_Voltage_Value/4.2*100,LV_ANIM_ON); lv_label_set_text_fmt(ui_Home_LabelHeaderBatValue,"%.0f%%",Bat_Voltage_Value/4.2*100); - // ESP_LOGI("dd","%d",Bat_Adc_Value); - - //printf("in powerTask the min free stack size is %ld \r\n", (int32_t)uxTaskGetStackHighWaterMark(NULL)); + /*进行WIFI扫描*/ + wifi_scan(); } } @@ -64,6 +65,4 @@ void powerInit(void) xTaskCreate(powerTask,"powerTask",4*1024, NULL, 2, &powerTaskHandle); - - } diff --git a/components/FluxWifi/FluxWifi.c b/components/FluxWifi/FluxWifi.c index 3b6d10b..84a3dbb 100644 --- a/components/FluxWifi/FluxWifi.c +++ b/components/FluxWifi/FluxWifi.c @@ -11,7 +11,7 @@ static const char* TAG = "wifi_scan"; * @param * @retval */ -void wifi_scan(void) +void wifi_scanInit(void) { ESP_ERROR_CHECK(nvs_flash_init()); ESP_ERROR_CHECK(esp_netif_init()); @@ -31,16 +31,27 @@ void wifi_scan(void) /* WIFI */ ESP_ERROR_CHECK(esp_wifi_start()); + // /* ʼɨ踽WIFI, ȴɨ */ + // esp_wifi_scan_start(NULL, true); + + // /* ȡɨ */ + // get_wifi_scan_result(); + + return; +} + +void wifi_scan(void) +{ /* ʼɨ踽WIFI, ȴɨ */ esp_wifi_scan_start(NULL, true); /* ȡɨ */ get_wifi_scan_result(); + return; } - /** * @brief ȡWi-Fiɨ * @param diff --git a/components/FluxWifi/FluxWifi.h b/components/FluxWifi/FluxWifi.h index 3bf4334..60e5855 100644 --- a/components/FluxWifi/FluxWifi.h +++ b/components/FluxWifi/FluxWifi.h @@ -20,4 +20,5 @@ static void print_cipher_type(int pairwise_cipher, int group_cipher); static void print_auth_mode(int authmode); static void get_wifi_scan_result(void); void wifi_scan(void); +void wifi_scanInit(void); diff --git a/main/i80_controller_example_main.c b/main/i80_controller_example_main.c index c50c57d..c68c0db 100644 --- a/main/i80_controller_example_main.c +++ b/main/i80_controller_example_main.c @@ -376,8 +376,8 @@ void app_main(void) /*拉起开机状态*/ POWER_ON; - /*进行WIFI扫描*/ - wifi_scan(); + // /*进行WIFI扫描*/ + // wifi_scan(); static lv_disp_draw_buf_t disp_buf; // contains internal graphic buffer(s) called draw buffer(s) static lv_disp_drv_t disp_drv; // contains callback functions @@ -477,11 +477,15 @@ void app_main(void) /*电源管理开始*/ powerInit(); + /*初始化wifi扫描环境*/ + wifi_scanInit(); + /*初始化Modbus*/ ESP_ERROR_CHECK(modbus_master_init()); // Lock the mutex due to the LVGL APIs are not thread-safe if (example_lvgl_lock(-1)) { + //example_lvgl_demo_ui(disp); ui_init();