// This file was generated by SquareLine Studio // SquareLine Studio version: SquareLine Studio 1.5.1 // LVGL version: 8.3.6 // Project name: ESP32S3_UI #include "ui.h" #include "driver/ledc.h" #include "esp_err.h" #include "esp_log.h" #include "FluxMod.h" #include "FluxWifi.h" #define LOWERST_LIGHT_LEVEL (7222) void lightSliderCallback(lv_event_t * e) { // Your code here // Your code here uint32_t value = 8192-lv_slider_get_value(e->target); //ESP_LOGI("lightSliderCallback", "value = %u", value); if (value>LOWERST_LIGHT_LEVEL) { value = LOWERST_LIGHT_LEVEL; } ESP_ERROR_CHECK(ledc_set_duty(LEDC_LOW_SPEED_MODE, LEDC_CHANNEL_0, value)); // Update duty to apply the new value ESP_ERROR_CHECK(ledc_update_duty(LEDC_LOW_SPEED_MODE, LEDC_CHANNEL_0)); } void DeviceDropDownValueChanged(lv_event_t * e) { char buf[32]={}; lv_dropdown_get_selected_str(e->target,buf,32); lv_label_set_text(ui_Home_HeaderDeviceType, buf); } void wifisearch(lv_event_t * e) { wifi_scan(); } void getSdcardInfo(lv_event_t * e) { // Your code here } void wifiNameValueChanged(lv_event_t * e) { // Your code here int currentIndex=0; currentIndex = lv_dropdown_get_selected(e->target); lv_label_set_text_fmt(ui_wifiSet_wifiInfoLabel, "RSSI:%d dBm ", ap_info[currentIndex].rssi); lv_label_set_text_fmt(ui_wifiSet_connectTo,"connect to %s",ap_info[currentIndex].ssid); if (strcmp((char*)ap_info[currentIndex].ssid,"yuwell")==0) { lv_textarea_set_text(ui_wifiSet_passwordWifi, "yuwell123456"); } } void wificonnect(lv_event_t * e) { int currentIndex=0; ESP_ERROR_CHECK(esp_wifi_stop()); currentIndex = lv_dropdown_get_selected(ui_wifiSet_wifiname); // Your code here wifi_config_t wifi_config = { .sta = { .ssid = "yuwell", .password = "yuwell123456", /* 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 * WIFI_AUTH_WEP/WIFI_AUTH_WPA_PSK standards. */ .threshold = { .authmode = ap_info[currentIndex].authmode, }, .sae_pwe_h2e = WPA3_SAE_PWE_BOTH, .sae_h2e_identifier = "", }, }; lv_dropdown_get_selected_str(ui_wifiSet_wifiname,(char*)wifi_config.sta.ssid,32); strncpy((char*)wifi_config.sta.password,lv_textarea_get_text(ui_wifiSet_passwordWifi),64); ESP_ERROR_CHECK(esp_wifi_set_config(WIFI_IF_STA, &wifi_config)); ESP_ERROR_CHECK(esp_wifi_start() ); ESP_LOGI("TAG", "wifi_init_sta finished."); esp_wifi_connect(); } void passwordClear(lv_event_t * e) { // Your code here lv_textarea_set_text(ui_wifiSet_passwordWifi, ""); }