将wifi初始化放在main中的程序,不能将扫描也放到main中。
This commit is contained in:
parent
8c8e58fec2
commit
caaa816163
@ -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 ".")
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
#include <stdio.h>
|
||||
#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);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -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 无
|
||||
|
||||
@ -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);
|
||||
|
||||
|
||||
@ -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();
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user