/** * @Author: 李建 * @Date: 2025/3/18 11:34 * Description: 定义了UI 与 逻辑的交互 * Copyright: Copyright (©) 2025 永续绿建. All rights reserved. */ #include #include #include #include #include "misc/lv_types.h" #include "widgets/tabview/lv_tabview.h" #include "gui_guider.h" #include "main.h" #include "wifi.h" #include "actions.h" #include "xf_controller.h" #include "lvgl_port.h" #include "modbus_master.h" #include "system/miscellaneous_interface.h" LV_IMAGE_DECLARE(_orange_meter_RGB565A8_84x396); LV_IMAGE_DECLARE(_green_meter_RGB565A8_84x396); LV_IMAGE_DECLARE(_power_open_RGB565A8_36x36); LV_IMAGE_DECLARE(_nxh_off_RGB565A8_80x80); LV_IMAGE_DECLARE(_js_on_RGB565A8_80x80); LV_IMAGE_DECLARE(_auto_on_RGB565A8_80x80); LV_IMAGE_DECLARE(_xf_on_RGB565A8_80x80); const static char *TAG = "actions"; extern void set_xf_mode(lv_ui *ui, uint16_t mode); // /** * 点击管理密码登录按钮事件 * @param e */ void on_btn_check_manager_password(lv_event_t *e) { const char *password = lv_textarea_get_text(guider_ui.SettingPage_ta_1); if (strcmp(password, "0803") != 0) { // 显示密码错误标签 lv_obj_remove_flag(guider_ui.SettingPage_lab_password_incorrect, LV_OBJ_FLAG_HIDDEN); } else { // 验证通过 lv_obj_add_flag(guider_ui.SettingPage_lab_password_incorrect, LV_OBJ_FLAG_HIDDEN); // 隐藏密码输入 panel lv_obj_add_flag(guider_ui.SettingPage_cont_1, LV_OBJ_FLAG_HIDDEN); // 显示高级设置界面 guider_ui.SettingPage_del = true; ui_load_scr_animation(&guider_ui, &guider_ui.FactorySettingPage, true, &guider_ui.SettingPage_del, setup_scr_FactorySettingPage, LV_SCR_LOAD_ANIM_MOVE_RIGHT, 200, 200, true, true); } } //void on_ac_page_set_power(lv_event_t *e) { // lv_obj_t *obj = lv_event_get_current_target(e); // if (lv_obj_has_state(obj, LV_STATE_CHECKED)) { // ac_status.power = 1; // } else { // ac_status.power = 0; // } // ac_set_power(false); //} /** * 点击设置-开关机按钮事件 * @param e */ void on_btn_power_click(lv_event_t *e) { lv_obj_t *obj = lv_event_get_current_target(e); if (lv_obj_has_state(obj, LV_STATE_CHECKED)) { xf_status.power = 1; } else { xf_status.power = 0; } xf_set_power(true); } /** * 滑块风挡值变化 * @param e */ void on_slider_speed_value_changed(lv_event_t *e) { int32_t value=lv_slider_get_value(guider_ui.screen_main_slider_speedSet_sign); if(value<=20) { lv_label_set_text_static(guider_ui.screen_main_label_spedSet_vul, "1档"); }else if(value<=40) { lv_label_set_text_static(guider_ui.screen_main_label_spedSet_vul, "2档"); }else if(value<=60) { lv_label_set_text_static(guider_ui.screen_main_label_spedSet_vul, "3档"); }else if(value<=80) { lv_label_set_text_static(guider_ui.screen_main_label_spedSet_vul, "4档"); }else if(value<=100) { lv_label_set_text_static(guider_ui.screen_main_label_spedSet_vul, "5档"); }else{ } } /** * 滑块风挡释放 * @param e */ void on_slider_speed_released(lv_event_t *e) { int32_t value=lv_slider_get_value(guider_ui.screen_main_slider_speedSet_sign); lvgl_port_lock(-1); if(value<=20) { lv_label_set_text_static(guider_ui.screen_main_label_spedSet_vul, "1档"); lv_slider_set_value(guider_ui.screen_main_slider_speedSet_sign,20,LV_ANIM_OFF); xf_status.fan_speed=1; }else if(value<=40) { lv_label_set_text_static(guider_ui.screen_main_label_spedSet_vul, "2档"); lv_slider_set_value(guider_ui.screen_main_slider_speedSet_sign,40,LV_ANIM_OFF); xf_status.fan_speed=2; }else if(value<=60) { lv_label_set_text_static(guider_ui.screen_main_label_spedSet_vul, "3档"); lv_slider_set_value(guider_ui.screen_main_slider_speedSet_sign,60,LV_ANIM_OFF); xf_status.fan_speed=3; }else if(value<=80) { lv_label_set_text_static(guider_ui.screen_main_label_spedSet_vul, "4档"); lv_slider_set_value(guider_ui.screen_main_slider_speedSet_sign,80,LV_ANIM_OFF); xf_status.fan_speed=4; }else if(value<=100) { lv_label_set_text_static(guider_ui.screen_main_label_spedSet_vul, "5档"); lv_slider_set_value(guider_ui.screen_main_slider_speedSet_sign,100,LV_ANIM_OFF); xf_status.fan_speed=5; }else{ } xf_set_fan_speed(true); lvgl_port_unlock(); // xf_set_fan_speed(true); // mm_set_param(CID_FAN_SPEED, (uint8_t *)&xf_status.fan_speed); } /** * 滑块最大湿度值变化 * @param e */ void on_slider_hum_value_changed(lv_event_t *e) { int32_t value=lv_slider_get_value(guider_ui.screen_main_slider_humSet_sign); if(value>100) { value=100; }else if(value<=system_setting.set_min_hum) { value=system_setting.set_min_hum; } lvgl_port_lock(-1); lv_label_set_text_fmt(guider_ui.screen_main_label_humSet_vul, "%ld%%",value); lvgl_port_unlock(); } /** * 滑块最大湿度值释放 * @param e */ void on_slider_hum_released(lv_event_t *e) { int32_t value=lv_slider_get_value(guider_ui.screen_main_slider_humSet_sign); if(value>100) { value=100; }else if(value<=system_setting.set_min_hum) { value=system_setting.set_min_hum; } lvgl_port_lock(-1); lv_slider_set_value(guider_ui.screen_main_slider_humSet_sign,value,LV_ANIM_OFF); lv_label_set_text_fmt(guider_ui.screen_main_label_humSet_vul, "%ld%%",value); lvgl_port_unlock(); xf_status.set_max_hum=value; xf_set_max_hum(true); } /** * 点击设置-网络-查找网络按钮事件 * @param e */ void on_btn_scan_wifi_click(lv_event_t *e) { lv_obj_clean(guider_ui.SettingPage_list_wifi); app_wifi_scan(); } /** * 点击连接 wifi 按钮 * @param e */ void on_btn_connect_wifi(lv_event_t *e) { app_connect_wifi(); } /** * 保存滤网寿命设置 * @param e */ void on_btn_filter_life_save(lv_event_t *e) { system_setting.filter_life_time=60*24*30*lv_spinbox_get_value(guider_ui.FactorySettingPage_spinbox_filter_life); save_system_setting(&system_setting); } /** * 切换至主页面 * @param e */ void switch_screen_main_set(lv_event_t *e) { lv_ui * ui = lv_event_get_user_data(e); // 设置温度及滑动和风速状态 lvgl_port_lock(-1); lv_label_set_text_fmt(ui->screen_main_label_humSet_vul, "%d%%", xf_status.set_max_hum); lv_slider_set_value(ui->screen_main_slider_speedSet_sign, xf_status.fan_speed*20, LV_ANIM_ON); lv_label_set_text_fmt(ui->screen_main_label_spedSet_vul, "%d档",xf_status.fan_speed); lv_slider_set_value(ui->screen_main_slider_humSet_sign, xf_status.set_max_hum, LV_ANIM_ON); set_xf_mode(ui, xf_status.mode); xf_set_power(true); // 设置电源状态 lv_obj_add_state(ui->screen_main_imgbtn_power, xf_status.power == 1 ? LV_STATE_CHECKED : LV_STATE_DEFAULT); lvgl_port_unlock(); } /** * 切换至设置页面 * @param e */ void switch_setting_page_set(lv_event_t *e) { lv_ui * ui = lv_event_get_user_data(e); lvgl_port_lock(-1); if(system_setting.sound_on_off) lv_obj_add_state(ui->SettingPage_sw_sound, LV_STATE_CHECKED); else lv_obj_remove_state(ui->SettingPage_sw_sound, LV_STATE_CHECKED); if(system_setting.screen_auto_off) lv_obj_add_state(ui->SettingPage_sw_1, LV_STATE_CHECKED); else lv_obj_remove_state(ui->SettingPage_sw_1, LV_STATE_CHECKED); lv_slider_set_value(ui->SettingPage_slider_sound_level, system_setting.sound_volume, false); lv_spinbox_set_value(ui->SettingPage_spinbox_2,system_setting.screen_off_minute); lvgl_port_unlock(); } /** * 切换至高级设置页面 * @param e */ void switch_factory_setting_page_set(lv_event_t *e) { char str[32]={0}; int index=0; lv_ui * ui = lv_event_get_user_data(e); lvgl_port_lock(-1); lv_spinbox_set_value(ui->FactorySettingPage_spinbox_filter_life, (int32_t )system_setting.filter_life_time/60/30/24); lv_spinbox_set_value(ui->FactorySettingPage_spinbox_supply1_vol, system_setting.supply_first_vol); lv_spinbox_set_value(ui->FactorySettingPage_spinbox_supply2_vol, system_setting.supply_second_vol); lv_spinbox_set_value(ui->FactorySettingPage_spinbox_supply3_vol, system_setting.supply_third_vol); lv_spinbox_set_value(ui->FactorySettingPage_spinbox_supply4_vol, system_setting.supply_fourth_vol); lv_spinbox_set_value(ui->FactorySettingPage_spinbox_supply5_vol, system_setting.supply_fifth_vol); lv_spinbox_set_value(ui->FactorySettingPage_spinbox_exhaust1_vol, system_setting.exhaust_first_vol); lv_spinbox_set_value(ui->FactorySettingPage_spinbox_exhaust2_vol, system_setting.exhaust_second_vol); lv_spinbox_set_value(ui->FactorySettingPage_spinbox_exhaust3_vol, system_setting.exhaust_third_vol); lv_spinbox_set_value(ui->FactorySettingPage_spinbox_exhaust4_vol, system_setting.exhaust_fourth_vol); lv_spinbox_set_value(ui->FactorySettingPage_spinbox_exhaust5_vol, system_setting.exhaust_fifth_vol); if(xf_status.error_code==0) { lv_label_set_text_static(ui->FactorySettingPage_label_detail_error, "NONE"); } else{ index=0; for(int i=0;i<8;i++) { if(xf_status.error_code&(1<FactorySettingPage_label_detail_error, str); } lvgl_port_unlock(); } /** * 重置滤网剩余寿命 * @param e */ void on_btn_filter_life_remain_clear(lv_event_t *e) { xf_status.filter_used_time=0; xf_status.filter_life_remaining=100; xf_set_filter_life_remain(true); } void on_fan_vol_refresh(lv_event_t *e) { lv_ui * ui = lv_event_get_user_data(e); esp_err_t err = mm_get_param(CID_AIR_EXHAUST_FIRST_VOL, (uint8_t *)&system_setting.exhaust_first_vol); mm_get_param(CID_AIR_EXHAUST_SECOND_VOL, (uint8_t *)&system_setting.exhaust_second_vol); mm_get_param(CID_AIR_EXHAUST_THIRD_VOL, (uint8_t *)&system_setting.exhaust_third_vol); mm_get_param(CID_AIR_EXHAUST_FOURTH_VOL, (uint8_t *)&system_setting.exhaust_fourth_vol); mm_get_param(CID_AIR_EXHAUST_FIFTH_VOL, (uint8_t *)&system_setting.exhaust_fifth_vol); mm_get_param(CID_AIR_SUPPLY_FIRST_VOL, (uint8_t *)&system_setting.supply_first_vol); mm_get_param(CID_AIR_SUPPLY_SECOND_VOL, (uint8_t *)&system_setting.supply_second_vol); mm_get_param(CID_AIR_SUPPLY_THIRD_VOL, (uint8_t *)&system_setting.supply_third_vol); mm_get_param(CID_AIR_SUPPLY_FOURTH_VOL, (uint8_t *)&system_setting.supply_fourth_vol); mm_get_param(CID_AIR_SUPPLY_FIFTH_VOL, (uint8_t *)&system_setting.supply_fifth_vol); lvgl_port_lock(-1); lv_spinbox_set_value(ui->FactorySettingPage_spinbox_supply1_vol, system_setting.supply_first_vol); lv_spinbox_set_value(ui->FactorySettingPage_spinbox_supply2_vol, system_setting.supply_second_vol); lv_spinbox_set_value(ui->FactorySettingPage_spinbox_supply3_vol, system_setting.supply_third_vol); lv_spinbox_set_value(ui->FactorySettingPage_spinbox_supply4_vol, system_setting.supply_fourth_vol); lv_spinbox_set_value(ui->FactorySettingPage_spinbox_supply5_vol, system_setting.supply_fifth_vol); lv_spinbox_set_value(ui->FactorySettingPage_spinbox_exhaust1_vol, system_setting.exhaust_first_vol); lv_spinbox_set_value(ui->FactorySettingPage_spinbox_exhaust2_vol, system_setting.exhaust_second_vol); lv_spinbox_set_value(ui->FactorySettingPage_spinbox_exhaust3_vol, system_setting.exhaust_third_vol); lv_spinbox_set_value(ui->FactorySettingPage_spinbox_exhaust4_vol, system_setting.exhaust_fourth_vol); lv_spinbox_set_value(ui->FactorySettingPage_spinbox_exhaust5_vol, system_setting.exhaust_fifth_vol); lvgl_port_unlock(); } void on_fan_vol_save(lv_event_t *e) { lv_ui * ui = lv_event_get_user_data(e); system_setting.exhaust_first_vol=lv_spinbox_get_value(ui->FactorySettingPage_spinbox_exhaust1_vol); system_setting.exhaust_second_vol=lv_spinbox_get_value(ui->FactorySettingPage_spinbox_exhaust2_vol); system_setting.exhaust_third_vol=lv_spinbox_get_value(ui->FactorySettingPage_spinbox_exhaust3_vol); system_setting.exhaust_fourth_vol=lv_spinbox_get_value(ui->FactorySettingPage_spinbox_exhaust4_vol); system_setting.exhaust_fifth_vol=lv_spinbox_get_value(ui->FactorySettingPage_spinbox_exhaust5_vol); system_setting.supply_first_vol=lv_spinbox_get_value(ui->FactorySettingPage_spinbox_supply1_vol); system_setting.supply_second_vol=lv_spinbox_get_value(ui->FactorySettingPage_spinbox_supply2_vol); system_setting.supply_third_vol=lv_spinbox_get_value(ui->FactorySettingPage_spinbox_supply3_vol); system_setting.supply_fourth_vol=lv_spinbox_get_value(ui->FactorySettingPage_spinbox_supply4_vol); system_setting.supply_fifth_vol=lv_spinbox_get_value(ui->FactorySettingPage_spinbox_supply5_vol); // ESP_LOGE(TAG, "exhaust_first_vol;%d", (uint8_t) system_setting.exhaust_first_vol); mm_set_param(CID_AIR_EXHAUST_FIRST_VOL, (uint8_t *)&system_setting.exhaust_first_vol); vTaskDelay(pdTICKS_TO_MS(100)); mm_set_param(CID_AIR_EXHAUST_SECOND_VOL, (uint8_t *)&system_setting.exhaust_second_vol); vTaskDelay(pdTICKS_TO_MS(100)); mm_set_param(CID_AIR_EXHAUST_THIRD_VOL, (uint8_t *)&system_setting.exhaust_third_vol); vTaskDelay(pdTICKS_TO_MS(100)); mm_set_param(CID_AIR_EXHAUST_FOURTH_VOL, (uint8_t *)&system_setting.exhaust_fourth_vol); vTaskDelay(pdTICKS_TO_MS(100)); mm_set_param(CID_AIR_EXHAUST_FIFTH_VOL, (uint8_t *)&system_setting.exhaust_fifth_vol); vTaskDelay(pdTICKS_TO_MS(100)); mm_set_param(CID_AIR_SUPPLY_FIRST_VOL, (uint8_t *)&system_setting.supply_first_vol); vTaskDelay(pdTICKS_TO_MS(100)); mm_set_param(CID_AIR_SUPPLY_SECOND_VOL, (uint8_t *)&system_setting.supply_second_vol); vTaskDelay(pdTICKS_TO_MS(100)); mm_set_param(CID_AIR_SUPPLY_THIRD_VOL, (uint8_t *)&system_setting.supply_third_vol); vTaskDelay(pdTICKS_TO_MS(100)); mm_set_param(CID_AIR_SUPPLY_FOURTH_VOL, (uint8_t *)&system_setting.supply_fourth_vol); vTaskDelay(pdTICKS_TO_MS(100)); mm_set_param(CID_AIR_SUPPLY_FIFTH_VOL, (uint8_t *)&system_setting.supply_fifth_vol); vTaskDelay(pdTICKS_TO_MS(100)); save_system_setting(&system_setting); } // 设置界面切换顶部tab按钮时的事件 void on_setting_tabview_changed(lv_event_t *e) { // uint32_t index = lv_tabview_get_tab_active(guider_ui.SettingPage_tabview_1); // switch (index) { // case 0: // 参数设置 // break; // case 1: // 网络设置 // //app_wifi_scan(); // break; // case 2: // default: // break; // } } // ///** // * 高级配置-五恒模块选中事件 // * @param e // */ //void on_set_five_const_module(lv_event_t *e) { // lv_obj_t *cont = (lv_obj_t *) lv_event_get_current_target(e); // lv_obj_t *act_cb = lv_event_get_target(e); // if (act_cb == cont) return; // lv_obj_add_state(act_cb, LV_STATE_CHECKED); // uint32_t count = lv_obj_get_child_count(cont); // // 遍历所有子控件 // for (int i = 0; i < count; i++) { // lv_obj_t *child = lv_obj_get_child(cont, i); // if (child != act_cb) { // lv_obj_remove_state(child, LV_STATE_CHECKED); // } // } // // TODO:修改本地配置 //} // ///** // * 高级配置-设备风阀与分控对应关系 // * @param e // * @param valve_index // */ //void on_set_fan_valve(lv_event_t *e, uint8_t valve_index) { // lv_obj_t *cont = (lv_obj_t *) lv_event_get_current_target(e); // lv_obj_t *act_cb = lv_event_get_target(e); // if (act_cb == cont) return; // lv_obj_add_state(act_cb, LV_STATE_CHECKED); // uint32_t count = lv_obj_get_child_count(cont); // // 遍历所有子控件 // for (int i = 0; i < count; i++) { // lv_obj_t *child = lv_obj_get_child(cont, i); // if (child != act_cb) { // lv_obj_remove_state(child, LV_STATE_CHECKED); // } // } // // TODO: 修改风阀对应配置 //} /** * 高级配置-恢复出厂设置按钮事件 * @param e */ void on_reset_factory_setting(lv_event_t *e) { // 清空nvs nvs_flash_erase(); // 重启设备 esp_restart(); } // //void on_ac_page_arc_value_changed(lv_event_t *e) { // lv_obj_t *arc = lv_event_get_current_target(e); // int32_t value = lv_arc_get_value(arc); // lvgl_port_lock(0); // lv_label_set_text_fmt(guider_ui.ACPage_lab_ac_temp, "%d", (uint16_t) value); // lvgl_port_unlock(); //} // //void on_ac_page_arc_released(lv_event_t *e) { // lv_obj_t *arc = lv_event_get_current_target(e); // int32_t value = lv_arc_get_value(arc); // ac_status.set_temp = (uint16_t) value; // ac_set_temp(true); //} // //void on_set_inner_addr(uint8_t num) { // if (num) // addr += 1; // else // addr -= 1; // if (addr + num > 255) // addr = 254; // if (addr + num < 1) // addr = 1; // lvgl_port_lock(0); // lv_label_set_text_fmt(guider_ui.FactorySettingPage_lab_inner_addr, "%d", addr); // lvgl_port_unlock(); // // 保存到 nvs // save_inner_addr(addr); //} // void on_set_xf_mode(lv_event_t *e) { lv_obj_t *cont = (lv_obj_t *) lv_event_get_current_target(e); lv_obj_t *act_cb = lv_event_get_target(e); if (act_cb == cont) return; lvgl_port_lock(-1); lv_obj_add_state(act_cb, LV_STATE_CHECKED); uint32_t count = lv_obj_get_child_count(cont); // 遍历所有子控件 for (int i = 0; i < count; i++) { lv_obj_t *child = lv_obj_get_child(cont, i); if (child != act_cb) { lv_obj_remove_state(child, LV_STATE_CHECKED); } } lvgl_port_unlock(); if (act_cb == guider_ui.screen_main_imgbtn_nxh) { xf_status.mode = NXH; } else if (act_cb == guider_ui.screen_main_imgbtn_js) { xf_status.mode = JS; } else if (act_cb == guider_ui.screen_main_imgbtn_xf) { xf_status.mode = XF; } else if (act_cb == guider_ui.screen_main_imgbtn_auto) xf_status.mode = AUTO; xf_set_mode(true); } // //void on_set_ac_wind_speed(lv_event_t *e) { // lv_obj_t *slider = (lv_obj_t *) lv_event_get_current_target(e); // int32_t value = lv_slider_get_value(slider); // // 设置风速文本 // lvgl_port_lock(0); // lv_label_set_text_static(guider_ui.ACPage_lab_fan_speed, speed_str[value - 1]); // lvgl_port_unlock(); //} // //void on_ac_set_fan_speed_released(lv_event_t *e) { // lv_obj_t *slider = (lv_obj_t *) lv_event_get_current_target(e); // int32_t value = lv_slider_get_value(slider); // ac_status.wind_speed = (uint16_t) value; // ac_set_wind_speed(true); //} // //void on_fan_valve_value_changed(lv_event_t *e) { // uint8_t *valve_index = lv_event_get_user_data(e); // lv_obj_t *slider = (lv_obj_t *) lv_event_get_current_target(e); // int32_t value = lv_slider_get_value(slider); // ac_set_fan_valve(*valve_index, value); // ESP_LOGD(TAG, "on_fan_valve_value_changed:%d", *valve_index); //} // //void on_set_fan_valve_no_changed(lv_event_t *e) { // fan_valve_set_param_t *param = lv_event_get_user_data(e); // ESP_LOGD(TAG, "%d-%d", param->ctrl_no, param->fan_valve_no); // lv_obj_t *obj = lv_event_get_current_target(e); // uint8_t v = lv_obj_has_state(obj, LV_STATE_CHECKED) ? 1 : 0; // save_fan_valve_setting(&system_setting, param->ctrl_no, param->fan_valve_no - 1, v); //} // //void on_ac_page_set_power(lv_event_t *e) { // lv_obj_t *obj = lv_event_get_current_target(e); // if (lv_obj_has_state(obj, LV_STATE_CHECKED)) { // ac_status.power = 1; // } else { // ac_status.power = 0; // } // ac_set_power(false); //} // void on_set_beep_on_off(lv_event_t * e) { lv_obj_t *obj = lv_event_get_current_target(e); if (lv_obj_has_state(obj, LV_STATE_CHECKED)) { system_setting.sound_on_off = 1; } else { system_setting.sound_on_off = 0; } save_system_setting(&system_setting); } void on_set_screen_auto_off(lv_event_t * e) { lv_obj_t *obj = lv_event_get_current_target(e); if (lv_obj_has_state(obj, LV_STATE_CHECKED)) { system_setting.screen_auto_off = 1; } else { system_setting.screen_auto_off = 0; } save_system_setting(&system_setting); } void on_set_beep_volume(lv_event_t* e) { const lv_obj_t *slider = lv_event_get_current_target(e); uint32_t value = lv_slider_get_value(slider); ESP_LOGD(TAG, "on_set_beep_volume;%d", (uint8_t) value); system_setting.sound_volume = (uint8_t) value; save_system_setting(&system_setting); } void on_set_screen_off_minute(lv_event_t * e) { lv_obj_t *spbox = lv_event_get_current_target(e); int32_t value = lv_spinbox_get_value(spbox); ESP_LOGD(TAG, "on_set_screen_off_minute;%d", (uint8_t) value); system_setting.screen_off_minute = (uint8_t) value; save_system_setting(&system_setting); } void setting_page_init(lv_ui *ui) { static lv_style_t style_SettingPage_tabview_1_extra_btnm_items_default; ui_init_style(&style_SettingPage_tabview_1_extra_btnm_items_default); lv_style_set_text_color(&style_SettingPage_tabview_1_extra_btnm_items_default, lv_color_hex(0xffb204)); lv_style_set_text_font(&style_SettingPage_tabview_1_extra_btnm_items_default, &lv_font_Alibaba_PuHuiTi_Medium_16); lv_style_set_text_opa(&style_SettingPage_tabview_1_extra_btnm_items_default, 255); lv_obj_add_style(lv_tabview_get_tab_bar(ui->SettingPage_tabview_1), &style_SettingPage_tabview_1_extra_btnm_items_default, LV_PART_MAIN | LV_STATE_DEFAULT); lv_label_set_text(ui->SettingPage_lab_wifi_status, get_wifi_status() == 1 ? "已连接" : "未连接"); // 填充“关于”页面信息 esp_app_desc_t * desc = esp_app_get_description(); lv_label_set_text(ui->SettingPage_lab_version, desc->version); char device_serial[12]; get_device_serial(device_serial); lv_qrcode_update(ui->SettingPage_qr_device_code, device_serial, 12); } void on_ota_failed_restart(lv_event_t *e) { esp_restart(); } void on_reset_wifi(lv_event_t *e) { yx_data_clear(NVS_SSID_KEY); yx_data_clear(NVS_PASSWORD_KEY); esp_restart(); } void on_restart_device(lv_event_t *e) { esp_restart(); }