/* * Copyright 2025 NXP * NXP Confidential and Proprietary. This software is owned or controlled by NXP and may only be used strictly in * accordance with the applicable license terms. By expressly accepting such terms or by downloading, installing, * activating and/or otherwise using the software, you are agreeing that you have read, and that you agree to * comply with and are bound by, such license terms. If you do not agree to be bound by the applicable license * terms, then you may not retain, install, activate or otherwise use the software. */ #include "lvgl.h" #include #include "gui_guider.h" #include "events_init.h" #include "widgets_init.h" #include "custom.h" void del_sub_device_obj(lv_ui *ui) {//场景开关 // if(ui->device_gangcont) // { // lv_obj_del(ui->device_gangcont); // ui->device_gangcont=NULL; // } // //调光灯 // if(ui->device_lightstripcont) // { // lv_obj_del(ui->device_lightstripcont); // ui->device_lightstripcont=NULL; // } // if(ui->device_curtaincont) // { // lv_obj_del(ui->device_curtaincont); // ui->device_curtaincont=NULL; // } // } /** * @brief 创建场景开关 * * @param parent 父类 * @param x x坐标 * @param y y坐标 * @param w w坐标 * @param h h坐标 */ //0:1路场景开关 void create_device_gang1(lv_ui *ui,lv_obj_t * parent, lv_coord_t x, lv_coord_t y,lv_coord_t w, lv_coord_t h) { if(!parent) { return; } //Write codes device_gang1cont ui->device_gang1cont = lv_obj_create(parent); lv_obj_set_pos(ui->device_gang1cont, x, y); lv_obj_set_size(ui->device_gang1cont, w, h); //Write style state: LV_STATE_DEFAULT for style_device_gang1cont_main_main_default static lv_style_t style_device_gang1cont_main_main_default; lv_style_reset(&style_device_gang1cont_main_main_default); lv_style_set_radius(&style_device_gang1cont_main_main_default, 15); lv_style_set_bg_color(&style_device_gang1cont_main_main_default, lv_color_make(0x25, 0x25, 0x25)); lv_style_set_bg_grad_color(&style_device_gang1cont_main_main_default, lv_color_make(0x25, 0x25, 0x25)); lv_style_set_bg_grad_dir(&style_device_gang1cont_main_main_default, LV_GRAD_DIR_VER); lv_style_set_bg_opa(&style_device_gang1cont_main_main_default, 255); lv_style_set_border_color(&style_device_gang1cont_main_main_default, lv_color_make(0xff, 0xff, 0xff)); lv_style_set_border_width(&style_device_gang1cont_main_main_default, 0); lv_style_set_border_opa(&style_device_gang1cont_main_main_default, 0); lv_style_set_pad_left(&style_device_gang1cont_main_main_default, 0); lv_style_set_pad_right(&style_device_gang1cont_main_main_default, 0); lv_style_set_pad_top(&style_device_gang1cont_main_main_default, 0); lv_style_set_pad_bottom(&style_device_gang1cont_main_main_default, 0); lv_obj_add_style(ui->device_gang1cont, &style_device_gang1cont_main_main_default, LV_PART_MAIN|LV_STATE_DEFAULT); //Write codes device_gang1img ui->device_gang1img = lv_img_create(ui->device_gang1cont); lv_obj_set_pos(ui->device_gang1img, 18, 12); lv_obj_set_size(ui->device_gang1img, 54, 54); //Write style state: LV_STATE_DEFAULT for style_device_gang1img_main_main_default static lv_style_t style_device_gang1img_main_main_default; lv_style_reset(&style_device_gang1img_main_main_default); lv_style_set_img_recolor(&style_device_gang1img_main_main_default, lv_color_make(0xff, 0xff, 0xff)); lv_style_set_img_recolor_opa(&style_device_gang1img_main_main_default, 0); lv_style_set_img_opa(&style_device_gang1img_main_main_default, 255); lv_obj_add_style(ui->device_gang1img, &style_device_gang1img_main_main_default, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_add_flag(ui->device_gang1img, LV_OBJ_FLAG_CLICKABLE); lv_img_set_src(ui->device_gang1img,LVGL_PATH(lightonbg.png)); lv_img_set_pivot(ui->device_gang1img, 0,0); lv_img_set_angle(ui->device_gang1img, 0); //Write codes device_gang1icon_img ui->device_gang1icon_img = lv_img_create(ui->device_gang1cont); lv_obj_set_pos(ui->device_gang1icon_img, 31, 24); lv_obj_set_size(ui->device_gang1icon_img, 30, 30); //Write style state: LV_STATE_DEFAULT for style_device_gang1icon_img_main_main_default static lv_style_t style_device_gang1icon_img_main_main_default; lv_style_reset(&style_device_gang1icon_img_main_main_default); lv_style_set_img_recolor(&style_device_gang1icon_img_main_main_default, lv_color_make(0xff, 0xff, 0xff)); lv_style_set_img_recolor_opa(&style_device_gang1icon_img_main_main_default, 0); lv_style_set_img_opa(&style_device_gang1icon_img_main_main_default, 255); lv_obj_add_style(ui->device_gang1icon_img, &style_device_gang1icon_img_main_main_default, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_add_flag(ui->device_gang1icon_img, LV_OBJ_FLAG_CLICKABLE); lv_img_set_src(ui->device_gang1icon_img,LVGL_PATH(devgangicon.png)); lv_img_set_pivot(ui->device_gang1icon_img, 0,0); lv_img_set_angle(ui->device_gang1icon_img, 0); //Write codes device_gang1btn_1 ui->device_gang1btn_1 = lv_btn_create(ui->device_gang1cont); lv_obj_set_pos(ui->device_gang1btn_1, 20, 13); lv_obj_set_size(ui->device_gang1btn_1, 52, 52); //Write style state: LV_STATE_DEFAULT for style_device_gang1btn_1_main_main_default static lv_style_t style_device_gang1btn_1_main_main_default; lv_style_reset(&style_device_gang1btn_1_main_main_default); lv_style_set_radius(&style_device_gang1btn_1_main_main_default, 0); lv_style_set_bg_color(&style_device_gang1btn_1_main_main_default, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_bg_grad_color(&style_device_gang1btn_1_main_main_default, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_bg_grad_dir(&style_device_gang1btn_1_main_main_default, LV_GRAD_DIR_VER); lv_style_set_bg_opa(&style_device_gang1btn_1_main_main_default, 0); lv_style_set_shadow_color(&style_device_gang1btn_1_main_main_default, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_shadow_opa(&style_device_gang1btn_1_main_main_default, 0); lv_style_set_border_color(&style_device_gang1btn_1_main_main_default, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_border_width(&style_device_gang1btn_1_main_main_default, 0); lv_style_set_border_opa(&style_device_gang1btn_1_main_main_default, 0); lv_obj_add_style(ui->device_gang1btn_1, &style_device_gang1btn_1_main_main_default, LV_PART_MAIN|LV_STATE_DEFAULT); ui->device_gang1btn_1_label = lv_label_create(ui->device_gang1btn_1); lv_label_set_text(ui->device_gang1btn_1_label, ""); lv_obj_set_style_text_color(ui->device_gang1btn_1_label, lv_color_make(0x00, 0x00, 0x00), LV_STATE_DEFAULT); lv_obj_set_style_pad_all(ui->device_gang1btn_1, 0, LV_STATE_DEFAULT); lv_obj_align(ui->device_gang1btn_1_label, LV_ALIGN_CENTER, 0, 0); //Write codes device_gang1label_1 ui->device_gang1label_1 = lv_label_create(ui->device_gang1cont); lv_obj_set_pos(ui->device_gang1label_1, 90, 29); lv_obj_set_size(ui->device_gang1label_1, 200, 24); //lv_label_set_text(ui->device_gang1label_1, "Scene 1 Gang switch"); lv_label_set_text(ui->device_gang1label_1,Menu_List[GET_nvs_Sys_Info_language()][MENU_LIST_GANG1_NAME]); lv_label_set_long_mode(ui->device_gang1label_1, LV_LABEL_LONG_DOT); lv_obj_set_style_text_align(ui->device_gang1label_1, LV_TEXT_ALIGN_LEFT, 0); //Write style state: LV_STATE_DEFAULT for style_device_gang1label_1_main_main_default static lv_style_t style_device_gang1label_1_main_main_default; lv_style_reset(&style_device_gang1label_1_main_main_default); lv_style_set_radius(&style_device_gang1label_1_main_main_default, 0); lv_style_set_bg_color(&style_device_gang1label_1_main_main_default, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_bg_grad_color(&style_device_gang1label_1_main_main_default, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_bg_grad_dir(&style_device_gang1label_1_main_main_default, LV_GRAD_DIR_VER); lv_style_set_bg_opa(&style_device_gang1label_1_main_main_default, 0); lv_style_set_text_color(&style_device_gang1label_1_main_main_default, lv_color_make(0xff, 0xff, 0xff)); lv_style_set_text_font(&style_device_gang1label_1_main_main_default, &lv_font_simsun_16); lv_style_set_text_letter_space(&style_device_gang1label_1_main_main_default, 0); lv_style_set_pad_left(&style_device_gang1label_1_main_main_default, 0); lv_style_set_pad_right(&style_device_gang1label_1_main_main_default, 0); lv_style_set_pad_top(&style_device_gang1label_1_main_main_default, 0); lv_style_set_pad_bottom(&style_device_gang1label_1_main_main_default, 0); lv_obj_add_style(ui->device_gang1label_1, &style_device_gang1label_1_main_main_default, LV_PART_MAIN|LV_STATE_DEFAULT); //Write codes device_gang1imgbtn_1 ui->device_gang1imgbtn_1 = lv_switch_create(ui->device_gang1cont); lv_obj_set_pos(ui->device_gang1imgbtn_1, 361, 26); lv_obj_set_size(ui->device_gang1imgbtn_1, 60, 28); //if( GET_nvs_Sys_Info_Gangrelay1()&&GET_nvs_Sys_Info_Gangrelay2() &&GET_nvs_Sys_Info_Gangrelay3() &&GET_nvs_Sys_Info_Gangrelay4()) if( GET_nvs_Sys_Info_Gang1relay1() ) //gang1是1路 { lv_obj_add_state(ui->device_gang1imgbtn_1, LV_STATE_CHECKED);//on } else { lv_obj_clear_state(ui->device_gang1imgbtn_1, LV_STATE_CHECKED);//off } //Write style state: LV_STATE_DEFAULT for style_device_gang1imgbtn_1_main_main_default static lv_style_t style_device_gang1imgbtn_1_main_main_default; lv_style_reset(&style_device_gang1imgbtn_1_main_main_default); lv_style_set_radius(&style_device_gang1imgbtn_1_main_main_default, 100); lv_style_set_bg_color(&style_device_gang1imgbtn_1_main_main_default, lv_color_make(0xaa, 0xaa, 0xaa)); lv_style_set_bg_grad_color(&style_device_gang1imgbtn_1_main_main_default, lv_color_make(0xaa, 0xaa, 0xaa)); lv_style_set_bg_grad_dir(&style_device_gang1imgbtn_1_main_main_default, LV_GRAD_DIR_VER); lv_style_set_bg_opa(&style_device_gang1imgbtn_1_main_main_default, 46); lv_obj_add_style(ui->device_gang1imgbtn_1, &style_device_gang1imgbtn_1_main_main_default, LV_PART_MAIN|LV_STATE_DEFAULT); //Write style state: LV_STATE_CHECKED for style_device_gang1imgbtn_1_main_indicator_checked static lv_style_t style_device_gang1imgbtn_1_main_indicator_checked; lv_style_reset(&style_device_gang1imgbtn_1_main_indicator_checked); lv_style_set_radius(&style_device_gang1imgbtn_1_main_indicator_checked, 100); lv_style_set_bg_color(&style_device_gang1imgbtn_1_main_indicator_checked, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_bg_grad_color(&style_device_gang1imgbtn_1_main_indicator_checked, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_bg_grad_dir(&style_device_gang1imgbtn_1_main_indicator_checked, LV_GRAD_DIR_VER); lv_style_set_bg_opa(&style_device_gang1imgbtn_1_main_indicator_checked, 255); lv_obj_add_style(ui->device_gang1imgbtn_1, &style_device_gang1imgbtn_1_main_indicator_checked, LV_PART_INDICATOR|LV_STATE_CHECKED); //Write style state: LV_STATE_DEFAULT for style_device_gang1imgbtn_1_main_knob_default static lv_style_t style_device_gang1imgbtn_1_main_knob_default; lv_style_reset(&style_device_gang1imgbtn_1_main_knob_default); lv_style_set_radius(&style_device_gang1imgbtn_1_main_knob_default, 100); lv_style_set_bg_color(&style_device_gang1imgbtn_1_main_knob_default, lv_color_make(0xff, 0xff, 0xff)); lv_style_set_bg_grad_color(&style_device_gang1imgbtn_1_main_knob_default, lv_color_make(0xff, 0xff, 0xff)); lv_style_set_bg_grad_dir(&style_device_gang1imgbtn_1_main_knob_default, LV_GRAD_DIR_VER); lv_style_set_bg_opa(&style_device_gang1imgbtn_1_main_knob_default, 255); lv_obj_add_style(ui->device_gang1imgbtn_1, &style_device_gang1imgbtn_1_main_knob_default, LV_PART_KNOB|LV_STATE_DEFAULT); #ifdef CONFIG_OBJICT_IMAGE//背景有图标改用直接生成 节省存储 //Write codes device_gang1swbgimg_1 ui->device_gang1swbgimg_1 = lv_obj_create(ui->device_gang1cont); lv_obj_set_pos(ui->device_gang1swbgimg_1, 203, 83); lv_obj_set_size(ui->device_gang1swbgimg_1, 54, 54); //Write style state: LV_STATE_DEFAULT for style_device_gang1swbgimg_1_main_main_default lv_obj_set_style_radius(ui->device_gang1swbgimg_1, 30, LV_PART_MAIN|LV_STATE_DEFAULT); //lv_obj_set_style_bg_color(ui->device_gang1swbgimg_1, lv_color_make(0xeb, 0x95, 0x0f), LV_PART_MAIN|LV_STATE_DEFAULT); //lv_obj_set_style_bg_grad_color(ui->device_gang1swbgimg_1, lv_color_make(0xef, 0x95, 0x0f), LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_grad_dir(ui->device_gang1swbgimg_1, LV_GRAD_DIR_VER, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_opa(ui->device_gang1swbgimg_1, 255, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_border_color(ui->device_gang1swbgimg_1, lv_color_make(0xeb, 0x95, 0x0f), LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_border_width(ui->device_gang1swbgimg_1, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_border_opa(ui->device_gang1swbgimg_1, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_left(ui->device_gang1swbgimg_1, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_right(ui->device_gang1swbgimg_1, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_top(ui->device_gang1swbgimg_1, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_bottom(ui->device_gang1swbgimg_1, 0, LV_PART_MAIN|LV_STATE_DEFAULT); if(GET_nvs_Sys_Info_Gang1relay1()) { lv_obj_set_style_bg_color(ui->device_gang1swbgimg_1,lv_color_make(0xeb, 0x95, 0x0f), LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_grad_color(ui->device_gang1swbgimg_1, lv_color_make(0xef, 0x95, 0x0f), LV_PART_MAIN|LV_STATE_DEFAULT); } else { lv_obj_set_style_bg_color(ui->device_gang1swbgimg_1,lv_color_make(0xb2, 0xb2, 0xb2), LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_grad_color(ui->device_gang1swbgimg_1, lv_color_make(0xb2, 0xb2, 0xb2), LV_PART_MAIN|LV_STATE_DEFAULT); } #else //Write codes device_gang1swbgimg_1 ui->device_gang1swbgimg_1 = lv_img_create(ui->device_gang1cont); lv_obj_set_pos(ui->device_gang1swbgimg_1, 203, 83); lv_obj_set_size(ui->device_gang1swbgimg_1, 54, 54); //Write style state: LV_STATE_DEFAULT for style_device_gang1swbgimg_1_main_main_default static lv_style_t style_device_gang1swbgimg_1_main_main_default; lv_style_reset(&style_device_gang1swbgimg_1_main_main_default); lv_style_set_img_recolor(&style_device_gang1swbgimg_1_main_main_default, lv_color_make(0xff, 0xff, 0xff)); lv_style_set_img_recolor_opa(&style_device_gang1swbgimg_1_main_main_default, 0); lv_style_set_img_opa(&style_device_gang1swbgimg_1_main_main_default, 255); lv_obj_add_style(ui->device_gang1swbgimg_1, &style_device_gang1swbgimg_1_main_main_default, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_add_flag(ui->device_gang1swbgimg_1, LV_OBJ_FLAG_CLICKABLE); lv_img_set_src(ui->device_gang1swbgimg_1,LVGL_PATH(lightonbg.png)); lv_img_set_pivot(ui->device_gang1swbgimg_1, 0,0); lv_img_set_angle(ui->device_gang1swbgimg_1, 0); #endif //Write codes device_gang1swiconimg_1 ui->device_gang1swiconimg_1 = lv_img_create(ui->device_gang1cont); lv_obj_set_pos(ui->device_gang1swiconimg_1, 215, 95); lv_obj_set_size(ui->device_gang1swiconimg_1, 32, 32); //Write style state: LV_STATE_DEFAULT for style_device_gang1swiconimg_1_main_main_default static lv_style_t style_device_gang1swiconimg_1_main_main_default; lv_style_reset(&style_device_gang1swiconimg_1_main_main_default); lv_style_set_img_recolor(&style_device_gang1swiconimg_1_main_main_default, lv_color_make(0xff, 0xff, 0xff)); lv_style_set_img_recolor_opa(&style_device_gang1swiconimg_1_main_main_default, 0); lv_style_set_img_opa(&style_device_gang1swiconimg_1_main_main_default, 255); lv_obj_add_style(ui->device_gang1swiconimg_1, &style_device_gang1swiconimg_1_main_main_default, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_add_flag(ui->device_gang1swiconimg_1, LV_OBJ_FLAG_CLICKABLE); //lv_img_set_src(ui->device_gang1swiconimg_1,LVGL_PATH(onofflightoff7.png)); if(GET_nvs_Sys_Info_Gang11icon()) { lv_img_set_src(ui->device_gang1swiconimg_1,onoff_keyligthimgon_ary[GET_nvs_Sys_Info_Gang11icon()]);//修改指定的icon } else { lv_img_set_src(ui->device_gang1swiconimg_1,LVGL_PATH(onofflighton7.png));//默认icon } lv_img_set_pivot(ui->device_gang1swiconimg_1, 0,0); lv_img_set_angle(ui->device_gang1swiconimg_1, 0); //Write codes device_gang1swlabel_1 ui->device_gang1swlabel_1 = lv_label_create(ui->device_gang1cont); lv_obj_set_pos(ui->device_gang1swlabel_1, 164, 140); lv_obj_set_size(ui->device_gang1swlabel_1, 140, 24); //lv_label_set_text(ui->device_gang1swlabel_1, "Chandelier"); if( strlen((const char*)nvs_Sys_Info_SysInfo.gang1_sw1.Label) )//用户自己设置的文字(自由设置 不分语言) { lv_label_set_text_fmt(ui->device_gang1swlabel_1, "%s",nvs_Sys_Info_SysInfo.gang1_sw1.Label); } else { lv_label_set_text(ui->device_gang1swlabel_1,Menu_List[GET_nvs_Sys_Info_language()][MENU_LIST_GANG11]); } lv_label_set_long_mode(ui->device_gang1swlabel_1, LV_LABEL_LONG_DOT); lv_obj_set_style_text_align(ui->device_gang1swlabel_1, LV_TEXT_ALIGN_CENTER, 0); //Write style state: LV_STATE_DEFAULT for style_device_gang1swlabel_1_main_main_default static lv_style_t style_device_gang1swlabel_1_main_main_default; lv_style_reset(&style_device_gang1swlabel_1_main_main_default); lv_style_set_radius(&style_device_gang1swlabel_1_main_main_default, 0); lv_style_set_bg_color(&style_device_gang1swlabel_1_main_main_default, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_bg_grad_color(&style_device_gang1swlabel_1_main_main_default, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_bg_grad_dir(&style_device_gang1swlabel_1_main_main_default, LV_GRAD_DIR_VER); lv_style_set_bg_opa(&style_device_gang1swlabel_1_main_main_default, 0); lv_style_set_text_color(&style_device_gang1swlabel_1_main_main_default, lv_color_make(0xff, 0xff, 0xff)); lv_style_set_text_font(&style_device_gang1swlabel_1_main_main_default, &lv_font_simsun_16); lv_style_set_text_letter_space(&style_device_gang1swlabel_1_main_main_default, 0); lv_style_set_pad_left(&style_device_gang1swlabel_1_main_main_default, 0); lv_style_set_pad_right(&style_device_gang1swlabel_1_main_main_default, 0); lv_style_set_pad_top(&style_device_gang1swlabel_1_main_main_default, 0); lv_style_set_pad_bottom(&style_device_gang1swlabel_1_main_main_default, 0); lv_obj_add_style(ui->device_gang1swlabel_1, &style_device_gang1swlabel_1_main_main_default, LV_PART_MAIN|LV_STATE_DEFAULT); //Write codes device_gang1swbtn_1 ui->device_gang1swbtn_1 = lv_btn_create(ui->device_gang1cont); lv_obj_set_pos(ui->device_gang1swbtn_1, 203, 83); lv_obj_set_size(ui->device_gang1swbtn_1, 54, 54); //Write style state: LV_STATE_DEFAULT for style_device_gang1swbtn_1_main_main_default static lv_style_t style_device_gang1swbtn_1_main_main_default; lv_style_reset(&style_device_gang1swbtn_1_main_main_default); lv_style_set_radius(&style_device_gang1swbtn_1_main_main_default, 0); lv_style_set_bg_color(&style_device_gang1swbtn_1_main_main_default, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_bg_grad_color(&style_device_gang1swbtn_1_main_main_default, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_bg_grad_dir(&style_device_gang1swbtn_1_main_main_default, LV_GRAD_DIR_VER); lv_style_set_bg_opa(&style_device_gang1swbtn_1_main_main_default, 0); lv_style_set_shadow_color(&style_device_gang1swbtn_1_main_main_default, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_shadow_opa(&style_device_gang1swbtn_1_main_main_default, 0); lv_style_set_border_color(&style_device_gang1swbtn_1_main_main_default, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_border_width(&style_device_gang1swbtn_1_main_main_default, 0); lv_style_set_border_opa(&style_device_gang1swbtn_1_main_main_default, 0); lv_obj_add_style(ui->device_gang1swbtn_1, &style_device_gang1swbtn_1_main_main_default, LV_PART_MAIN|LV_STATE_DEFAULT); ui->device_gang1swbtn_1_label = lv_label_create(ui->device_gang1swbtn_1); lv_label_set_text(ui->device_gang1swbtn_1_label, ""); lv_obj_set_style_text_color(ui->device_gang1swbtn_1_label, lv_color_make(0x00, 0x00, 0x00), LV_STATE_DEFAULT); lv_obj_set_style_pad_all(ui->device_gang1swbtn_1, 0, LV_STATE_DEFAULT); lv_obj_align(ui->device_gang1swbtn_1_label, LV_ALIGN_CENTER, 0, 0); // //Init events for screen events_init_device_gang1(ui); } //1:2路场景开关 void create_device_gang2(lv_ui *ui,lv_obj_t * parent, lv_coord_t x, lv_coord_t y,lv_coord_t w, lv_coord_t h) { if(!parent) { return; } //Write codes device_gang2cont ui->device_gang2cont = lv_obj_create(parent); lv_obj_set_pos(ui->device_gang2cont, x, y); lv_obj_set_size(ui->device_gang2cont, w, h); //Write style state: LV_STATE_DEFAULT for style_device_gang2cont_main_main_default static lv_style_t style_device_gang2cont_main_main_default; lv_style_reset(&style_device_gang2cont_main_main_default); lv_style_set_radius(&style_device_gang2cont_main_main_default, 15); lv_style_set_bg_color(&style_device_gang2cont_main_main_default, lv_color_make(0x25, 0x25, 0x25)); lv_style_set_bg_grad_color(&style_device_gang2cont_main_main_default, lv_color_make(0x25, 0x25, 0x25)); lv_style_set_bg_grad_dir(&style_device_gang2cont_main_main_default, LV_GRAD_DIR_VER); lv_style_set_bg_opa(&style_device_gang2cont_main_main_default, 255); lv_style_set_border_color(&style_device_gang2cont_main_main_default, lv_color_make(0xff, 0xff, 0xff)); lv_style_set_border_width(&style_device_gang2cont_main_main_default, 0); lv_style_set_border_opa(&style_device_gang2cont_main_main_default, 0); lv_style_set_pad_left(&style_device_gang2cont_main_main_default, 0); lv_style_set_pad_right(&style_device_gang2cont_main_main_default, 0); lv_style_set_pad_top(&style_device_gang2cont_main_main_default, 0); lv_style_set_pad_bottom(&style_device_gang2cont_main_main_default, 0); lv_obj_add_style(ui->device_gang2cont, &style_device_gang2cont_main_main_default, LV_PART_MAIN|LV_STATE_DEFAULT); //Write codes device_gang2img ui->device_gang2img = lv_img_create(ui->device_gang2cont); lv_obj_set_pos(ui->device_gang2img, 18, 12); lv_obj_set_size(ui->device_gang2img, 54, 54); //Write style state: LV_STATE_DEFAULT for style_device_gang2img_main_main_default static lv_style_t style_device_gang2img_main_main_default; lv_style_reset(&style_device_gang2img_main_main_default); lv_style_set_img_recolor(&style_device_gang2img_main_main_default, lv_color_make(0xff, 0xff, 0xff)); lv_style_set_img_recolor_opa(&style_device_gang2img_main_main_default, 0); lv_style_set_img_opa(&style_device_gang2img_main_main_default, 255); lv_obj_add_style(ui->device_gang2img, &style_device_gang2img_main_main_default, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_add_flag(ui->device_gang2img, LV_OBJ_FLAG_CLICKABLE); lv_img_set_src(ui->device_gang2img,LVGL_PATH(lightonbg.png)); lv_img_set_pivot(ui->device_gang2img, 0,0); lv_img_set_angle(ui->device_gang2img, 0); //Write codes device_gang2icon_img ui->device_gang2icon_img = lv_img_create(ui->device_gang2cont); lv_obj_set_pos(ui->device_gang2icon_img, 31, 24); lv_obj_set_size(ui->device_gang2icon_img, 30, 30); //Write style state: LV_STATE_DEFAULT for style_device_gang2icon_img_main_main_default static lv_style_t style_device_gang2icon_img_main_main_default; lv_style_reset(&style_device_gang2icon_img_main_main_default); lv_style_set_img_recolor(&style_device_gang2icon_img_main_main_default, lv_color_make(0xff, 0xff, 0xff)); lv_style_set_img_recolor_opa(&style_device_gang2icon_img_main_main_default, 0); lv_style_set_img_opa(&style_device_gang2icon_img_main_main_default, 255); lv_obj_add_style(ui->device_gang2icon_img, &style_device_gang2icon_img_main_main_default, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_add_flag(ui->device_gang2icon_img, LV_OBJ_FLAG_CLICKABLE); lv_img_set_src(ui->device_gang2icon_img,LVGL_PATH(devgangicon.png)); lv_img_set_pivot(ui->device_gang2icon_img, 0,0); lv_img_set_angle(ui->device_gang2icon_img, 0); //Write codes device_gang2btn_1 ui->device_gang2btn_1 = lv_btn_create(ui->device_gang2cont); lv_obj_set_pos(ui->device_gang2btn_1, 20, 13); lv_obj_set_size(ui->device_gang2btn_1, 52, 52); //Write style state: LV_STATE_DEFAULT for style_device_gang2btn_1_main_main_default static lv_style_t style_device_gang2btn_1_main_main_default; lv_style_reset(&style_device_gang2btn_1_main_main_default); lv_style_set_radius(&style_device_gang2btn_1_main_main_default, 0); lv_style_set_bg_color(&style_device_gang2btn_1_main_main_default, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_bg_grad_color(&style_device_gang2btn_1_main_main_default, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_bg_grad_dir(&style_device_gang2btn_1_main_main_default, LV_GRAD_DIR_VER); lv_style_set_bg_opa(&style_device_gang2btn_1_main_main_default, 0); lv_style_set_shadow_color(&style_device_gang2btn_1_main_main_default, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_shadow_opa(&style_device_gang2btn_1_main_main_default, 0); lv_style_set_border_color(&style_device_gang2btn_1_main_main_default, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_border_width(&style_device_gang2btn_1_main_main_default, 0); lv_style_set_border_opa(&style_device_gang2btn_1_main_main_default, 0); lv_obj_add_style(ui->device_gang2btn_1, &style_device_gang2btn_1_main_main_default, LV_PART_MAIN|LV_STATE_DEFAULT); ui->device_gang2btn_1_label = lv_label_create(ui->device_gang2btn_1); lv_label_set_text(ui->device_gang2btn_1_label, ""); lv_obj_set_style_text_color(ui->device_gang2btn_1_label, lv_color_make(0x00, 0x00, 0x00), LV_STATE_DEFAULT); lv_obj_set_style_pad_all(ui->device_gang2btn_1, 0, LV_STATE_DEFAULT); lv_obj_align(ui->device_gang2btn_1_label, LV_ALIGN_CENTER, 0, 0); //Write codes device_gang2label_1 ui->device_gang2label_1 = lv_label_create(ui->device_gang2cont); lv_obj_set_pos(ui->device_gang2label_1, 90, 29); lv_obj_set_size(ui->device_gang2label_1, 200, 24); //lv_label_set_text(ui->device_gang2label_1, "Scene 2 Gang switch"); lv_label_set_text(ui->device_gang2label_1,Menu_List[GET_nvs_Sys_Info_language()][MENU_LIST_GANG2_NAME]); lv_label_set_long_mode(ui->device_gang2label_1, LV_LABEL_LONG_DOT); lv_obj_set_style_text_align(ui->device_gang2label_1, LV_TEXT_ALIGN_LEFT, 0); //Write style state: LV_STATE_DEFAULT for style_device_gang2label_1_main_main_default static lv_style_t style_device_gang2label_1_main_main_default; lv_style_reset(&style_device_gang2label_1_main_main_default); lv_style_set_radius(&style_device_gang2label_1_main_main_default, 0); lv_style_set_bg_color(&style_device_gang2label_1_main_main_default, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_bg_grad_color(&style_device_gang2label_1_main_main_default, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_bg_grad_dir(&style_device_gang2label_1_main_main_default, LV_GRAD_DIR_VER); lv_style_set_bg_opa(&style_device_gang2label_1_main_main_default, 0); lv_style_set_text_color(&style_device_gang2label_1_main_main_default, lv_color_make(0xff, 0xff, 0xff)); lv_style_set_text_font(&style_device_gang2label_1_main_main_default, &lv_font_simsun_16); lv_style_set_text_letter_space(&style_device_gang2label_1_main_main_default, 0); lv_style_set_pad_left(&style_device_gang2label_1_main_main_default, 0); lv_style_set_pad_right(&style_device_gang2label_1_main_main_default, 0); lv_style_set_pad_top(&style_device_gang2label_1_main_main_default, 0); lv_style_set_pad_bottom(&style_device_gang2label_1_main_main_default, 0); lv_obj_add_style(ui->device_gang2label_1, &style_device_gang2label_1_main_main_default, LV_PART_MAIN|LV_STATE_DEFAULT); //Write codes device_gang2imgbtn_1 ui->device_gang2imgbtn_1 = lv_switch_create(ui->device_gang2cont); lv_obj_set_pos(ui->device_gang2imgbtn_1, 361, 26); lv_obj_set_size(ui->device_gang2imgbtn_1, 60, 28); if( GET_nvs_Sys_Info_Gang2relay1()&&GET_nvs_Sys_Info_Gang2relay2() ) { lv_obj_add_state(ui->device_gang2imgbtn_1, LV_STATE_CHECKED);//on } else { lv_obj_clear_state(ui->device_gang2imgbtn_1, LV_STATE_CHECKED);//off } //Write style state: LV_STATE_DEFAULT for style_device_gang2imgbtn_1_main_main_default static lv_style_t style_device_gang2imgbtn_1_main_main_default; lv_style_reset(&style_device_gang2imgbtn_1_main_main_default); lv_style_set_radius(&style_device_gang2imgbtn_1_main_main_default, 100); lv_style_set_bg_color(&style_device_gang2imgbtn_1_main_main_default, lv_color_make(0xaa, 0xaa, 0xaa)); lv_style_set_bg_grad_color(&style_device_gang2imgbtn_1_main_main_default, lv_color_make(0xaa, 0xaa, 0xaa)); lv_style_set_bg_grad_dir(&style_device_gang2imgbtn_1_main_main_default, LV_GRAD_DIR_VER); lv_style_set_bg_opa(&style_device_gang2imgbtn_1_main_main_default, 46); lv_obj_add_style(ui->device_gang2imgbtn_1, &style_device_gang2imgbtn_1_main_main_default, LV_PART_MAIN|LV_STATE_DEFAULT); //Write style state: LV_STATE_CHECKED for style_device_gang2imgbtn_1_main_indicator_checked static lv_style_t style_device_gang2imgbtn_1_main_indicator_checked; lv_style_reset(&style_device_gang2imgbtn_1_main_indicator_checked); lv_style_set_radius(&style_device_gang2imgbtn_1_main_indicator_checked, 100); lv_style_set_bg_color(&style_device_gang2imgbtn_1_main_indicator_checked, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_bg_grad_color(&style_device_gang2imgbtn_1_main_indicator_checked, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_bg_grad_dir(&style_device_gang2imgbtn_1_main_indicator_checked, LV_GRAD_DIR_VER); lv_style_set_bg_opa(&style_device_gang2imgbtn_1_main_indicator_checked, 255); lv_obj_add_style(ui->device_gang2imgbtn_1, &style_device_gang2imgbtn_1_main_indicator_checked, LV_PART_INDICATOR|LV_STATE_CHECKED); //Write style state: LV_STATE_DEFAULT for style_device_gang2imgbtn_1_main_knob_default static lv_style_t style_device_gang2imgbtn_1_main_knob_default; lv_style_reset(&style_device_gang2imgbtn_1_main_knob_default); lv_style_set_radius(&style_device_gang2imgbtn_1_main_knob_default, 100); lv_style_set_bg_color(&style_device_gang2imgbtn_1_main_knob_default, lv_color_make(0xff, 0xff, 0xff)); lv_style_set_bg_grad_color(&style_device_gang2imgbtn_1_main_knob_default, lv_color_make(0xff, 0xff, 0xff)); lv_style_set_bg_grad_dir(&style_device_gang2imgbtn_1_main_knob_default, LV_GRAD_DIR_VER); lv_style_set_bg_opa(&style_device_gang2imgbtn_1_main_knob_default, 255); lv_obj_add_style(ui->device_gang2imgbtn_1, &style_device_gang2imgbtn_1_main_knob_default, LV_PART_KNOB|LV_STATE_DEFAULT); #ifdef CONFIG_OBJICT_IMAGE //Write codes device_gang2swbgimg_1 ui->device_gang2swbgimg_1 = lv_obj_create(ui->device_gang2cont); lv_obj_set_pos(ui->device_gang2swbgimg_1, 110, 83); lv_obj_set_size(ui->device_gang2swbgimg_1, 54, 54); lv_obj_set_style_radius(ui->device_gang2swbgimg_1, 30, LV_PART_MAIN|LV_STATE_DEFAULT); //lv_obj_set_style_bg_color(ui->device_gang2swbgimg_1, lv_color_make(0xeb, 0x95, 0x0f), LV_PART_MAIN|LV_STATE_DEFAULT); //lv_obj_set_style_bg_grad_color(ui->device_gang2swbgimg_1, lv_color_make(0xef, 0x95, 0x0f), LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_grad_dir(ui->device_gang2swbgimg_1, LV_GRAD_DIR_VER, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_opa(ui->device_gang2swbgimg_1, 255, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_border_color(ui->device_gang2swbgimg_1, lv_color_make(0xeb, 0x95, 0x0f), LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_border_width(ui->device_gang2swbgimg_1, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_border_opa(ui->device_gang2swbgimg_1, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_left(ui->device_gang2swbgimg_1, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_right(ui->device_gang2swbgimg_1, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_top(ui->device_gang2swbgimg_1, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_bottom(ui->device_gang2swbgimg_1, 0, LV_PART_MAIN|LV_STATE_DEFAULT); if(GET_nvs_Sys_Info_Gang2relay1()) { lv_obj_set_style_bg_color(ui->device_gang2swbgimg_1,lv_color_make(0xeb, 0x95, 0x0f), LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_grad_color(ui->device_gang2swbgimg_1, lv_color_make(0xef, 0x95, 0x0f), LV_PART_MAIN|LV_STATE_DEFAULT); } else { lv_obj_set_style_bg_color(ui->device_gang2swbgimg_1,lv_color_make(0xb2, 0xb2, 0xb2), LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_grad_color(ui->device_gang2swbgimg_1, lv_color_make(0xb2, 0xb2, 0xb2), LV_PART_MAIN|LV_STATE_DEFAULT); } #else //Write codes device_gang2swbgimg_1 ui->device_gang2swbgimg_1 = lv_img_create(ui->device_gang2cont); lv_obj_set_pos(ui->device_gang2swbgimg_1, 110, 83); lv_obj_set_size(ui->device_gang2swbgimg_1, 54, 54); //Write style state: LV_STATE_DEFAULT for style_device_gang2swbgimg_1_main_main_default static lv_style_t style_device_gang2swbgimg_1_main_main_default; lv_style_reset(&style_device_gang2swbgimg_1_main_main_default); lv_style_set_img_recolor(&style_device_gang2swbgimg_1_main_main_default, lv_color_make(0xff, 0xff, 0xff)); lv_style_set_img_recolor_opa(&style_device_gang2swbgimg_1_main_main_default, 0); lv_style_set_img_opa(&style_device_gang2swbgimg_1_main_main_default, 255); lv_obj_add_style(ui->device_gang2swbgimg_1, &style_device_gang2swbgimg_1_main_main_default, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_add_flag(ui->device_gang2swbgimg_1, LV_OBJ_FLAG_CLICKABLE); lv_img_set_src(ui->device_gang2swbgimg_1,LVGL_PATH(lightonbg.png)); lv_img_set_pivot(ui->device_gang2swbgimg_1, 0,0); lv_img_set_angle(ui->device_gang2swbgimg_1, 0); #endif //Write codes device_gang2swiconimg_1 ui->device_gang2swiconimg_1 = lv_img_create(ui->device_gang2cont); lv_obj_set_pos(ui->device_gang2swiconimg_1, 122, 94); lv_obj_set_size(ui->device_gang2swiconimg_1, 32, 32); //Write style state: LV_STATE_DEFAULT for style_device_gang2swiconimg_1_main_main_default static lv_style_t style_device_gang2swiconimg_1_main_main_default; lv_style_reset(&style_device_gang2swiconimg_1_main_main_default); lv_style_set_img_recolor(&style_device_gang2swiconimg_1_main_main_default, lv_color_make(0xff, 0xff, 0xff)); lv_style_set_img_recolor_opa(&style_device_gang2swiconimg_1_main_main_default, 0); lv_style_set_img_opa(&style_device_gang2swiconimg_1_main_main_default, 255); lv_obj_add_style(ui->device_gang2swiconimg_1, &style_device_gang2swiconimg_1_main_main_default, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_add_flag(ui->device_gang2swiconimg_1, LV_OBJ_FLAG_CLICKABLE); //lv_img_set_src(ui->device_gang2swiconimg_1,LVGL_PATH(iconLightstrip.png)); if(GET_nvs_Sys_Info_Gang21icon()) { lv_img_set_src(ui->device_gang2swiconimg_1,onoff_keyligthimgon_ary[GET_nvs_Sys_Info_Gang21icon()]); } else { lv_img_set_src(ui->device_gang2swiconimg_1,LVGL_PATH(onofflighton7.png));//icon } lv_img_set_pivot(ui->device_gang2swiconimg_1, 0,0); lv_img_set_angle(ui->device_gang2swiconimg_1, 0); //Write codes device_gang2swbtn_1 ui->device_gang2swbtn_1 = lv_btn_create(ui->device_gang2cont); lv_obj_set_pos(ui->device_gang2swbtn_1, 110, 83); lv_obj_set_size(ui->device_gang2swbtn_1, 54, 54); //Write style state: LV_STATE_DEFAULT for style_device_gang2swbtn_1_main_main_default static lv_style_t style_device_gang2swbtn_1_main_main_default; lv_style_reset(&style_device_gang2swbtn_1_main_main_default); lv_style_set_radius(&style_device_gang2swbtn_1_main_main_default, 0); lv_style_set_bg_color(&style_device_gang2swbtn_1_main_main_default, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_bg_grad_color(&style_device_gang2swbtn_1_main_main_default, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_bg_grad_dir(&style_device_gang2swbtn_1_main_main_default, LV_GRAD_DIR_VER); lv_style_set_bg_opa(&style_device_gang2swbtn_1_main_main_default, 0); lv_style_set_shadow_color(&style_device_gang2swbtn_1_main_main_default, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_shadow_opa(&style_device_gang2swbtn_1_main_main_default, 0); lv_style_set_border_color(&style_device_gang2swbtn_1_main_main_default, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_border_width(&style_device_gang2swbtn_1_main_main_default, 0); lv_style_set_border_opa(&style_device_gang2swbtn_1_main_main_default, 0); lv_obj_add_style(ui->device_gang2swbtn_1, &style_device_gang2swbtn_1_main_main_default, LV_PART_MAIN|LV_STATE_DEFAULT); ui->device_gang2swbtn_1_label = lv_label_create(ui->device_gang2swbtn_1); lv_label_set_text(ui->device_gang2swbtn_1_label, ""); lv_obj_set_style_text_color(ui->device_gang2swbtn_1_label, lv_color_make(0x00, 0x00, 0x00), LV_STATE_DEFAULT); lv_obj_set_style_pad_all(ui->device_gang2swbtn_1, 0, LV_STATE_DEFAULT); lv_obj_align(ui->device_gang2swbtn_1_label, LV_ALIGN_CENTER, 0, 0); //Write codes device_gang2swlabel_1 ui->device_gang2swlabel_1 = lv_label_create(ui->device_gang2cont); lv_obj_set_pos(ui->device_gang2swlabel_1, 66, 140); lv_obj_set_size(ui->device_gang2swlabel_1, 140, 20); // lv_label_set_text(ui->device_gang2swlabel_1, "Chandelier"); if( strlen((const char*)nvs_Sys_Info_SysInfo.gang2_sw1.Label) )//用户自己设置的文字(自由设置 不分语言) { lv_label_set_text_fmt(ui->device_gang2swlabel_1, "%s",nvs_Sys_Info_SysInfo.gang2_sw1.Label); } else { lv_label_set_text(ui->device_gang2swlabel_1,Menu_List[GET_nvs_Sys_Info_language()][MENU_LIST_GANG21]); } lv_label_set_long_mode(ui->device_gang2swlabel_1, LV_LABEL_LONG_DOT); lv_obj_set_style_text_align(ui->device_gang2swlabel_1, LV_TEXT_ALIGN_CENTER, 0); //Write style state: LV_STATE_DEFAULT for style_device_gang2swlabel_1_main_main_default static lv_style_t style_device_gang2swlabel_1_main_main_default; lv_style_reset(&style_device_gang2swlabel_1_main_main_default); lv_style_set_radius(&style_device_gang2swlabel_1_main_main_default, 0); lv_style_set_bg_color(&style_device_gang2swlabel_1_main_main_default, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_bg_grad_color(&style_device_gang2swlabel_1_main_main_default, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_bg_grad_dir(&style_device_gang2swlabel_1_main_main_default, LV_GRAD_DIR_VER); lv_style_set_bg_opa(&style_device_gang2swlabel_1_main_main_default, 0); lv_style_set_text_color(&style_device_gang2swlabel_1_main_main_default, lv_color_make(0xff, 0xff, 0xff)); lv_style_set_text_font(&style_device_gang2swlabel_1_main_main_default, &lv_font_simsun_16); lv_style_set_text_letter_space(&style_device_gang2swlabel_1_main_main_default, 0); lv_style_set_pad_left(&style_device_gang2swlabel_1_main_main_default, 0); lv_style_set_pad_right(&style_device_gang2swlabel_1_main_main_default, 0); lv_style_set_pad_top(&style_device_gang2swlabel_1_main_main_default, 0); lv_style_set_pad_bottom(&style_device_gang2swlabel_1_main_main_default, 0); lv_obj_add_style(ui->device_gang2swlabel_1, &style_device_gang2swlabel_1_main_main_default, LV_PART_MAIN|LV_STATE_DEFAULT); #ifdef CONFIG_OBJICT_IMAGE //Write codes device_gang2swbgimg_2 ui->device_gang2swbgimg_2 = lv_obj_create(ui->device_gang2cont); lv_obj_set_pos(ui->device_gang2swbgimg_2, 273, 83); lv_obj_set_size(ui->device_gang2swbgimg_2, 54, 54); lv_obj_set_style_radius(ui->device_gang2swbgimg_2, 30, LV_PART_MAIN|LV_STATE_DEFAULT); //lv_obj_set_style_bg_color(ui->device_gang2swbgimg_2, lv_color_make(0xeb, 0x95, 0x0f), LV_PART_MAIN|LV_STATE_DEFAULT); //lv_obj_set_style_bg_grad_color(ui->device_gang2swbgimg_2, lv_color_make(0xef, 0x95, 0x0f), LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_grad_dir(ui->device_gang2swbgimg_2, LV_GRAD_DIR_VER, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_opa(ui->device_gang2swbgimg_2, 255, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_border_color(ui->device_gang2swbgimg_2, lv_color_make(0xeb, 0x95, 0x0f), LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_border_width(ui->device_gang2swbgimg_2, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_border_opa(ui->device_gang2swbgimg_2, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_left(ui->device_gang2swbgimg_2, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_right(ui->device_gang2swbgimg_2, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_top(ui->device_gang2swbgimg_2, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_bottom(ui->device_gang2swbgimg_2, 0, LV_PART_MAIN|LV_STATE_DEFAULT); if(GET_nvs_Sys_Info_Gang2relay2()) { lv_obj_set_style_bg_color(ui->device_gang2swbgimg_2,lv_color_make(0xeb, 0x95, 0x0f), LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_grad_color(ui->device_gang2swbgimg_2, lv_color_make(0xef, 0x95, 0x0f), LV_PART_MAIN|LV_STATE_DEFAULT); } else { lv_obj_set_style_bg_color(ui->device_gang2swbgimg_2,lv_color_make(0xb2, 0xb2, 0xb2), LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_grad_color(ui->device_gang2swbgimg_2, lv_color_make(0xb2, 0xb2, 0xb2), LV_PART_MAIN|LV_STATE_DEFAULT); } #else //Write codes device_gang2swbgimg_2 ui->device_gang2swbgimg_2 = lv_img_create(ui->device_gang2cont); lv_obj_set_pos(ui->device_gang2swbgimg_2, 273, 83); lv_obj_set_size(ui->device_gang2swbgimg_2, 54, 54); //Write style state: LV_STATE_DEFAULT for style_device_gang2swbgimg_2_main_main_default static lv_style_t style_device_gang2swbgimg_2_main_main_default; lv_style_reset(&style_device_gang2swbgimg_2_main_main_default); lv_style_set_img_recolor(&style_device_gang2swbgimg_2_main_main_default, lv_color_make(0xff, 0xff, 0xff)); lv_style_set_img_recolor_opa(&style_device_gang2swbgimg_2_main_main_default, 0); lv_style_set_img_opa(&style_device_gang2swbgimg_2_main_main_default, 255); lv_obj_add_style(ui->device_gang2swbgimg_2, &style_device_gang2swbgimg_2_main_main_default, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_add_flag(ui->device_gang2swbgimg_2, LV_OBJ_FLAG_CLICKABLE); lv_img_set_src(ui->device_gang2swbgimg_2,LVGL_PATH(lightonbg.png)); lv_img_set_pivot(ui->device_gang2swbgimg_2, 0,0); lv_img_set_angle(ui->device_gang2swbgimg_2, 0); #endif //Write codes device_gang2swiconimg_2 ui->device_gang2swiconimg_2 = lv_img_create(ui->device_gang2cont); lv_obj_set_pos(ui->device_gang2swiconimg_2, 285, 94); lv_obj_set_size(ui->device_gang2swiconimg_2, 32, 32); //Write style state: LV_STATE_DEFAULT for style_device_gang2swiconimg_2_main_main_default static lv_style_t style_device_gang2swiconimg_2_main_main_default; lv_style_reset(&style_device_gang2swiconimg_2_main_main_default); lv_style_set_img_recolor(&style_device_gang2swiconimg_2_main_main_default, lv_color_make(0xff, 0xff, 0xff)); lv_style_set_img_recolor_opa(&style_device_gang2swiconimg_2_main_main_default, 0); lv_style_set_img_opa(&style_device_gang2swiconimg_2_main_main_default, 255); lv_obj_add_style(ui->device_gang2swiconimg_2, &style_device_gang2swiconimg_2_main_main_default, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_add_flag(ui->device_gang2swiconimg_2, LV_OBJ_FLAG_CLICKABLE); //lv_img_set_src(ui->device_gang2swiconimg_2,LVGL_PATH(onofflightoff10.png)); if(GET_nvs_Sys_Info_Gang22icon()) { lv_img_set_src(ui->device_gang2swiconimg_2,onoff_keyligthimgon_ary[GET_nvs_Sys_Info_Gang22icon()]); } else { lv_img_set_src(ui->device_gang2swiconimg_2,LVGL_PATH(onofflighton2.png));//icon } lv_img_set_pivot(ui->device_gang2swiconimg_2, 0,0); lv_img_set_angle(ui->device_gang2swiconimg_2, 0); //Write codes device_gang2swbtn_2 ui->device_gang2swbtn_2 = lv_btn_create(ui->device_gang2cont); lv_obj_set_pos(ui->device_gang2swbtn_2, 273, 83); lv_obj_set_size(ui->device_gang2swbtn_2, 54, 54); //Write style state: LV_STATE_DEFAULT for style_device_gang2swbtn_2_main_main_default static lv_style_t style_device_gang2swbtn_2_main_main_default; lv_style_reset(&style_device_gang2swbtn_2_main_main_default); lv_style_set_radius(&style_device_gang2swbtn_2_main_main_default, 0); lv_style_set_bg_color(&style_device_gang2swbtn_2_main_main_default, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_bg_grad_color(&style_device_gang2swbtn_2_main_main_default, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_bg_grad_dir(&style_device_gang2swbtn_2_main_main_default, LV_GRAD_DIR_VER); lv_style_set_bg_opa(&style_device_gang2swbtn_2_main_main_default, 0); lv_style_set_shadow_color(&style_device_gang2swbtn_2_main_main_default, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_shadow_opa(&style_device_gang2swbtn_2_main_main_default, 0); lv_style_set_border_color(&style_device_gang2swbtn_2_main_main_default, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_border_width(&style_device_gang2swbtn_2_main_main_default, 0); lv_style_set_border_opa(&style_device_gang2swbtn_2_main_main_default, 0); lv_obj_add_style(ui->device_gang2swbtn_2, &style_device_gang2swbtn_2_main_main_default, LV_PART_MAIN|LV_STATE_DEFAULT); ui->device_gang2swbtn_2_label = lv_label_create(ui->device_gang2swbtn_2); lv_label_set_text(ui->device_gang2swbtn_2_label, ""); lv_obj_set_style_text_color(ui->device_gang2swbtn_2_label, lv_color_make(0x00, 0x00, 0x00), LV_STATE_DEFAULT); lv_obj_set_style_pad_all(ui->device_gang2swbtn_2, 0, LV_STATE_DEFAULT); lv_obj_align(ui->device_gang2swbtn_2_label, LV_ALIGN_CENTER, 0, 0); //Write codes device_gang2swlabel_2 ui->device_gang2swlabel_2 = lv_label_create(ui->device_gang2cont); lv_obj_set_pos(ui->device_gang2swlabel_2, 230, 140); lv_obj_set_size(ui->device_gang2swlabel_2, 140, 20); // lv_label_set_text(ui->device_gang2swlabel_2, "Downlight"); lv_label_set_long_mode(ui->device_gang2swlabel_2, LV_LABEL_LONG_DOT); if( strlen((const char*)nvs_Sys_Info_SysInfo.gang2_sw2.Label) )//用户自己设置的文字(自由设置 不分语言) { lv_label_set_text_fmt(ui->device_gang2swlabel_2, "%s",nvs_Sys_Info_SysInfo.gang2_sw2.Label); } else { lv_label_set_text(ui->device_gang2swlabel_2,Menu_List[GET_nvs_Sys_Info_language()][MENU_LIST_GANG22]); } lv_obj_set_style_text_align(ui->device_gang2swlabel_2, LV_TEXT_ALIGN_CENTER, 0); //Write style state: LV_STATE_DEFAULT for style_device_gang2swlabel_2_main_main_default static lv_style_t style_device_gang2swlabel_2_main_main_default; lv_style_reset(&style_device_gang2swlabel_2_main_main_default); lv_style_set_radius(&style_device_gang2swlabel_2_main_main_default, 0); lv_style_set_bg_color(&style_device_gang2swlabel_2_main_main_default, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_bg_grad_color(&style_device_gang2swlabel_2_main_main_default, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_bg_grad_dir(&style_device_gang2swlabel_2_main_main_default, LV_GRAD_DIR_VER); lv_style_set_bg_opa(&style_device_gang2swlabel_2_main_main_default, 0); lv_style_set_text_color(&style_device_gang2swlabel_2_main_main_default, lv_color_make(0xff, 0xff, 0xff)); lv_style_set_text_font(&style_device_gang2swlabel_2_main_main_default, &lv_font_simsun_16); lv_style_set_text_letter_space(&style_device_gang2swlabel_2_main_main_default, 0); lv_style_set_pad_left(&style_device_gang2swlabel_2_main_main_default, 0); lv_style_set_pad_right(&style_device_gang2swlabel_2_main_main_default, 0); lv_style_set_pad_top(&style_device_gang2swlabel_2_main_main_default, 0); lv_style_set_pad_bottom(&style_device_gang2swlabel_2_main_main_default, 0); lv_obj_add_style(ui->device_gang2swlabel_2, &style_device_gang2swlabel_2_main_main_default, LV_PART_MAIN|LV_STATE_DEFAULT); //Init events for screen events_init_device_gang2(ui); } //场景开关3路 void create_device_gang3(lv_ui *ui,lv_obj_t * parent, lv_coord_t x, lv_coord_t y,lv_coord_t w, lv_coord_t h) { if(!parent) { return; } //Write codes device_gang3cont ui->device_gang3cont = lv_obj_create(parent); lv_obj_set_pos(ui->device_gang3cont, x, y); lv_obj_set_size(ui->device_gang3cont, w, h); //Write style state: LV_STATE_DEFAULT for style_device_gang3cont_main_main_default static lv_style_t style_device_gang3cont_main_main_default; lv_style_reset(&style_device_gang3cont_main_main_default); lv_style_set_radius(&style_device_gang3cont_main_main_default, 15); lv_style_set_bg_color(&style_device_gang3cont_main_main_default, lv_color_make(0x25, 0x25, 0x25)); lv_style_set_bg_grad_color(&style_device_gang3cont_main_main_default, lv_color_make(0x25, 0x25, 0x25)); lv_style_set_bg_grad_dir(&style_device_gang3cont_main_main_default, LV_GRAD_DIR_VER); lv_style_set_bg_opa(&style_device_gang3cont_main_main_default, 255); lv_style_set_border_color(&style_device_gang3cont_main_main_default, lv_color_make(0xff, 0xff, 0xff)); lv_style_set_border_width(&style_device_gang3cont_main_main_default, 0); lv_style_set_border_opa(&style_device_gang3cont_main_main_default, 0); lv_style_set_pad_left(&style_device_gang3cont_main_main_default, 0); lv_style_set_pad_right(&style_device_gang3cont_main_main_default, 0); lv_style_set_pad_top(&style_device_gang3cont_main_main_default, 0); lv_style_set_pad_bottom(&style_device_gang3cont_main_main_default, 0); lv_obj_add_style(ui->device_gang3cont, &style_device_gang3cont_main_main_default, LV_PART_MAIN|LV_STATE_DEFAULT); //Write codes device_gang3img ui->device_gang3img = lv_img_create(ui->device_gang3cont); lv_obj_set_pos(ui->device_gang3img, 19, 13); lv_obj_set_size(ui->device_gang3img, 54, 54); //Write style state: LV_STATE_DEFAULT for style_device_gang3img_main_main_default static lv_style_t style_device_gang3img_main_main_default; lv_style_reset(&style_device_gang3img_main_main_default); lv_style_set_img_recolor(&style_device_gang3img_main_main_default, lv_color_make(0xff, 0xff, 0xff)); lv_style_set_img_recolor_opa(&style_device_gang3img_main_main_default, 0); lv_style_set_img_opa(&style_device_gang3img_main_main_default, 255); lv_obj_add_style(ui->device_gang3img, &style_device_gang3img_main_main_default, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_add_flag(ui->device_gang3img, LV_OBJ_FLAG_CLICKABLE); lv_img_set_src(ui->device_gang3img,LVGL_PATH(lightonbg.png)); lv_img_set_pivot(ui->device_gang3img, 0,0); lv_img_set_angle(ui->device_gang3img, 0); //Write codes device_gang3icon_img ui->device_gang3icon_img = lv_img_create(ui->device_gang3cont); lv_obj_set_pos(ui->device_gang3icon_img, 32, 25); lv_obj_set_size(ui->device_gang3icon_img, 30, 30); //Write style state: LV_STATE_DEFAULT for style_device_gang3icon_img_main_main_default static lv_style_t style_device_gang3icon_img_main_main_default; lv_style_reset(&style_device_gang3icon_img_main_main_default); lv_style_set_img_recolor(&style_device_gang3icon_img_main_main_default, lv_color_make(0xff, 0xff, 0xff)); lv_style_set_img_recolor_opa(&style_device_gang3icon_img_main_main_default, 0); lv_style_set_img_opa(&style_device_gang3icon_img_main_main_default, 255); lv_obj_add_style(ui->device_gang3icon_img, &style_device_gang3icon_img_main_main_default, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_add_flag(ui->device_gang3icon_img, LV_OBJ_FLAG_CLICKABLE); lv_img_set_src(ui->device_gang3icon_img,LVGL_PATH(devgangicon.png)); lv_img_set_pivot(ui->device_gang3icon_img, 0,0); lv_img_set_angle(ui->device_gang3icon_img, 0); //Write codes device_gang3btn_1 ui->device_gang3btn_1 = lv_btn_create(ui->device_gang3cont); lv_obj_set_pos(ui->device_gang3btn_1, 21, 14); lv_obj_set_size(ui->device_gang3btn_1, 52, 52); //Write style state: LV_STATE_DEFAULT for style_device_gang3btn_1_main_main_default static lv_style_t style_device_gang3btn_1_main_main_default; lv_style_reset(&style_device_gang3btn_1_main_main_default); lv_style_set_radius(&style_device_gang3btn_1_main_main_default, 0); lv_style_set_bg_color(&style_device_gang3btn_1_main_main_default, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_bg_grad_color(&style_device_gang3btn_1_main_main_default, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_bg_grad_dir(&style_device_gang3btn_1_main_main_default, LV_GRAD_DIR_VER); lv_style_set_bg_opa(&style_device_gang3btn_1_main_main_default, 0); lv_style_set_shadow_color(&style_device_gang3btn_1_main_main_default, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_shadow_opa(&style_device_gang3btn_1_main_main_default, 0); lv_style_set_border_color(&style_device_gang3btn_1_main_main_default, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_border_width(&style_device_gang3btn_1_main_main_default, 0); lv_style_set_border_opa(&style_device_gang3btn_1_main_main_default, 0); lv_obj_add_style(ui->device_gang3btn_1, &style_device_gang3btn_1_main_main_default, LV_PART_MAIN|LV_STATE_DEFAULT); ui->device_gang3btn_1_label = lv_label_create(ui->device_gang3btn_1); // lv_label_set_text(ui->device_gang3btn_1_label, ""); // lv_obj_set_style_text_color(ui->device_gang3btn_1_label, lv_color_make(0x00, 0x00, 0x00), LV_STATE_DEFAULT); // lv_obj_set_style_pad_all(ui->device_gang3btn_1, 0, LV_STATE_DEFAULT); // lv_obj_align(ui->device_gang3btn_1_label, LV_ALIGN_CENTER, 0, 0); //Write codes device_gang3label_1 ui->device_gang3label_1 = lv_label_create(ui->device_gang3cont); lv_obj_set_pos(ui->device_gang3label_1, 91, 30); lv_obj_set_size(ui->device_gang3label_1, 200, 24); //lv_label_set_text(ui->device_gang3label_1, "Scene 3 Gang switch"); lv_label_set_text(ui->device_gang3label_1,Menu_List[GET_nvs_Sys_Info_language()][MENU_LIST_GANG3_NAME]); lv_label_set_long_mode(ui->device_gang3label_1, LV_LABEL_LONG_DOT); lv_obj_set_style_text_align(ui->device_gang3label_1, LV_TEXT_ALIGN_LEFT, 0); //Write style state: LV_STATE_DEFAULT for style_device_gang3label_1_main_main_default static lv_style_t style_device_gang3label_1_main_main_default; lv_style_reset(&style_device_gang3label_1_main_main_default); lv_style_set_radius(&style_device_gang3label_1_main_main_default, 0); lv_style_set_bg_color(&style_device_gang3label_1_main_main_default, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_bg_grad_color(&style_device_gang3label_1_main_main_default, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_bg_grad_dir(&style_device_gang3label_1_main_main_default, LV_GRAD_DIR_VER); lv_style_set_bg_opa(&style_device_gang3label_1_main_main_default, 0); lv_style_set_text_color(&style_device_gang3label_1_main_main_default, lv_color_make(0xff, 0xff, 0xff)); lv_style_set_text_font(&style_device_gang3label_1_main_main_default, &lv_font_simsun_16); lv_style_set_text_letter_space(&style_device_gang3label_1_main_main_default, 0); lv_style_set_pad_left(&style_device_gang3label_1_main_main_default, 0); lv_style_set_pad_right(&style_device_gang3label_1_main_main_default, 0); lv_style_set_pad_top(&style_device_gang3label_1_main_main_default, 0); lv_style_set_pad_bottom(&style_device_gang3label_1_main_main_default, 0); lv_obj_add_style(ui->device_gang3label_1, &style_device_gang3label_1_main_main_default, LV_PART_MAIN|LV_STATE_DEFAULT); //Write codes device_gang3imgbtn_1 ui->device_gang3imgbtn_1 = lv_switch_create(ui->device_gang3cont); lv_obj_set_pos(ui->device_gang3imgbtn_1, 362, 27); lv_obj_set_size(ui->device_gang3imgbtn_1, 60, 28); if( GET_nvs_Sys_Info_Gang3relay1()&&GET_nvs_Sys_Info_Gang3relay2() &&GET_nvs_Sys_Info_Gang3relay3() ) { lv_obj_add_state(ui->device_gang3imgbtn_1, LV_STATE_CHECKED);//on } else { lv_obj_clear_state(ui->device_gang3imgbtn_1, LV_STATE_CHECKED);//off } //Write style state: LV_STATE_DEFAULT for style_device_gang3imgbtn_1_main_main_default static lv_style_t style_device_gang3imgbtn_1_main_main_default; lv_style_reset(&style_device_gang3imgbtn_1_main_main_default); lv_style_set_radius(&style_device_gang3imgbtn_1_main_main_default, 100); lv_style_set_bg_color(&style_device_gang3imgbtn_1_main_main_default, lv_color_make(0xaa, 0xaa, 0xaa)); lv_style_set_bg_grad_color(&style_device_gang3imgbtn_1_main_main_default, lv_color_make(0xaa, 0xaa, 0xaa)); lv_style_set_bg_grad_dir(&style_device_gang3imgbtn_1_main_main_default, LV_GRAD_DIR_VER); lv_style_set_bg_opa(&style_device_gang3imgbtn_1_main_main_default, 46); lv_obj_add_style(ui->device_gang3imgbtn_1, &style_device_gang3imgbtn_1_main_main_default, LV_PART_MAIN|LV_STATE_DEFAULT); //Write style state: LV_STATE_CHECKED for style_device_gang3imgbtn_1_main_indicator_checked static lv_style_t style_device_gang3imgbtn_1_main_indicator_checked; lv_style_reset(&style_device_gang3imgbtn_1_main_indicator_checked); lv_style_set_radius(&style_device_gang3imgbtn_1_main_indicator_checked, 100); lv_style_set_bg_color(&style_device_gang3imgbtn_1_main_indicator_checked, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_bg_grad_color(&style_device_gang3imgbtn_1_main_indicator_checked, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_bg_grad_dir(&style_device_gang3imgbtn_1_main_indicator_checked, LV_GRAD_DIR_VER); lv_style_set_bg_opa(&style_device_gang3imgbtn_1_main_indicator_checked, 255); lv_obj_add_style(ui->device_gang3imgbtn_1, &style_device_gang3imgbtn_1_main_indicator_checked, LV_PART_INDICATOR|LV_STATE_CHECKED); //Write style state: LV_STATE_DEFAULT for style_device_gang3imgbtn_1_main_knob_default static lv_style_t style_device_gang3imgbtn_1_main_knob_default; lv_style_reset(&style_device_gang3imgbtn_1_main_knob_default); lv_style_set_radius(&style_device_gang3imgbtn_1_main_knob_default, 100); lv_style_set_bg_color(&style_device_gang3imgbtn_1_main_knob_default, lv_color_make(0xff, 0xff, 0xff)); lv_style_set_bg_grad_color(&style_device_gang3imgbtn_1_main_knob_default, lv_color_make(0xff, 0xff, 0xff)); lv_style_set_bg_grad_dir(&style_device_gang3imgbtn_1_main_knob_default, LV_GRAD_DIR_VER); lv_style_set_bg_opa(&style_device_gang3imgbtn_1_main_knob_default, 255); lv_obj_add_style(ui->device_gang3imgbtn_1, &style_device_gang3imgbtn_1_main_knob_default, LV_PART_KNOB|LV_STATE_DEFAULT); #ifdef CONFIG_OBJICT_IMAGE //Write codes device_gang3swbgimg_1 ui->device_gang3swbgimg_1 = lv_obj_create(ui->device_gang3cont); lv_obj_set_pos(ui->device_gang3swbgimg_1, 71, 84); lv_obj_set_size(ui->device_gang3swbgimg_1, 54, 54); lv_obj_set_style_radius(ui->device_gang3swbgimg_1, 30, LV_PART_MAIN|LV_STATE_DEFAULT); //lv_obj_set_style_bg_color(ui->device_gang3swbgimg_1, lv_color_make(0xeb, 0x95, 0x0f), LV_PART_MAIN|LV_STATE_DEFAULT); //lv_obj_set_style_bg_grad_color(ui->device_gang3swbgimg_1, lv_color_make(0xef, 0x95, 0x0f), LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_grad_dir(ui->device_gang3swbgimg_1, LV_GRAD_DIR_VER, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_opa(ui->device_gang3swbgimg_1, 255, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_border_color(ui->device_gang3swbgimg_1, lv_color_make(0xeb, 0x95, 0x0f), LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_border_width(ui->device_gang3swbgimg_1, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_border_opa(ui->device_gang3swbgimg_1, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_left(ui->device_gang3swbgimg_1, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_right(ui->device_gang3swbgimg_1, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_top(ui->device_gang3swbgimg_1, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_bottom(ui->device_gang3swbgimg_1, 0, LV_PART_MAIN|LV_STATE_DEFAULT); if(GET_nvs_Sys_Info_Gang3relay1()) { lv_obj_set_style_bg_color(ui->device_gang3swbgimg_1,lv_color_make(0xeb, 0x95, 0x0f), LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_grad_color(ui->device_gang3swbgimg_1, lv_color_make(0xef, 0x95, 0x0f), LV_PART_MAIN|LV_STATE_DEFAULT); } else { lv_obj_set_style_bg_color(ui->device_gang3swbgimg_1,lv_color_make(0xb2, 0xb2, 0xb2), LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_grad_color(ui->device_gang3swbgimg_1, lv_color_make(0xb2, 0xb2, 0xb2), LV_PART_MAIN|LV_STATE_DEFAULT); } #else //Write codes device_gang3swbgimg_1 ui->device_gang3swbgimg_1 = lv_img_create(ui->device_gang3cont); lv_obj_set_pos(ui->device_gang3swbgimg_1, 71, 84); lv_obj_set_size(ui->device_gang3swbgimg_1, 54, 54); //Write style state: LV_STATE_DEFAULT for style_device_gang3swbgimg_1_main_main_default static lv_style_t style_device_gang3swbgimg_1_main_main_default; lv_style_reset(&style_device_gang3swbgimg_1_main_main_default); lv_style_set_img_recolor(&style_device_gang3swbgimg_1_main_main_default, lv_color_make(0xff, 0xff, 0xff)); lv_style_set_img_recolor_opa(&style_device_gang3swbgimg_1_main_main_default, 0); lv_style_set_img_opa(&style_device_gang3swbgimg_1_main_main_default, 255); lv_obj_add_style(ui->device_gang3swbgimg_1, &style_device_gang3swbgimg_1_main_main_default, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_add_flag(ui->device_gang3swbgimg_1, LV_OBJ_FLAG_CLICKABLE); lv_img_set_src(ui->device_gang3swbgimg_1,LVGL_PATH(lightonbg.png)); lv_img_set_pivot(ui->device_gang3swbgimg_1, 0,0); lv_img_set_angle(ui->device_gang3swbgimg_1, 0); #endif //Write codes device_gang3swiconimg_1 ui->device_gang3swiconimg_1 = lv_img_create(ui->device_gang3cont); lv_obj_set_pos(ui->device_gang3swiconimg_1, 83, 96); lv_obj_set_size(ui->device_gang3swiconimg_1, 32, 32); //Write style state: LV_STATE_DEFAULT for style_device_gang3swiconimg_1_main_main_default static lv_style_t style_device_gang3swiconimg_1_main_main_default; lv_style_reset(&style_device_gang3swiconimg_1_main_main_default); lv_style_set_img_recolor(&style_device_gang3swiconimg_1_main_main_default, lv_color_make(0xff, 0xff, 0xff)); lv_style_set_img_recolor_opa(&style_device_gang3swiconimg_1_main_main_default, 0); lv_style_set_img_opa(&style_device_gang3swiconimg_1_main_main_default, 255); lv_obj_add_style(ui->device_gang3swiconimg_1, &style_device_gang3swiconimg_1_main_main_default, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_add_flag(ui->device_gang3swiconimg_1, LV_OBJ_FLAG_CLICKABLE); // lv_img_set_src(ui->device_gang3swiconimg_1,LVGL_PATH(onofflightoff7.png)); if(GET_nvs_Sys_Info_Gang31icon()) { lv_img_set_src(ui->device_gang3swiconimg_1,onoff_keyligthimgon_ary[GET_nvs_Sys_Info_Gang31icon()]); } else { lv_img_set_src(ui->device_gang3swiconimg_1,LVGL_PATH(onofflighton7.png));//icon } lv_img_set_pivot(ui->device_gang3swiconimg_1, 0,0); lv_img_set_angle(ui->device_gang3swiconimg_1, 0); //Write codes device_gang3swbtn_1 ui->device_gang3swbtn_1 = lv_btn_create(ui->device_gang3cont); lv_obj_set_pos(ui->device_gang3swbtn_1, 71, 84); lv_obj_set_size(ui->device_gang3swbtn_1, 54, 54); //Write style state: LV_STATE_DEFAULT for style_device_gang3swbtn_1_main_main_default static lv_style_t style_device_gang3swbtn_1_main_main_default; lv_style_reset(&style_device_gang3swbtn_1_main_main_default); lv_style_set_radius(&style_device_gang3swbtn_1_main_main_default, 0); lv_style_set_bg_color(&style_device_gang3swbtn_1_main_main_default, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_bg_grad_color(&style_device_gang3swbtn_1_main_main_default, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_bg_grad_dir(&style_device_gang3swbtn_1_main_main_default, LV_GRAD_DIR_VER); lv_style_set_bg_opa(&style_device_gang3swbtn_1_main_main_default, 0); lv_style_set_shadow_color(&style_device_gang3swbtn_1_main_main_default, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_shadow_opa(&style_device_gang3swbtn_1_main_main_default, 0); lv_style_set_border_color(&style_device_gang3swbtn_1_main_main_default, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_border_width(&style_device_gang3swbtn_1_main_main_default, 0); lv_style_set_border_opa(&style_device_gang3swbtn_1_main_main_default, 0); lv_obj_add_style(ui->device_gang3swbtn_1, &style_device_gang3swbtn_1_main_main_default, LV_PART_MAIN|LV_STATE_DEFAULT); // ui->device_gang3swbtn_1_label = lv_label_create(ui->device_gang3swbtn_1); // lv_label_set_text(ui->device_gang3swbtn_1_label, ""); // lv_obj_set_style_text_color(ui->device_gang3swbtn_1_label, lv_color_make(0x00, 0x00, 0x00), LV_STATE_DEFAULT); // lv_obj_set_style_pad_all(ui->device_gang3swbtn_1, 0, LV_STATE_DEFAULT); // lv_obj_align(ui->device_gang3swbtn_1_label, LV_ALIGN_CENTER, 0, 0); //Write codes device_gang3swlabel_1 ui->device_gang3swlabel_1 = lv_label_create(ui->device_gang3cont); lv_obj_set_pos(ui->device_gang3swlabel_1, 51, 141); lv_obj_set_size(ui->device_gang3swlabel_1, 120, 24); // lv_label_set_text(ui->device_gang3swlabel_1, "Chandelier"); if( strlen((const char*)nvs_Sys_Info_SysInfo.gang3_sw1.Label) )//用户自己设置的文字(自由设置 不分语言) { lv_label_set_text_fmt(ui->device_gang3swlabel_1, "%s",nvs_Sys_Info_SysInfo.gang3_sw1.Label); } else { lv_label_set_text(ui->device_gang3swlabel_1,Menu_List[GET_nvs_Sys_Info_language()][MENU_LIST_GANG31]); } lv_label_set_long_mode(ui->device_gang3swlabel_1, LV_LABEL_LONG_DOT); lv_obj_set_style_text_align(ui->device_gang3swlabel_1, LV_TEXT_ALIGN_CENTER, 0); //Write style state: LV_STATE_DEFAULT for style_device_gang3swlabel_1_main_main_default static lv_style_t style_device_gang3swlabel_1_main_main_default; lv_style_reset(&style_device_gang3swlabel_1_main_main_default); lv_style_set_radius(&style_device_gang3swlabel_1_main_main_default, 0); lv_style_set_bg_color(&style_device_gang3swlabel_1_main_main_default, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_bg_grad_color(&style_device_gang3swlabel_1_main_main_default, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_bg_grad_dir(&style_device_gang3swlabel_1_main_main_default, LV_GRAD_DIR_VER); lv_style_set_bg_opa(&style_device_gang3swlabel_1_main_main_default, 0); lv_style_set_text_color(&style_device_gang3swlabel_1_main_main_default, lv_color_make(0xff, 0xff, 0xff)); lv_style_set_text_font(&style_device_gang3swlabel_1_main_main_default, &lv_font_simsun_16); lv_style_set_text_letter_space(&style_device_gang3swlabel_1_main_main_default, 0); lv_style_set_pad_left(&style_device_gang3swlabel_1_main_main_default, 0); lv_style_set_pad_right(&style_device_gang3swlabel_1_main_main_default, 0); lv_style_set_pad_top(&style_device_gang3swlabel_1_main_main_default, 0); lv_style_set_pad_bottom(&style_device_gang3swlabel_1_main_main_default, 0); lv_obj_add_style(ui->device_gang3swlabel_1, &style_device_gang3swlabel_1_main_main_default, LV_PART_MAIN|LV_STATE_DEFAULT); #ifdef CONFIG_OBJICT_IMAGE //Write codes device_gang3swbgimg_2 ui->device_gang3swbgimg_2 = lv_obj_create(ui->device_gang3cont); lv_obj_set_pos(ui->device_gang3swbgimg_2, 191, 84); lv_obj_set_size(ui->device_gang3swbgimg_2, 54, 54); lv_obj_set_style_radius(ui->device_gang3swbgimg_2, 30, LV_PART_MAIN|LV_STATE_DEFAULT); //lv_obj_set_style_bg_color(ui->device_gang3swbgimg_2, lv_color_make(0xeb, 0x95, 0x0f), LV_PART_MAIN|LV_STATE_DEFAULT); //lv_obj_set_style_bg_grad_color(ui->device_gang3swbgimg_2, lv_color_make(0xef, 0x95, 0x0f), LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_grad_dir(ui->device_gang3swbgimg_2, LV_GRAD_DIR_VER, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_opa(ui->device_gang3swbgimg_2, 255, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_border_color(ui->device_gang3swbgimg_2, lv_color_make(0xeb, 0x95, 0x0f), LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_border_width(ui->device_gang3swbgimg_2, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_border_opa(ui->device_gang3swbgimg_2, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_left(ui->device_gang3swbgimg_2, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_right(ui->device_gang3swbgimg_2, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_top(ui->device_gang3swbgimg_2, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_bottom(ui->device_gang3swbgimg_2, 0, LV_PART_MAIN|LV_STATE_DEFAULT); if(GET_nvs_Sys_Info_Gang3relay2()) { lv_obj_set_style_bg_color(ui->device_gang3swbgimg_2,lv_color_make(0xeb, 0x95, 0x0f), LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_grad_color(ui->device_gang3swbgimg_2, lv_color_make(0xef, 0x95, 0x0f), LV_PART_MAIN|LV_STATE_DEFAULT); } else { lv_obj_set_style_bg_color(ui->device_gang3swbgimg_2,lv_color_make(0xb2, 0xb2, 0xb2), LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_grad_color(ui->device_gang3swbgimg_2, lv_color_make(0xb2, 0xb2, 0xb2), LV_PART_MAIN|LV_STATE_DEFAULT); } #else //Write codes device_gang3swbgimg_2 ui->device_gang3swbgimg_2 = lv_img_create(ui->device_gang3cont); lv_obj_set_pos(ui->device_gang3swbgimg_2, 191, 84); lv_obj_set_size(ui->device_gang3swbgimg_2, 54, 54); //Write style state: LV_STATE_DEFAULT for style_device_gang3swbgimg_2_main_main_default static lv_style_t style_device_gang3swbgimg_2_main_main_default; lv_style_reset(&style_device_gang3swbgimg_2_main_main_default); lv_style_set_img_recolor(&style_device_gang3swbgimg_2_main_main_default, lv_color_make(0xff, 0xff, 0xff)); lv_style_set_img_recolor_opa(&style_device_gang3swbgimg_2_main_main_default, 0); lv_style_set_img_opa(&style_device_gang3swbgimg_2_main_main_default, 255); lv_obj_add_style(ui->device_gang3swbgimg_2, &style_device_gang3swbgimg_2_main_main_default, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_add_flag(ui->device_gang3swbgimg_2, LV_OBJ_FLAG_CLICKABLE); lv_img_set_src(ui->device_gang3swbgimg_2,LVGL_PATH(lightonbg.png)); lv_img_set_pivot(ui->device_gang3swbgimg_2, 0,0); lv_img_set_angle(ui->device_gang3swbgimg_2, 0); #endif //Write codes device_gang3swiconimg_2 ui->device_gang3swiconimg_2 = lv_img_create(ui->device_gang3cont); lv_obj_set_pos(ui->device_gang3swiconimg_2, 203, 95); lv_obj_set_size(ui->device_gang3swiconimg_2, 32, 32); //Write style state: LV_STATE_DEFAULT for style_device_gang3swiconimg_2_main_main_default static lv_style_t style_device_gang3swiconimg_2_main_main_default; lv_style_reset(&style_device_gang3swiconimg_2_main_main_default); lv_style_set_img_recolor(&style_device_gang3swiconimg_2_main_main_default, lv_color_make(0xff, 0xff, 0xff)); lv_style_set_img_recolor_opa(&style_device_gang3swiconimg_2_main_main_default, 0); lv_style_set_img_opa(&style_device_gang3swiconimg_2_main_main_default, 255); lv_obj_add_style(ui->device_gang3swiconimg_2, &style_device_gang3swiconimg_2_main_main_default, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_add_flag(ui->device_gang3swiconimg_2, LV_OBJ_FLAG_CLICKABLE); // lv_img_set_src(ui->device_gang3swiconimg_2,LVGL_PATH(iconLightstrip.png)); if(GET_nvs_Sys_Info_Gang32icon()) { lv_img_set_src(ui->device_gang3swiconimg_2,onoff_keyligthimgon_ary[GET_nvs_Sys_Info_Gang32icon()]); } else { lv_img_set_src(ui->device_gang3swiconimg_2,LVGL_PATH(onofflighton2.png));//icon } lv_img_set_pivot(ui->device_gang3swiconimg_2, 0,0); lv_img_set_angle(ui->device_gang3swiconimg_2, 0); //Write codes device_gang3swbtn_2 ui->device_gang3swbtn_2 = lv_btn_create(ui->device_gang3cont); lv_obj_set_pos(ui->device_gang3swbtn_2, 191, 84); lv_obj_set_size(ui->device_gang3swbtn_2, 54, 54); //Write style state: LV_STATE_DEFAULT for style_device_gang3swbtn_2_main_main_default static lv_style_t style_device_gang3swbtn_2_main_main_default; lv_style_reset(&style_device_gang3swbtn_2_main_main_default); lv_style_set_radius(&style_device_gang3swbtn_2_main_main_default, 0); lv_style_set_bg_color(&style_device_gang3swbtn_2_main_main_default, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_bg_grad_color(&style_device_gang3swbtn_2_main_main_default, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_bg_grad_dir(&style_device_gang3swbtn_2_main_main_default, LV_GRAD_DIR_VER); lv_style_set_bg_opa(&style_device_gang3swbtn_2_main_main_default, 0); lv_style_set_shadow_color(&style_device_gang3swbtn_2_main_main_default, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_shadow_opa(&style_device_gang3swbtn_2_main_main_default, 0); lv_style_set_border_color(&style_device_gang3swbtn_2_main_main_default, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_border_width(&style_device_gang3swbtn_2_main_main_default, 0); lv_style_set_border_opa(&style_device_gang3swbtn_2_main_main_default, 0); lv_obj_add_style(ui->device_gang3swbtn_2, &style_device_gang3swbtn_2_main_main_default, LV_PART_MAIN|LV_STATE_DEFAULT); // ui->device_gang3swbtn_2_label = lv_label_create(ui->device_gang3swbtn_2); // lv_label_set_text(ui->device_gang3swbtn_2_label, ""); // lv_obj_set_style_text_color(ui->device_gang3swbtn_2_label, lv_color_make(0x00, 0x00, 0x00), LV_STATE_DEFAULT); // lv_obj_set_style_pad_all(ui->device_gang3swbtn_2, 0, LV_STATE_DEFAULT); // lv_obj_align(ui->device_gang3swbtn_2_label, LV_ALIGN_CENTER, 0, 0); //Write codes device_gang3swlabel_2 ui->device_gang3swlabel_2 = lv_label_create(ui->device_gang3cont); lv_obj_set_pos(ui->device_gang3swlabel_2, 171, 141); lv_obj_set_size(ui->device_gang3swlabel_2, 100, 24); // lv_label_set_text(ui->device_gang3swlabel_2, "Downlight"); if( strlen((const char*)nvs_Sys_Info_SysInfo.gang3_sw2.Label) )//用户自己设置的文字(自由设置 不分语言) { lv_label_set_text_fmt(ui->device_gang3swlabel_2, "%s",nvs_Sys_Info_SysInfo.gang3_sw2.Label); } else { lv_label_set_text(ui->device_gang3swlabel_2,Menu_List[GET_nvs_Sys_Info_language()][MENU_LIST_GANG32]); } lv_label_set_long_mode(ui->device_gang3swlabel_2, LV_LABEL_LONG_DOT); lv_obj_set_style_text_align(ui->device_gang3swlabel_2, LV_TEXT_ALIGN_CENTER, 0); //Write style state: LV_STATE_DEFAULT for style_device_gang3swlabel_2_main_main_default static lv_style_t style_device_gang3swlabel_2_main_main_default; lv_style_reset(&style_device_gang3swlabel_2_main_main_default); lv_style_set_radius(&style_device_gang3swlabel_2_main_main_default, 0); lv_style_set_bg_color(&style_device_gang3swlabel_2_main_main_default, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_bg_grad_color(&style_device_gang3swlabel_2_main_main_default, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_bg_grad_dir(&style_device_gang3swlabel_2_main_main_default, LV_GRAD_DIR_VER); lv_style_set_bg_opa(&style_device_gang3swlabel_2_main_main_default, 0); lv_style_set_text_color(&style_device_gang3swlabel_2_main_main_default, lv_color_make(0xff, 0xff, 0xff)); lv_style_set_text_font(&style_device_gang3swlabel_2_main_main_default, &lv_font_simsun_16); lv_style_set_text_letter_space(&style_device_gang3swlabel_2_main_main_default, 0); lv_style_set_pad_left(&style_device_gang3swlabel_2_main_main_default, 0); lv_style_set_pad_right(&style_device_gang3swlabel_2_main_main_default, 0); lv_style_set_pad_top(&style_device_gang3swlabel_2_main_main_default, 0); lv_style_set_pad_bottom(&style_device_gang3swlabel_2_main_main_default, 0); lv_obj_add_style(ui->device_gang3swlabel_2, &style_device_gang3swlabel_2_main_main_default, LV_PART_MAIN|LV_STATE_DEFAULT); #ifdef CONFIG_OBJICT_IMAGE //Write codes device_gang3swbgimg_3 ui->device_gang3swbgimg_3 = lv_obj_create(ui->device_gang3cont); lv_obj_set_pos(ui->device_gang3swbgimg_3, 304, 84); lv_obj_set_size(ui->device_gang3swbgimg_3, 54, 54); lv_obj_set_style_radius(ui->device_gang3swbgimg_3, 30, LV_PART_MAIN|LV_STATE_DEFAULT); //lv_obj_set_style_bg_color(ui->device_gang3swbgimg_3, lv_color_make(0xeb, 0x95, 0x0f), LV_PART_MAIN|LV_STATE_DEFAULT); //lv_obj_set_style_bg_grad_color(ui->device_gang3swbgimg_3, lv_color_make(0xef, 0x95, 0x0f), LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_grad_dir(ui->device_gang3swbgimg_3, LV_GRAD_DIR_VER, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_opa(ui->device_gang3swbgimg_3, 255, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_border_color(ui->device_gang3swbgimg_3, lv_color_make(0xeb, 0x95, 0x0f), LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_border_width(ui->device_gang3swbgimg_3, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_border_opa(ui->device_gang3swbgimg_3, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_left(ui->device_gang3swbgimg_3, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_right(ui->device_gang3swbgimg_3, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_top(ui->device_gang3swbgimg_3, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_bottom(ui->device_gang3swbgimg_3, 0, LV_PART_MAIN|LV_STATE_DEFAULT); if(GET_nvs_Sys_Info_Gang3relay3()) { lv_obj_set_style_bg_color(ui->device_gang3swbgimg_3,lv_color_make(0xeb, 0x95, 0x0f), LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_grad_color(ui->device_gang3swbgimg_3, lv_color_make(0xef, 0x95, 0x0f), LV_PART_MAIN|LV_STATE_DEFAULT); } else { lv_obj_set_style_bg_color(ui->device_gang3swbgimg_3,lv_color_make(0xb2, 0xb2, 0xb2), LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_grad_color(ui->device_gang3swbgimg_3, lv_color_make(0xb2, 0xb2, 0xb2), LV_PART_MAIN|LV_STATE_DEFAULT); } #else //Write codes device_gang3swbgimg_3 ui->device_gang3swbgimg_3 = lv_img_create(ui->device_gang3cont); lv_obj_set_pos(ui->device_gang3swbgimg_3, 304, 84); lv_obj_set_size(ui->device_gang3swbgimg_3, 54, 54); //Write style state: LV_STATE_DEFAULT for style_device_gang3swbgimg_3_main_main_default static lv_style_t style_device_gang3swbgimg_3_main_main_default; lv_style_reset(&style_device_gang3swbgimg_3_main_main_default); lv_style_set_img_recolor(&style_device_gang3swbgimg_3_main_main_default, lv_color_make(0xff, 0xff, 0xff)); lv_style_set_img_recolor_opa(&style_device_gang3swbgimg_3_main_main_default, 0); lv_style_set_img_opa(&style_device_gang3swbgimg_3_main_main_default, 255); lv_obj_add_style(ui->device_gang3swbgimg_3, &style_device_gang3swbgimg_3_main_main_default, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_add_flag(ui->device_gang3swbgimg_3, LV_OBJ_FLAG_CLICKABLE); lv_img_set_src(ui->device_gang3swbgimg_3,LVGL_PATH(lightonbg.png)); lv_img_set_pivot(ui->device_gang3swbgimg_3, 0,0); lv_img_set_angle(ui->device_gang3swbgimg_3, 0); #endif //Write codes device_gang3swiconimg_3 ui->device_gang3swiconimg_3 = lv_img_create(ui->device_gang3cont); lv_obj_set_pos(ui->device_gang3swiconimg_3, 316, 95); lv_obj_set_size(ui->device_gang3swiconimg_3, 32, 32); //Write style state: LV_STATE_DEFAULT for style_device_gang3swiconimg_3_main_main_default static lv_style_t style_device_gang3swiconimg_3_main_main_default; lv_style_reset(&style_device_gang3swiconimg_3_main_main_default); lv_style_set_img_recolor(&style_device_gang3swiconimg_3_main_main_default, lv_color_make(0xff, 0xff, 0xff)); lv_style_set_img_recolor_opa(&style_device_gang3swiconimg_3_main_main_default, 0); lv_style_set_img_opa(&style_device_gang3swiconimg_3_main_main_default, 255); lv_obj_add_style(ui->device_gang3swiconimg_3, &style_device_gang3swiconimg_3_main_main_default, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_add_flag(ui->device_gang3swiconimg_3, LV_OBJ_FLAG_CLICKABLE); // lv_img_set_src(ui->device_gang3swiconimg_3,LVGL_PATH(onofflightoff10.png)); if(GET_nvs_Sys_Info_Gang33icon()) { lv_img_set_src(ui->device_gang3swiconimg_3,onoff_keyligthimgon_ary[GET_nvs_Sys_Info_Gang33icon()]); } else { lv_img_set_src(ui->device_gang3swiconimg_3,LVGL_PATH(onofflighton10.png));//icon } lv_img_set_pivot(ui->device_gang3swiconimg_3, 0,0); lv_img_set_angle(ui->device_gang3swiconimg_3, 0); //Write codes device_gang3swbtn_3 ui->device_gang3swbtn_3 = lv_btn_create(ui->device_gang3cont); lv_obj_set_pos(ui->device_gang3swbtn_3, 304, 84); lv_obj_set_size(ui->device_gang3swbtn_3, 54, 54); //Write style state: LV_STATE_DEFAULT for style_device_gang3swbtn_3_main_main_default static lv_style_t style_device_gang3swbtn_3_main_main_default; lv_style_reset(&style_device_gang3swbtn_3_main_main_default); lv_style_set_radius(&style_device_gang3swbtn_3_main_main_default, 0); lv_style_set_bg_color(&style_device_gang3swbtn_3_main_main_default, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_bg_grad_color(&style_device_gang3swbtn_3_main_main_default, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_bg_grad_dir(&style_device_gang3swbtn_3_main_main_default, LV_GRAD_DIR_VER); lv_style_set_bg_opa(&style_device_gang3swbtn_3_main_main_default, 0); lv_style_set_shadow_color(&style_device_gang3swbtn_3_main_main_default, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_shadow_opa(&style_device_gang3swbtn_3_main_main_default, 0); lv_style_set_border_color(&style_device_gang3swbtn_3_main_main_default, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_border_width(&style_device_gang3swbtn_3_main_main_default, 0); lv_style_set_border_opa(&style_device_gang3swbtn_3_main_main_default, 0); lv_obj_add_style(ui->device_gang3swbtn_3, &style_device_gang3swbtn_3_main_main_default, LV_PART_MAIN|LV_STATE_DEFAULT); // ui->device_gang3swbtn_3_label = lv_label_create(ui->device_gang3swbtn_3); // lv_label_set_text(ui->device_gang3swbtn_3_label, ""); // lv_obj_set_style_text_color(ui->device_gang3swbtn_3_label, lv_color_make(0x00, 0x00, 0x00), LV_STATE_DEFAULT); // lv_obj_set_style_pad_all(ui->device_gang3swbtn_3, 0, LV_STATE_DEFAULT); // lv_obj_align(ui->device_gang3swbtn_3_label, LV_ALIGN_CENTER, 0, 0); //Write codes device_gang3swlabel_3 ui->device_gang3swlabel_3 = lv_label_create(ui->device_gang3cont); lv_obj_set_pos(ui->device_gang3swlabel_3, 286, 141); lv_obj_set_size(ui->device_gang3swlabel_3, 100, 24); // lv_label_set_text(ui->device_gang3swlabel_3, "Light strip"); if( strlen((const char*)nvs_Sys_Info_SysInfo.gang3_sw3.Label) )//用户自己设置的文字(自由设置 不分语言) { lv_label_set_text_fmt(ui->device_gang3swlabel_3, "%s",nvs_Sys_Info_SysInfo.gang3_sw3.Label); } else { lv_label_set_text(ui->device_gang3swlabel_3,Menu_List[GET_nvs_Sys_Info_language()][MENU_LIST_GANG33]); } lv_label_set_long_mode(ui->device_gang3swlabel_3, LV_LABEL_LONG_DOT); lv_obj_set_style_text_align(ui->device_gang3swlabel_3, LV_TEXT_ALIGN_CENTER, 0); //Write style state: LV_STATE_DEFAULT for style_device_gang3swlabel_3_main_main_default static lv_style_t style_device_gang3swlabel_3_main_main_default; lv_style_reset(&style_device_gang3swlabel_3_main_main_default); lv_style_set_radius(&style_device_gang3swlabel_3_main_main_default, 0); lv_style_set_bg_color(&style_device_gang3swlabel_3_main_main_default, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_bg_grad_color(&style_device_gang3swlabel_3_main_main_default, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_bg_grad_dir(&style_device_gang3swlabel_3_main_main_default, LV_GRAD_DIR_VER); lv_style_set_bg_opa(&style_device_gang3swlabel_3_main_main_default, 0); lv_style_set_text_color(&style_device_gang3swlabel_3_main_main_default, lv_color_make(0xff, 0xff, 0xff)); lv_style_set_text_font(&style_device_gang3swlabel_3_main_main_default, &lv_font_simsun_16); lv_style_set_text_letter_space(&style_device_gang3swlabel_3_main_main_default, 0); lv_style_set_pad_left(&style_device_gang3swlabel_3_main_main_default, 0); lv_style_set_pad_right(&style_device_gang3swlabel_3_main_main_default, 0); lv_style_set_pad_top(&style_device_gang3swlabel_3_main_main_default, 0); lv_style_set_pad_bottom(&style_device_gang3swlabel_3_main_main_default, 0); lv_obj_add_style(ui->device_gang3swlabel_3, &style_device_gang3swlabel_3_main_main_default, LV_PART_MAIN|LV_STATE_DEFAULT); //Init events for screen events_init_device_gang3(ui); } //场景开关4路 void create_device_gang4(lv_ui *ui,lv_obj_t * parent, lv_coord_t x, lv_coord_t y,lv_coord_t w, lv_coord_t h) { if(!parent) { return; } //Write codes device_gang4cont ui->device_gang4cont = lv_obj_create(parent); lv_obj_set_pos(ui->device_gang4cont, x, y); lv_obj_set_size(ui->device_gang4cont, w, h); //Write style state: LV_STATE_DEFAULT for style_device_gang4cont_main_main_default static lv_style_t style_device_gang4cont_main_main_default; lv_style_reset(&style_device_gang4cont_main_main_default); lv_style_set_radius(&style_device_gang4cont_main_main_default, 15); lv_style_set_bg_color(&style_device_gang4cont_main_main_default, lv_color_make(0x25, 0x25, 0x25)); lv_style_set_bg_grad_color(&style_device_gang4cont_main_main_default, lv_color_make(0x25, 0x25, 0x25)); lv_style_set_bg_grad_dir(&style_device_gang4cont_main_main_default, LV_GRAD_DIR_VER); lv_style_set_bg_opa(&style_device_gang4cont_main_main_default, 255); lv_style_set_border_color(&style_device_gang4cont_main_main_default, lv_color_make(0xff, 0xff, 0xff)); lv_style_set_border_width(&style_device_gang4cont_main_main_default, 0); lv_style_set_border_opa(&style_device_gang4cont_main_main_default, 0); lv_style_set_pad_left(&style_device_gang4cont_main_main_default, 0); lv_style_set_pad_right(&style_device_gang4cont_main_main_default, 0); lv_style_set_pad_top(&style_device_gang4cont_main_main_default, 0); lv_style_set_pad_bottom(&style_device_gang4cont_main_main_default, 0); lv_obj_add_style(ui->device_gang4cont, &style_device_gang4cont_main_main_default, LV_PART_MAIN|LV_STATE_DEFAULT); //Write codes device_gang4img ui->device_gang4img = lv_img_create(ui->device_gang4cont); lv_obj_set_pos(ui->device_gang4img, 18, 12); lv_obj_set_size(ui->device_gang4img, 54, 54); //Write style state: LV_STATE_DEFAULT for style_device_gang4img_main_main_default static lv_style_t style_device_gang4img_main_main_default; lv_style_reset(&style_device_gang4img_main_main_default); lv_style_set_img_recolor(&style_device_gang4img_main_main_default, lv_color_make(0xff, 0xff, 0xff)); lv_style_set_img_recolor_opa(&style_device_gang4img_main_main_default, 0); lv_style_set_img_opa(&style_device_gang4img_main_main_default, 255); lv_obj_add_style(ui->device_gang4img, &style_device_gang4img_main_main_default, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_add_flag(ui->device_gang4img, LV_OBJ_FLAG_CLICKABLE); lv_img_set_src(ui->device_gang4img,LVGL_PATH(lightonbg.png)); lv_img_set_pivot(ui->device_gang4img, 0,0); lv_img_set_angle(ui->device_gang4img, 0); //Write codes device_gang4icon_img ui->device_gang4icon_img = lv_img_create(ui->device_gang4cont); lv_obj_set_pos(ui->device_gang4icon_img, 31, 24); lv_obj_set_size(ui->device_gang4icon_img, 30, 30); //Write style state: LV_STATE_DEFAULT for style_device_gang4icon_img_main_main_default static lv_style_t style_device_gang4icon_img_main_main_default; lv_style_reset(&style_device_gang4icon_img_main_main_default); lv_style_set_img_recolor(&style_device_gang4icon_img_main_main_default, lv_color_make(0xff, 0xff, 0xff)); lv_style_set_img_recolor_opa(&style_device_gang4icon_img_main_main_default, 0); lv_style_set_img_opa(&style_device_gang4icon_img_main_main_default, 255); lv_obj_add_style(ui->device_gang4icon_img, &style_device_gang4icon_img_main_main_default, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_add_flag(ui->device_gang4icon_img, LV_OBJ_FLAG_CLICKABLE); lv_img_set_src(ui->device_gang4icon_img,LVGL_PATH(devgangicon.png)); lv_img_set_pivot(ui->device_gang4icon_img, 0,0); lv_img_set_angle(ui->device_gang4icon_img, 0); //Write codes device_gang4btn_1 ui->device_gang4btn_1 = lv_btn_create(ui->device_gang4cont); lv_obj_set_pos(ui->device_gang4btn_1, 20, 13); lv_obj_set_size(ui->device_gang4btn_1, 52, 52); //Write style state: LV_STATE_DEFAULT for style_device_gang4btn_1_main_main_default static lv_style_t style_device_gang4btn_1_main_main_default; lv_style_reset(&style_device_gang4btn_1_main_main_default); lv_style_set_radius(&style_device_gang4btn_1_main_main_default, 0); lv_style_set_bg_color(&style_device_gang4btn_1_main_main_default, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_bg_grad_color(&style_device_gang4btn_1_main_main_default, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_bg_grad_dir(&style_device_gang4btn_1_main_main_default, LV_GRAD_DIR_VER); lv_style_set_bg_opa(&style_device_gang4btn_1_main_main_default, 0); lv_style_set_shadow_color(&style_device_gang4btn_1_main_main_default, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_shadow_opa(&style_device_gang4btn_1_main_main_default, 0); lv_style_set_border_color(&style_device_gang4btn_1_main_main_default, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_border_width(&style_device_gang4btn_1_main_main_default, 0); lv_style_set_border_opa(&style_device_gang4btn_1_main_main_default, 0); lv_obj_add_style(ui->device_gang4btn_1, &style_device_gang4btn_1_main_main_default, LV_PART_MAIN|LV_STATE_DEFAULT); ui->device_gang4btn_1_label = lv_label_create(ui->device_gang4btn_1); lv_label_set_text(ui->device_gang4btn_1_label, ""); lv_obj_set_style_text_color(ui->device_gang4btn_1_label, lv_color_make(0x00, 0x00, 0x00), LV_STATE_DEFAULT); lv_obj_set_style_pad_all(ui->device_gang4btn_1, 0, LV_STATE_DEFAULT); lv_obj_align(ui->device_gang4btn_1_label, LV_ALIGN_CENTER, 0, 0); //Write codes device_gang4label_1 ui->device_gang4label_1 = lv_label_create(ui->device_gang4cont); lv_obj_set_pos(ui->device_gang4label_1, 90, 29); lv_obj_set_size(ui->device_gang4label_1, 200, 24); // lv_label_set_text(ui->device_gang4label_1, "Scene 4 Gang switch"); lv_label_set_text(ui->device_gang4label_1,Menu_List[GET_nvs_Sys_Info_language()][MENU_LIST_GANG4_NAME]); lv_label_set_long_mode(ui->device_gang4label_1, LV_LABEL_LONG_DOT); lv_obj_set_style_text_align(ui->device_gang4label_1, LV_TEXT_ALIGN_LEFT, 0); //Write style state: LV_STATE_DEFAULT for style_device_gang4label_1_main_main_default static lv_style_t style_device_gang4label_1_main_main_default; lv_style_reset(&style_device_gang4label_1_main_main_default); lv_style_set_radius(&style_device_gang4label_1_main_main_default, 0); lv_style_set_bg_color(&style_device_gang4label_1_main_main_default, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_bg_grad_color(&style_device_gang4label_1_main_main_default, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_bg_grad_dir(&style_device_gang4label_1_main_main_default, LV_GRAD_DIR_VER); lv_style_set_bg_opa(&style_device_gang4label_1_main_main_default, 0); lv_style_set_text_color(&style_device_gang4label_1_main_main_default, lv_color_make(0xff, 0xff, 0xff)); lv_style_set_text_font(&style_device_gang4label_1_main_main_default, &lv_font_simsun_16); lv_style_set_text_letter_space(&style_device_gang4label_1_main_main_default, 0); lv_style_set_pad_left(&style_device_gang4label_1_main_main_default, 0); lv_style_set_pad_right(&style_device_gang4label_1_main_main_default, 0); lv_style_set_pad_top(&style_device_gang4label_1_main_main_default, 0); lv_style_set_pad_bottom(&style_device_gang4label_1_main_main_default, 0); lv_obj_add_style(ui->device_gang4label_1, &style_device_gang4label_1_main_main_default, LV_PART_MAIN|LV_STATE_DEFAULT); //Write codes device_gang4imgbtn_1 ui->device_gang4imgbtn_1 = lv_switch_create(ui->device_gang4cont); lv_obj_set_pos(ui->device_gang4imgbtn_1, 361, 26); lv_obj_set_size(ui->device_gang4imgbtn_1, 60, 28); if( GET_nvs_Sys_Info_Gang4relay1()&&GET_nvs_Sys_Info_Gang4relay2() &&GET_nvs_Sys_Info_Gang4relay3()&&GET_nvs_Sys_Info_Gang4relay4() ) { lv_obj_add_state(ui->device_gang4imgbtn_1, LV_STATE_CHECKED);//on } else { lv_obj_clear_state(ui->device_gang4imgbtn_1, LV_STATE_CHECKED);//off } //Write style state: LV_STATE_DEFAULT for style_device_gang4imgbtn_1_main_main_default static lv_style_t style_device_gang4imgbtn_1_main_main_default; lv_style_reset(&style_device_gang4imgbtn_1_main_main_default); lv_style_set_radius(&style_device_gang4imgbtn_1_main_main_default, 100); lv_style_set_bg_color(&style_device_gang4imgbtn_1_main_main_default, lv_color_make(0xaa, 0xaa, 0xaa)); lv_style_set_bg_grad_color(&style_device_gang4imgbtn_1_main_main_default, lv_color_make(0xaa, 0xaa, 0xaa)); lv_style_set_bg_grad_dir(&style_device_gang4imgbtn_1_main_main_default, LV_GRAD_DIR_VER); lv_style_set_bg_opa(&style_device_gang4imgbtn_1_main_main_default, 46); lv_obj_add_style(ui->device_gang4imgbtn_1, &style_device_gang4imgbtn_1_main_main_default, LV_PART_MAIN|LV_STATE_DEFAULT); //Write style state: LV_STATE_CHECKED for style_device_gang4imgbtn_1_main_indicator_checked static lv_style_t style_device_gang4imgbtn_1_main_indicator_checked; lv_style_reset(&style_device_gang4imgbtn_1_main_indicator_checked); lv_style_set_radius(&style_device_gang4imgbtn_1_main_indicator_checked, 100); lv_style_set_bg_color(&style_device_gang4imgbtn_1_main_indicator_checked, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_bg_grad_color(&style_device_gang4imgbtn_1_main_indicator_checked, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_bg_grad_dir(&style_device_gang4imgbtn_1_main_indicator_checked, LV_GRAD_DIR_VER); lv_style_set_bg_opa(&style_device_gang4imgbtn_1_main_indicator_checked, 255); lv_obj_add_style(ui->device_gang4imgbtn_1, &style_device_gang4imgbtn_1_main_indicator_checked, LV_PART_INDICATOR|LV_STATE_CHECKED); //Write style state: LV_STATE_DEFAULT for style_device_gang4imgbtn_1_main_knob_default static lv_style_t style_device_gang4imgbtn_1_main_knob_default; lv_style_reset(&style_device_gang4imgbtn_1_main_knob_default); lv_style_set_radius(&style_device_gang4imgbtn_1_main_knob_default, 100); lv_style_set_bg_color(&style_device_gang4imgbtn_1_main_knob_default, lv_color_make(0xff, 0xff, 0xff)); lv_style_set_bg_grad_color(&style_device_gang4imgbtn_1_main_knob_default, lv_color_make(0xff, 0xff, 0xff)); lv_style_set_bg_grad_dir(&style_device_gang4imgbtn_1_main_knob_default, LV_GRAD_DIR_VER); lv_style_set_bg_opa(&style_device_gang4imgbtn_1_main_knob_default, 255); lv_obj_add_style(ui->device_gang4imgbtn_1, &style_device_gang4imgbtn_1_main_knob_default, LV_PART_KNOB|LV_STATE_DEFAULT); #ifdef CONFIG_OBJICT_IMAGE //Write codes device_gang4swbgimg_1 ui->device_gang4swbgimg_1 = lv_obj_create(ui->device_gang4cont); lv_obj_set_pos(ui->device_gang4swbgimg_1, 20, 83); lv_obj_set_size(ui->device_gang4swbgimg_1, 54, 54); lv_obj_set_style_radius(ui->device_gang4swbgimg_1, 30, LV_PART_MAIN|LV_STATE_DEFAULT); //lv_obj_set_style_bg_color(ui->device_gang4swbgimg_1, lv_color_make(0xeb, 0x95, 0x0f), LV_PART_MAIN|LV_STATE_DEFAULT); //lv_obj_set_style_bg_grad_color(ui->device_gang4swbgimg_1, lv_color_make(0xef, 0x95, 0x0f), LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_grad_dir(ui->device_gang4swbgimg_1, LV_GRAD_DIR_VER, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_opa(ui->device_gang4swbgimg_1, 255, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_border_color(ui->device_gang4swbgimg_1, lv_color_make(0xeb, 0x95, 0x0f), LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_border_width(ui->device_gang4swbgimg_1, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_border_opa(ui->device_gang4swbgimg_1, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_left(ui->device_gang4swbgimg_1, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_right(ui->device_gang4swbgimg_1, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_top(ui->device_gang4swbgimg_1, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_bottom(ui->device_gang4swbgimg_1, 0, LV_PART_MAIN|LV_STATE_DEFAULT); if(GET_nvs_Sys_Info_Gang4relay1()) { lv_obj_set_style_bg_color(ui->device_gang4swbgimg_1,lv_color_make(0xeb, 0x95, 0x0f), LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_grad_color(ui->device_gang4swbgimg_1, lv_color_make(0xef, 0x95, 0x0f), LV_PART_MAIN|LV_STATE_DEFAULT); } else { lv_obj_set_style_bg_color(ui->device_gang4swbgimg_1,lv_color_make(0xb2, 0xb2, 0xb2), LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_grad_color(ui->device_gang4swbgimg_1, lv_color_make(0xb2, 0xb2, 0xb2), LV_PART_MAIN|LV_STATE_DEFAULT); } #else //Write codes device_gang4swbgimg_1 ui->device_gang4swbgimg_1 = lv_img_create(ui->device_gang4cont); lv_obj_set_pos(ui->device_gang4swbgimg_1, 20, 83); lv_obj_set_size(ui->device_gang4swbgimg_1, 54, 54); //Write style state: LV_STATE_DEFAULT for style_device_gang4swbgimg_1_main_main_default static lv_style_t style_device_gang4swbgimg_1_main_main_default; lv_style_reset(&style_device_gang4swbgimg_1_main_main_default); lv_style_set_img_recolor(&style_device_gang4swbgimg_1_main_main_default, lv_color_make(0xff, 0xff, 0xff)); lv_style_set_img_recolor_opa(&style_device_gang4swbgimg_1_main_main_default, 0); lv_style_set_img_opa(&style_device_gang4swbgimg_1_main_main_default, 255); lv_obj_add_style(ui->device_gang4swbgimg_1, &style_device_gang4swbgimg_1_main_main_default, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_add_flag(ui->device_gang4swbgimg_1, LV_OBJ_FLAG_CLICKABLE); lv_img_set_src(ui->device_gang4swbgimg_1,LVGL_PATH(lightonbg.png)); lv_img_set_pivot(ui->device_gang4swbgimg_1, 0,0); lv_img_set_angle(ui->device_gang4swbgimg_1, 0); #endif //Write codes device_gang4swiconimg_1 ui->device_gang4swiconimg_1 = lv_img_create(ui->device_gang4cont); lv_obj_set_pos(ui->device_gang4swiconimg_1, 32, 95); lv_obj_set_size(ui->device_gang4swiconimg_1, 32, 32); //Write style state: LV_STATE_DEFAULT for style_device_gang4swiconimg_1_main_main_default static lv_style_t style_device_gang4swiconimg_1_main_main_default; lv_style_reset(&style_device_gang4swiconimg_1_main_main_default); lv_style_set_img_recolor(&style_device_gang4swiconimg_1_main_main_default, lv_color_make(0xff, 0xff, 0xff)); lv_style_set_img_recolor_opa(&style_device_gang4swiconimg_1_main_main_default, 0); lv_style_set_img_opa(&style_device_gang4swiconimg_1_main_main_default, 255); lv_obj_add_style(ui->device_gang4swiconimg_1, &style_device_gang4swiconimg_1_main_main_default, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_add_flag(ui->device_gang4swiconimg_1, LV_OBJ_FLAG_CLICKABLE); // lv_img_set_src(ui->device_gang4swiconimg_1,LVGL_PATH(onofflightoff7.png)); if(GET_nvs_Sys_Info_Gang41icon()) { lv_img_set_src(ui->device_gang4swiconimg_1,onoff_keyligthimgon_ary[GET_nvs_Sys_Info_Gang41icon()]); } else { lv_img_set_src(ui->device_gang4swiconimg_1,LVGL_PATH(onofflighton7.png));//icon } lv_img_set_pivot(ui->device_gang4swiconimg_1, 0,0); lv_img_set_angle(ui->device_gang4swiconimg_1, 0); //Write codes device_gang4swbtn_1 ui->device_gang4swbtn_1 = lv_btn_create(ui->device_gang4cont); lv_obj_set_pos(ui->device_gang4swbtn_1, 20, 83); lv_obj_set_size(ui->device_gang4swbtn_1, 54, 54); //Write style state: LV_STATE_DEFAULT for style_device_gang4swbtn_1_main_main_default static lv_style_t style_device_gang4swbtn_1_main_main_default; lv_style_reset(&style_device_gang4swbtn_1_main_main_default); lv_style_set_radius(&style_device_gang4swbtn_1_main_main_default, 0); lv_style_set_bg_color(&style_device_gang4swbtn_1_main_main_default, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_bg_grad_color(&style_device_gang4swbtn_1_main_main_default, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_bg_grad_dir(&style_device_gang4swbtn_1_main_main_default, LV_GRAD_DIR_VER); lv_style_set_bg_opa(&style_device_gang4swbtn_1_main_main_default, 0); lv_style_set_shadow_color(&style_device_gang4swbtn_1_main_main_default, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_shadow_opa(&style_device_gang4swbtn_1_main_main_default, 0); lv_style_set_border_color(&style_device_gang4swbtn_1_main_main_default, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_border_width(&style_device_gang4swbtn_1_main_main_default, 0); lv_style_set_border_opa(&style_device_gang4swbtn_1_main_main_default, 0); lv_obj_add_style(ui->device_gang4swbtn_1, &style_device_gang4swbtn_1_main_main_default, LV_PART_MAIN|LV_STATE_DEFAULT); ui->device_gang4swbtn_1_label = lv_label_create(ui->device_gang4swbtn_1); lv_label_set_text(ui->device_gang4swbtn_1_label, ""); lv_obj_set_style_text_color(ui->device_gang4swbtn_1_label, lv_color_make(0x00, 0x00, 0x00), LV_STATE_DEFAULT); lv_obj_set_style_pad_all(ui->device_gang4swbtn_1, 0, LV_STATE_DEFAULT); lv_obj_align(ui->device_gang4swbtn_1_label, LV_ALIGN_CENTER, 0, 0); //Write codes device_gang4swlabel_1 ui->device_gang4swlabel_1 = lv_label_create(ui->device_gang4cont); lv_obj_set_pos(ui->device_gang4swlabel_1, 0, 140); lv_obj_set_size(ui->device_gang4swlabel_1, 120, 24); // lv_label_set_text(ui->device_gang4swlabel_1, "Chandelier"); if( strlen((const char*)nvs_Sys_Info_SysInfo.gang4_sw1.Label) )//用户自己设置的文字(自由设置 不分语言) { lv_label_set_text_fmt(ui->device_gang4swlabel_1, "%s",nvs_Sys_Info_SysInfo.gang4_sw1.Label); } else { lv_label_set_text(ui->device_gang4swlabel_1,Menu_List[GET_nvs_Sys_Info_language()][MENU_LIST_GANG41]); } lv_label_set_long_mode(ui->device_gang4swlabel_1, LV_LABEL_LONG_DOT); lv_obj_set_style_text_align(ui->device_gang4swlabel_1, LV_TEXT_ALIGN_CENTER, 0); //Write style state: LV_STATE_DEFAULT for style_device_gang4swlabel_1_main_main_default static lv_style_t style_device_gang4swlabel_1_main_main_default; lv_style_reset(&style_device_gang4swlabel_1_main_main_default); lv_style_set_radius(&style_device_gang4swlabel_1_main_main_default, 0); lv_style_set_bg_color(&style_device_gang4swlabel_1_main_main_default, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_bg_grad_color(&style_device_gang4swlabel_1_main_main_default, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_bg_grad_dir(&style_device_gang4swlabel_1_main_main_default, LV_GRAD_DIR_VER); lv_style_set_bg_opa(&style_device_gang4swlabel_1_main_main_default, 0); lv_style_set_text_color(&style_device_gang4swlabel_1_main_main_default, lv_color_make(0xff, 0xff, 0xff)); lv_style_set_text_font(&style_device_gang4swlabel_1_main_main_default, &lv_font_simsun_16); lv_style_set_text_letter_space(&style_device_gang4swlabel_1_main_main_default, 0); lv_style_set_pad_left(&style_device_gang4swlabel_1_main_main_default, 0); lv_style_set_pad_right(&style_device_gang4swlabel_1_main_main_default, 0); lv_style_set_pad_top(&style_device_gang4swlabel_1_main_main_default, 0); lv_style_set_pad_bottom(&style_device_gang4swlabel_1_main_main_default, 0); lv_obj_add_style(ui->device_gang4swlabel_1, &style_device_gang4swlabel_1_main_main_default, LV_PART_MAIN|LV_STATE_DEFAULT); #ifdef CONFIG_OBJICT_IMAGE //Write codes device_gang4swbgimg_2 ui->device_gang4swbgimg_2 = lv_obj_create(ui->device_gang4cont); lv_obj_set_pos(ui->device_gang4swbgimg_2, 140, 83); lv_obj_set_size(ui->device_gang4swbgimg_2, 54, 54); lv_obj_set_style_radius(ui->device_gang4swbgimg_2, 30, LV_PART_MAIN|LV_STATE_DEFAULT); //lv_obj_set_style_bg_color(ui->device_gang4swbgimg_2, lv_color_make(0xeb, 0x95, 0x0f), LV_PART_MAIN|LV_STATE_DEFAULT); //lv_obj_set_style_bg_grad_color(ui->device_gang4swbgimg_2, lv_color_make(0xef, 0x95, 0x0f), LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_grad_dir(ui->device_gang4swbgimg_2, LV_GRAD_DIR_VER, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_opa(ui->device_gang4swbgimg_2, 255, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_border_color(ui->device_gang4swbgimg_2, lv_color_make(0xeb, 0x95, 0x0f), LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_border_width(ui->device_gang4swbgimg_2, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_border_opa(ui->device_gang4swbgimg_2, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_left(ui->device_gang4swbgimg_2, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_right(ui->device_gang4swbgimg_2, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_top(ui->device_gang4swbgimg_2, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_bottom(ui->device_gang4swbgimg_2, 0, LV_PART_MAIN|LV_STATE_DEFAULT); if(GET_nvs_Sys_Info_Gang4relay2()) { lv_obj_set_style_bg_color(ui->device_gang4swbgimg_2,lv_color_make(0xeb, 0x95, 0x0f), LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_grad_color(ui->device_gang4swbgimg_2, lv_color_make(0xef, 0x95, 0x0f), LV_PART_MAIN|LV_STATE_DEFAULT); } else { lv_obj_set_style_bg_color(ui->device_gang4swbgimg_2,lv_color_make(0xb2, 0xb2, 0xb2), LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_grad_color(ui->device_gang4swbgimg_2, lv_color_make(0xb2, 0xb2, 0xb2), LV_PART_MAIN|LV_STATE_DEFAULT); } #else //Write codes device_gang4swbgimg_2 ui->device_gang4swbgimg_2 = lv_img_create(ui->device_gang4cont); lv_obj_set_pos(ui->device_gang4swbgimg_2, 140, 83); lv_obj_set_size(ui->device_gang4swbgimg_2, 54, 54); //Write style state: LV_STATE_DEFAULT for style_device_gang4swbgimg_2_main_main_default static lv_style_t style_device_gang4swbgimg_2_main_main_default; lv_style_reset(&style_device_gang4swbgimg_2_main_main_default); lv_style_set_img_recolor(&style_device_gang4swbgimg_2_main_main_default, lv_color_make(0xff, 0xff, 0xff)); lv_style_set_img_recolor_opa(&style_device_gang4swbgimg_2_main_main_default, 0); lv_style_set_img_opa(&style_device_gang4swbgimg_2_main_main_default, 255); lv_obj_add_style(ui->device_gang4swbgimg_2, &style_device_gang4swbgimg_2_main_main_default, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_add_flag(ui->device_gang4swbgimg_2, LV_OBJ_FLAG_CLICKABLE); lv_img_set_src(ui->device_gang4swbgimg_2,LVGL_PATH(lightonbg.png)); lv_img_set_pivot(ui->device_gang4swbgimg_2, 0,0); lv_img_set_angle(ui->device_gang4swbgimg_2, 0); #endif //Write codes device_gang4swiconimg_2 ui->device_gang4swiconimg_2 = lv_img_create(ui->device_gang4cont); lv_obj_set_pos(ui->device_gang4swiconimg_2, 152, 94); lv_obj_set_size(ui->device_gang4swiconimg_2, 32, 32); //Write style state: LV_STATE_DEFAULT for style_device_gang4swiconimg_2_main_main_default static lv_style_t style_device_gang4swiconimg_2_main_main_default; lv_style_reset(&style_device_gang4swiconimg_2_main_main_default); lv_style_set_img_recolor(&style_device_gang4swiconimg_2_main_main_default, lv_color_make(0xff, 0xff, 0xff)); lv_style_set_img_recolor_opa(&style_device_gang4swiconimg_2_main_main_default, 0); lv_style_set_img_opa(&style_device_gang4swiconimg_2_main_main_default, 255); lv_obj_add_style(ui->device_gang4swiconimg_2, &style_device_gang4swiconimg_2_main_main_default, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_add_flag(ui->device_gang4swiconimg_2, LV_OBJ_FLAG_CLICKABLE); // lv_img_set_src(ui->device_gang4swiconimg_2,LVGL_PATH(iconLightstrip.png)); if(GET_nvs_Sys_Info_Gang42icon()) { lv_img_set_src(ui->device_gang4swiconimg_2,onoff_keyligthimgon_ary[GET_nvs_Sys_Info_Gang42icon()]); } else { lv_img_set_src(ui->device_gang4swiconimg_2,LVGL_PATH(onofflighton2.png));//icon } lv_img_set_pivot(ui->device_gang4swiconimg_2, 0,0); lv_img_set_angle(ui->device_gang4swiconimg_2, 0); //Write codes device_gang4swbtn_2 ui->device_gang4swbtn_2 = lv_btn_create(ui->device_gang4cont); lv_obj_set_pos(ui->device_gang4swbtn_2, 140, 83); lv_obj_set_size(ui->device_gang4swbtn_2, 54, 54); //Write style state: LV_STATE_DEFAULT for style_device_gang4swbtn_2_main_main_default static lv_style_t style_device_gang4swbtn_2_main_main_default; lv_style_reset(&style_device_gang4swbtn_2_main_main_default); lv_style_set_radius(&style_device_gang4swbtn_2_main_main_default, 0); lv_style_set_bg_color(&style_device_gang4swbtn_2_main_main_default, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_bg_grad_color(&style_device_gang4swbtn_2_main_main_default, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_bg_grad_dir(&style_device_gang4swbtn_2_main_main_default, LV_GRAD_DIR_VER); lv_style_set_bg_opa(&style_device_gang4swbtn_2_main_main_default, 0); lv_style_set_shadow_color(&style_device_gang4swbtn_2_main_main_default, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_shadow_opa(&style_device_gang4swbtn_2_main_main_default, 0); lv_style_set_border_color(&style_device_gang4swbtn_2_main_main_default, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_border_width(&style_device_gang4swbtn_2_main_main_default, 0); lv_style_set_border_opa(&style_device_gang4swbtn_2_main_main_default, 0); lv_obj_add_style(ui->device_gang4swbtn_2, &style_device_gang4swbtn_2_main_main_default, LV_PART_MAIN|LV_STATE_DEFAULT); ui->device_gang4swbtn_2_label = lv_label_create(ui->device_gang4swbtn_2); lv_label_set_text(ui->device_gang4swbtn_2_label, ""); lv_obj_set_style_text_color(ui->device_gang4swbtn_2_label, lv_color_make(0x00, 0x00, 0x00), LV_STATE_DEFAULT); lv_obj_set_style_pad_all(ui->device_gang4swbtn_2, 0, LV_STATE_DEFAULT); lv_obj_align(ui->device_gang4swbtn_2_label, LV_ALIGN_CENTER, 0, 0); //Write codes device_gang4swlabel_2 ui->device_gang4swlabel_2 = lv_label_create(ui->device_gang4cont); lv_obj_set_pos(ui->device_gang4swlabel_2, 120, 140); lv_obj_set_size(ui->device_gang4swlabel_2, 100, 24); // lv_label_set_text(ui->device_gang4swlabel_2, "Downlight"); if( strlen((const char*)nvs_Sys_Info_SysInfo.gang4_sw2.Label) )//用户自己设置的文字(自由设置 不分语言) { lv_label_set_text_fmt(ui->device_gang4swlabel_2, "%s",nvs_Sys_Info_SysInfo.gang4_sw2.Label); } else { lv_label_set_text(ui->device_gang4swlabel_2,Menu_List[GET_nvs_Sys_Info_language()][MENU_LIST_GANG42]); } lv_label_set_long_mode(ui->device_gang4swlabel_2, LV_LABEL_LONG_DOT); lv_obj_set_style_text_align(ui->device_gang4swlabel_2, LV_TEXT_ALIGN_CENTER, 0); //Write style state: LV_STATE_DEFAULT for style_device_gang4swlabel_2_main_main_default static lv_style_t style_device_gang4swlabel_2_main_main_default; lv_style_reset(&style_device_gang4swlabel_2_main_main_default); lv_style_set_radius(&style_device_gang4swlabel_2_main_main_default, 0); lv_style_set_bg_color(&style_device_gang4swlabel_2_main_main_default, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_bg_grad_color(&style_device_gang4swlabel_2_main_main_default, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_bg_grad_dir(&style_device_gang4swlabel_2_main_main_default, LV_GRAD_DIR_VER); lv_style_set_bg_opa(&style_device_gang4swlabel_2_main_main_default, 0); lv_style_set_text_color(&style_device_gang4swlabel_2_main_main_default, lv_color_make(0xff, 0xff, 0xff)); lv_style_set_text_font(&style_device_gang4swlabel_2_main_main_default, &lv_font_simsun_16); lv_style_set_text_letter_space(&style_device_gang4swlabel_2_main_main_default, 0); lv_style_set_pad_left(&style_device_gang4swlabel_2_main_main_default, 0); lv_style_set_pad_right(&style_device_gang4swlabel_2_main_main_default, 0); lv_style_set_pad_top(&style_device_gang4swlabel_2_main_main_default, 0); lv_style_set_pad_bottom(&style_device_gang4swlabel_2_main_main_default, 0); lv_obj_add_style(ui->device_gang4swlabel_2, &style_device_gang4swlabel_2_main_main_default, LV_PART_MAIN|LV_STATE_DEFAULT); #ifdef CONFIG_OBJICT_IMAGE //Write codes device_gang4swbgimg_3 ui->device_gang4swbgimg_3 = lv_obj_create(ui->device_gang4cont); lv_obj_set_pos(ui->device_gang4swbgimg_3, 253, 83); lv_obj_set_size(ui->device_gang4swbgimg_3, 54, 54); lv_obj_set_style_radius(ui->device_gang4swbgimg_3, 30, LV_PART_MAIN|LV_STATE_DEFAULT); //lv_obj_set_style_bg_color(ui->device_gang4swbgimg_3, lv_color_make(0xeb, 0x95, 0x0f), LV_PART_MAIN|LV_STATE_DEFAULT); //lv_obj_set_style_bg_grad_color(ui->device_gang4swbgimg_3, lv_color_make(0xef, 0x95, 0x0f), LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_grad_dir(ui->device_gang4swbgimg_3, LV_GRAD_DIR_VER, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_opa(ui->device_gang4swbgimg_3, 255, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_border_color(ui->device_gang4swbgimg_3, lv_color_make(0xeb, 0x95, 0x0f), LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_border_width(ui->device_gang4swbgimg_3, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_border_opa(ui->device_gang4swbgimg_3, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_left(ui->device_gang4swbgimg_3, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_right(ui->device_gang4swbgimg_3, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_top(ui->device_gang4swbgimg_3, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_bottom(ui->device_gang4swbgimg_3, 0, LV_PART_MAIN|LV_STATE_DEFAULT); if(GET_nvs_Sys_Info_Gang4relay3()) { lv_obj_set_style_bg_color(ui->device_gang4swbgimg_3,lv_color_make(0xeb, 0x95, 0x0f), LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_grad_color(ui->device_gang4swbgimg_3, lv_color_make(0xef, 0x95, 0x0f), LV_PART_MAIN|LV_STATE_DEFAULT); } else { lv_obj_set_style_bg_color(ui->device_gang4swbgimg_3,lv_color_make(0xb2, 0xb2, 0xb2), LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_grad_color(ui->device_gang4swbgimg_3, lv_color_make(0xb2, 0xb2, 0xb2), LV_PART_MAIN|LV_STATE_DEFAULT); } #else //Write codes device_gang4swbgimg_3 ui->device_gang4swbgimg_3 = lv_img_create(ui->device_gang4cont); lv_obj_set_pos(ui->device_gang4swbgimg_3, 253, 83); lv_obj_set_size(ui->device_gang4swbgimg_3, 54, 54); //Write style state: LV_STATE_DEFAULT for style_device_gang4swbgimg_3_main_main_default static lv_style_t style_device_gang4swbgimg_3_main_main_default; lv_style_reset(&style_device_gang4swbgimg_3_main_main_default); lv_style_set_img_recolor(&style_device_gang4swbgimg_3_main_main_default, lv_color_make(0xff, 0xff, 0xff)); lv_style_set_img_recolor_opa(&style_device_gang4swbgimg_3_main_main_default, 0); lv_style_set_img_opa(&style_device_gang4swbgimg_3_main_main_default, 255); lv_obj_add_style(ui->device_gang4swbgimg_3, &style_device_gang4swbgimg_3_main_main_default, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_add_flag(ui->device_gang4swbgimg_3, LV_OBJ_FLAG_CLICKABLE); lv_img_set_src(ui->device_gang4swbgimg_3,LVGL_PATH(lightonbg.png)); lv_img_set_pivot(ui->device_gang4swbgimg_3, 0,0); lv_img_set_angle(ui->device_gang4swbgimg_3, 0); #endif //Write codes device_gang4swiconimg_3 ui->device_gang4swiconimg_3 = lv_img_create(ui->device_gang4cont); lv_obj_set_pos(ui->device_gang4swiconimg_3, 265, 94); lv_obj_set_size(ui->device_gang4swiconimg_3, 32, 32); //Write style state: LV_STATE_DEFAULT for style_device_gang4swiconimg_3_main_main_default static lv_style_t style_device_gang4swiconimg_3_main_main_default; lv_style_reset(&style_device_gang4swiconimg_3_main_main_default); lv_style_set_img_recolor(&style_device_gang4swiconimg_3_main_main_default, lv_color_make(0xff, 0xff, 0xff)); lv_style_set_img_recolor_opa(&style_device_gang4swiconimg_3_main_main_default, 0); lv_style_set_img_opa(&style_device_gang4swiconimg_3_main_main_default, 255); lv_obj_add_style(ui->device_gang4swiconimg_3, &style_device_gang4swiconimg_3_main_main_default, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_add_flag(ui->device_gang4swiconimg_3, LV_OBJ_FLAG_CLICKABLE); // lv_img_set_src(ui->device_gang4swiconimg_3,LVGL_PATH(onofflightoff10.png)); if(GET_nvs_Sys_Info_Gang43icon()) { lv_img_set_src(ui->device_gang4swiconimg_3,onoff_keyligthimgon_ary[GET_nvs_Sys_Info_Gang43icon()]); } else { lv_img_set_src(ui->device_gang4swiconimg_3,LVGL_PATH(onofflighton10.png));//icon } lv_img_set_pivot(ui->device_gang4swiconimg_3, 0,0); lv_img_set_angle(ui->device_gang4swiconimg_3, 0); //Write codes device_gang4swbtn_3 ui->device_gang4swbtn_3 = lv_btn_create(ui->device_gang4cont); lv_obj_set_pos(ui->device_gang4swbtn_3, 253, 83); lv_obj_set_size(ui->device_gang4swbtn_3, 54, 54); //Write style state: LV_STATE_DEFAULT for style_device_gang4swbtn_3_main_main_default static lv_style_t style_device_gang4swbtn_3_main_main_default; lv_style_reset(&style_device_gang4swbtn_3_main_main_default); lv_style_set_radius(&style_device_gang4swbtn_3_main_main_default, 0); lv_style_set_bg_color(&style_device_gang4swbtn_3_main_main_default, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_bg_grad_color(&style_device_gang4swbtn_3_main_main_default, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_bg_grad_dir(&style_device_gang4swbtn_3_main_main_default, LV_GRAD_DIR_VER); lv_style_set_bg_opa(&style_device_gang4swbtn_3_main_main_default, 0); lv_style_set_shadow_color(&style_device_gang4swbtn_3_main_main_default, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_shadow_opa(&style_device_gang4swbtn_3_main_main_default, 0); lv_style_set_border_color(&style_device_gang4swbtn_3_main_main_default, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_border_width(&style_device_gang4swbtn_3_main_main_default, 0); lv_style_set_border_opa(&style_device_gang4swbtn_3_main_main_default, 0); lv_obj_add_style(ui->device_gang4swbtn_3, &style_device_gang4swbtn_3_main_main_default, LV_PART_MAIN|LV_STATE_DEFAULT); ui->device_gang4swbtn_3_label = lv_label_create(ui->device_gang4swbtn_3); lv_label_set_text(ui->device_gang4swbtn_3_label, ""); lv_obj_set_style_text_color(ui->device_gang4swbtn_3_label, lv_color_make(0x00, 0x00, 0x00), LV_STATE_DEFAULT); lv_obj_set_style_pad_all(ui->device_gang4swbtn_3, 0, LV_STATE_DEFAULT); lv_obj_align(ui->device_gang4swbtn_3_label, LV_ALIGN_CENTER, 0, 0); //Write codes device_gang4swlabel_3 ui->device_gang4swlabel_3 = lv_label_create(ui->device_gang4cont); lv_obj_set_pos(ui->device_gang4swlabel_3, 235, 140); lv_obj_set_size(ui->device_gang4swlabel_3, 100, 24); // lv_label_set_text(ui->device_gang4swlabel_3, "Light strip"); if( strlen((const char*)nvs_Sys_Info_SysInfo.gang4_sw3.Label) )//用户自己设置的文字(自由设置 不分语言) { lv_label_set_text_fmt(ui->device_gang4swlabel_3, "%s",nvs_Sys_Info_SysInfo.gang4_sw3.Label); } else { lv_label_set_text(ui->device_gang4swlabel_3,Menu_List[GET_nvs_Sys_Info_language()][MENU_LIST_GANG43]); } lv_label_set_long_mode(ui->device_gang4swlabel_3, LV_LABEL_LONG_DOT); lv_obj_set_style_text_align(ui->device_gang4swlabel_3, LV_TEXT_ALIGN_CENTER, 0); //Write style state: LV_STATE_DEFAULT for style_device_gang4swlabel_3_main_main_default static lv_style_t style_device_gang4swlabel_3_main_main_default; lv_style_reset(&style_device_gang4swlabel_3_main_main_default); lv_style_set_radius(&style_device_gang4swlabel_3_main_main_default, 0); lv_style_set_bg_color(&style_device_gang4swlabel_3_main_main_default, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_bg_grad_color(&style_device_gang4swlabel_3_main_main_default, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_bg_grad_dir(&style_device_gang4swlabel_3_main_main_default, LV_GRAD_DIR_VER); lv_style_set_bg_opa(&style_device_gang4swlabel_3_main_main_default, 0); lv_style_set_text_color(&style_device_gang4swlabel_3_main_main_default, lv_color_make(0xff, 0xff, 0xff)); lv_style_set_text_font(&style_device_gang4swlabel_3_main_main_default, &lv_font_simsun_16); lv_style_set_text_letter_space(&style_device_gang4swlabel_3_main_main_default, 0); lv_style_set_pad_left(&style_device_gang4swlabel_3_main_main_default, 0); lv_style_set_pad_right(&style_device_gang4swlabel_3_main_main_default, 0); lv_style_set_pad_top(&style_device_gang4swlabel_3_main_main_default, 0); lv_style_set_pad_bottom(&style_device_gang4swlabel_3_main_main_default, 0); lv_obj_add_style(ui->device_gang4swlabel_3, &style_device_gang4swlabel_3_main_main_default, LV_PART_MAIN|LV_STATE_DEFAULT); #ifdef CONFIG_OBJICT_IMAGE //Write codes device_gang4swbgimg_4 ui->device_gang4swbgimg_4 = lv_obj_create(ui->device_gang4cont); lv_obj_set_pos(ui->device_gang4swbgimg_4, 370, 83); lv_obj_set_size(ui->device_gang4swbgimg_4, 54, 54); lv_obj_set_style_radius(ui->device_gang4swbgimg_4, 30, LV_PART_MAIN|LV_STATE_DEFAULT); //lv_obj_set_style_bg_color(ui->device_gang4swbgimg_4, lv_color_make(0xeb, 0x95, 0x0f), LV_PART_MAIN|LV_STATE_DEFAULT); //lv_obj_set_style_bg_grad_color(ui->device_gang4swbgimg_4, lv_color_make(0xef, 0x95, 0x0f), LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_grad_dir(ui->device_gang4swbgimg_4, LV_GRAD_DIR_VER, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_opa(ui->device_gang4swbgimg_4, 255, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_border_color(ui->device_gang4swbgimg_4, lv_color_make(0xeb, 0x95, 0x0f), LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_border_width(ui->device_gang4swbgimg_4, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_border_opa(ui->device_gang4swbgimg_4, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_left(ui->device_gang4swbgimg_4, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_right(ui->device_gang4swbgimg_4, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_top(ui->device_gang4swbgimg_4, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_bottom(ui->device_gang4swbgimg_4, 0, LV_PART_MAIN|LV_STATE_DEFAULT); if(GET_nvs_Sys_Info_Gang4relay4()) { lv_obj_set_style_bg_color(ui->device_gang4swbgimg_4,lv_color_make(0xeb, 0x95, 0x0f), LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_grad_color(ui->device_gang4swbgimg_4, lv_color_make(0xef, 0x95, 0x0f), LV_PART_MAIN|LV_STATE_DEFAULT); } else { lv_obj_set_style_bg_color(ui->device_gang4swbgimg_4,lv_color_make(0xb2, 0xb2, 0xb2), LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_grad_color(ui->device_gang4swbgimg_4, lv_color_make(0xb2, 0xb2, 0xb2), LV_PART_MAIN|LV_STATE_DEFAULT); } #else //Write codes device_gang4swbgimg_4 ui->device_gang4swbgimg_4 = lv_img_create(ui->device_gang4cont); lv_obj_set_pos(ui->device_gang4swbgimg_4, 370, 83); lv_obj_set_size(ui->device_gang4swbgimg_4, 54, 54); //Write style state: LV_STATE_DEFAULT for style_device_gang4swbgimg_4_main_main_default static lv_style_t style_device_gang4swbgimg_4_main_main_default; lv_style_reset(&style_device_gang4swbgimg_4_main_main_default); lv_style_set_img_recolor(&style_device_gang4swbgimg_4_main_main_default, lv_color_make(0xff, 0xff, 0xff)); lv_style_set_img_recolor_opa(&style_device_gang4swbgimg_4_main_main_default, 0); lv_style_set_img_opa(&style_device_gang4swbgimg_4_main_main_default, 255); lv_obj_add_style(ui->device_gang4swbgimg_4, &style_device_gang4swbgimg_4_main_main_default, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_add_flag(ui->device_gang4swbgimg_4, LV_OBJ_FLAG_CLICKABLE); lv_img_set_src(ui->device_gang4swbgimg_4,LVGL_PATH(lightonbg.png)); lv_img_set_pivot(ui->device_gang4swbgimg_4, 0,0); lv_img_set_angle(ui->device_gang4swbgimg_4, 0); #endif //Write codes device_gang4swiconimg_4 ui->device_gang4swiconimg_4 = lv_img_create(ui->device_gang4cont); lv_obj_set_pos(ui->device_gang4swiconimg_4, 382, 94); lv_obj_set_size(ui->device_gang4swiconimg_4, 32, 32); //Write style state: LV_STATE_DEFAULT for style_device_gang4swiconimg_4_main_main_default static lv_style_t style_device_gang4swiconimg_4_main_main_default; lv_style_reset(&style_device_gang4swiconimg_4_main_main_default); lv_style_set_img_recolor(&style_device_gang4swiconimg_4_main_main_default, lv_color_make(0xff, 0xff, 0xff)); lv_style_set_img_recolor_opa(&style_device_gang4swiconimg_4_main_main_default, 0); lv_style_set_img_opa(&style_device_gang4swiconimg_4_main_main_default, 255); lv_obj_add_style(ui->device_gang4swiconimg_4, &style_device_gang4swiconimg_4_main_main_default, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_add_flag(ui->device_gang4swiconimg_4, LV_OBJ_FLAG_CLICKABLE); // lv_img_set_src(ui->device_gang4swiconimg_4,LVGL_PATH(onofflighton9.png)); if(GET_nvs_Sys_Info_Gang44icon()) { lv_img_set_src(ui->device_gang4swiconimg_4,onoff_keyligthimgon_ary[GET_nvs_Sys_Info_Gang44icon()]); } else { lv_img_set_src(ui->device_gang4swiconimg_4,LVGL_PATH(onofflighton10.png));//icon } lv_img_set_pivot(ui->device_gang4swiconimg_4, 0,0); lv_img_set_angle(ui->device_gang4swiconimg_4, 0); //Write codes device_gang4swbtn_4 ui->device_gang4swbtn_4 = lv_btn_create(ui->device_gang4cont); lv_obj_set_pos(ui->device_gang4swbtn_4, 370, 83); lv_obj_set_size(ui->device_gang4swbtn_4, 54, 54); //Write style state: LV_STATE_DEFAULT for style_device_gang4swbtn_4_main_main_default static lv_style_t style_device_gang4swbtn_4_main_main_default; lv_style_reset(&style_device_gang4swbtn_4_main_main_default); lv_style_set_radius(&style_device_gang4swbtn_4_main_main_default, 0); lv_style_set_bg_color(&style_device_gang4swbtn_4_main_main_default, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_bg_grad_color(&style_device_gang4swbtn_4_main_main_default, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_bg_grad_dir(&style_device_gang4swbtn_4_main_main_default, LV_GRAD_DIR_VER); lv_style_set_bg_opa(&style_device_gang4swbtn_4_main_main_default, 0); lv_style_set_shadow_color(&style_device_gang4swbtn_4_main_main_default, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_shadow_opa(&style_device_gang4swbtn_4_main_main_default, 0); lv_style_set_border_color(&style_device_gang4swbtn_4_main_main_default, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_border_width(&style_device_gang4swbtn_4_main_main_default, 0); lv_style_set_border_opa(&style_device_gang4swbtn_4_main_main_default, 0); lv_obj_add_style(ui->device_gang4swbtn_4, &style_device_gang4swbtn_4_main_main_default, LV_PART_MAIN|LV_STATE_DEFAULT); ui->device_gang4swbtn_4_label = lv_label_create(ui->device_gang4swbtn_4); lv_label_set_text(ui->device_gang4swbtn_4_label, ""); lv_obj_set_style_text_color(ui->device_gang4swbtn_4_label, lv_color_make(0x00, 0x00, 0x00), LV_STATE_DEFAULT); lv_obj_set_style_pad_all(ui->device_gang4swbtn_4, 0, LV_STATE_DEFAULT); lv_obj_align(ui->device_gang4swbtn_4_label, LV_ALIGN_CENTER, 0, 0); //Write codes device_gang4swlabel_4 ui->device_gang4swlabel_4 = lv_label_create(ui->device_gang4cont); lv_obj_set_pos(ui->device_gang4swlabel_4, 350, 140); lv_obj_set_size(ui->device_gang4swlabel_4, 100, 24); // lv_label_set_text(ui->device_gang4swlabel_4, "Spotlight"); if( strlen((const char*)nvs_Sys_Info_SysInfo.gang4_sw4.Label) )//用户自己设置的文字(自由设置 不分语言) { lv_label_set_text_fmt(ui->device_gang4swlabel_4, "%s",nvs_Sys_Info_SysInfo.gang4_sw4.Label); } else { lv_label_set_text(ui->device_gang4swlabel_4,Menu_List[GET_nvs_Sys_Info_language()][MENU_LIST_GANG44]); } lv_label_set_long_mode(ui->device_gang4swlabel_4, LV_LABEL_LONG_DOT); lv_obj_set_style_text_align(ui->device_gang4swlabel_4, LV_TEXT_ALIGN_CENTER, 0); //Write style state: LV_STATE_DEFAULT for style_device_gang4swlabel_4_main_main_default static lv_style_t style_device_gang4swlabel_4_main_main_default; lv_style_reset(&style_device_gang4swlabel_4_main_main_default); lv_style_set_radius(&style_device_gang4swlabel_4_main_main_default, 0); lv_style_set_bg_color(&style_device_gang4swlabel_4_main_main_default, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_bg_grad_color(&style_device_gang4swlabel_4_main_main_default, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_bg_grad_dir(&style_device_gang4swlabel_4_main_main_default, LV_GRAD_DIR_VER); lv_style_set_bg_opa(&style_device_gang4swlabel_4_main_main_default, 0); lv_style_set_text_color(&style_device_gang4swlabel_4_main_main_default, lv_color_make(0xff, 0xff, 0xff)); lv_style_set_text_font(&style_device_gang4swlabel_4_main_main_default, &lv_font_simsun_16); lv_style_set_text_letter_space(&style_device_gang4swlabel_4_main_main_default, 0); lv_style_set_pad_left(&style_device_gang4swlabel_4_main_main_default, 0); lv_style_set_pad_right(&style_device_gang4swlabel_4_main_main_default, 0); lv_style_set_pad_top(&style_device_gang4swlabel_4_main_main_default, 0); lv_style_set_pad_bottom(&style_device_gang4swlabel_4_main_main_default, 0); lv_obj_add_style(ui->device_gang4swlabel_4, &style_device_gang4swlabel_4_main_main_default, LV_PART_MAIN|LV_STATE_DEFAULT); //Init events for screen events_init_device_gang4(ui); } //场景开关6路 void create_device_gang6(lv_ui *ui,lv_obj_t * parent, lv_coord_t x, lv_coord_t y,lv_coord_t w, lv_coord_t h) { if(!parent) { return; } //Write codes device_gang4cont ui->device_gang6cont = lv_obj_create(parent); lv_obj_set_pos(ui->device_gang6cont, x, y); lv_obj_set_size(ui->device_gang6cont, w, h); //Write style state: LV_STATE_DEFAULT for style_device_gang6cont_main_main_default static lv_style_t style_device_gang6cont_main_main_default; lv_style_reset(&style_device_gang6cont_main_main_default); lv_style_set_radius(&style_device_gang6cont_main_main_default, 15); lv_style_set_bg_color(&style_device_gang6cont_main_main_default, lv_color_make(0x25, 0x25, 0x25)); lv_style_set_bg_grad_color(&style_device_gang6cont_main_main_default, lv_color_make(0x25, 0x25, 0x25)); lv_style_set_bg_grad_dir(&style_device_gang6cont_main_main_default, LV_GRAD_DIR_VER); lv_style_set_bg_opa(&style_device_gang6cont_main_main_default, 255); lv_style_set_border_color(&style_device_gang6cont_main_main_default, lv_color_make(0xff, 0xff, 0xff)); lv_style_set_border_width(&style_device_gang6cont_main_main_default, 0); lv_style_set_border_opa(&style_device_gang6cont_main_main_default, 0); lv_style_set_pad_left(&style_device_gang6cont_main_main_default, 0); lv_style_set_pad_right(&style_device_gang6cont_main_main_default, 0); lv_style_set_pad_top(&style_device_gang6cont_main_main_default, 0); lv_style_set_pad_bottom(&style_device_gang6cont_main_main_default, 0); lv_obj_add_style(ui->device_gang6cont, &style_device_gang6cont_main_main_default, LV_PART_MAIN|LV_STATE_DEFAULT); //Write codes device_gang6img ui->device_gang6img = lv_img_create(ui->device_gang6cont); lv_obj_set_pos(ui->device_gang6img, 19, 13); lv_obj_set_size(ui->device_gang6img, 54, 54); //Write style state: LV_STATE_DEFAULT for style_device_gang6img_main_main_default static lv_style_t style_device_gang6img_main_main_default; lv_style_reset(&style_device_gang6img_main_main_default); lv_style_set_img_recolor(&style_device_gang6img_main_main_default, lv_color_make(0xff, 0xff, 0xff)); lv_style_set_img_recolor_opa(&style_device_gang6img_main_main_default, 0); lv_style_set_img_opa(&style_device_gang6img_main_main_default, 255); lv_obj_add_style(ui->device_gang6img, &style_device_gang6img_main_main_default, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_add_flag(ui->device_gang6img, LV_OBJ_FLAG_CLICKABLE); lv_img_set_src(ui->device_gang6img,LVGL_PATH(lightonbg.png)); lv_img_set_pivot(ui->device_gang6img, 0,0); lv_img_set_angle(ui->device_gang6img, 0); //Write codes device_gang6icon_img ui->device_gang6icon_img = lv_img_create(ui->device_gang6cont); lv_obj_set_pos(ui->device_gang6icon_img, 32, 25); lv_obj_set_size(ui->device_gang6icon_img, 30, 30); //Write style state: LV_STATE_DEFAULT for style_device_gang6icon_img_main_main_default static lv_style_t style_device_gang6icon_img_main_main_default; lv_style_reset(&style_device_gang6icon_img_main_main_default); lv_style_set_img_recolor(&style_device_gang6icon_img_main_main_default, lv_color_make(0xff, 0xff, 0xff)); lv_style_set_img_recolor_opa(&style_device_gang6icon_img_main_main_default, 0); lv_style_set_img_opa(&style_device_gang6icon_img_main_main_default, 255); lv_obj_add_style(ui->device_gang6icon_img, &style_device_gang6icon_img_main_main_default, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_add_flag(ui->device_gang6icon_img, LV_OBJ_FLAG_CLICKABLE); lv_img_set_src(ui->device_gang6icon_img,LVGL_PATH(devgangicon.png)); lv_img_set_pivot(ui->device_gang6icon_img, 0,0); lv_img_set_angle(ui->device_gang6icon_img, 0); //Write codes device_gang6btn_1 ui->device_gang6btn_1 = lv_btn_create(ui->device_gang6cont); lv_obj_set_pos(ui->device_gang6btn_1, 21, 14); lv_obj_set_size(ui->device_gang6btn_1, 52, 52); //Write style state: LV_STATE_DEFAULT for style_device_gang6btn_1_main_main_default static lv_style_t style_device_gang6btn_1_main_main_default; lv_style_reset(&style_device_gang6btn_1_main_main_default); lv_style_set_radius(&style_device_gang6btn_1_main_main_default, 0); lv_style_set_bg_color(&style_device_gang6btn_1_main_main_default, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_bg_grad_color(&style_device_gang6btn_1_main_main_default, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_bg_grad_dir(&style_device_gang6btn_1_main_main_default, LV_GRAD_DIR_VER); lv_style_set_bg_opa(&style_device_gang6btn_1_main_main_default, 0); lv_style_set_shadow_color(&style_device_gang6btn_1_main_main_default, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_shadow_opa(&style_device_gang6btn_1_main_main_default, 0); lv_style_set_border_color(&style_device_gang6btn_1_main_main_default, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_border_width(&style_device_gang6btn_1_main_main_default, 0); lv_style_set_border_opa(&style_device_gang6btn_1_main_main_default, 0); lv_obj_add_style(ui->device_gang6btn_1, &style_device_gang6btn_1_main_main_default, LV_PART_MAIN|LV_STATE_DEFAULT); ui->device_gang6btn_1_label = lv_label_create(ui->device_gang6btn_1); lv_label_set_text(ui->device_gang6btn_1_label, ""); lv_obj_set_style_text_color(ui->device_gang6btn_1_label, lv_color_make(0x00, 0x00, 0x00), LV_STATE_DEFAULT); lv_obj_set_style_pad_all(ui->device_gang6btn_1, 0, LV_STATE_DEFAULT); lv_obj_align(ui->device_gang6btn_1_label, LV_ALIGN_CENTER, 0, 0); //Write codes device_gang6label_1 ui->device_gang6label_1 = lv_label_create(ui->device_gang6cont); lv_obj_set_pos(ui->device_gang6label_1, 91, 30); lv_obj_set_size(ui->device_gang6label_1, 200, 24); // lv_label_set_text(ui->device_gang6label_1, "Scene 6 Gang switch"); lv_label_set_text(ui->device_gang6label_1,Menu_List[GET_nvs_Sys_Info_language()][MENU_LIST_GANG6_NAME]); lv_label_set_long_mode(ui->device_gang6label_1, LV_LABEL_LONG_DOT); lv_obj_set_style_text_align(ui->device_gang6label_1, LV_TEXT_ALIGN_LEFT, 0); //Write style state: LV_STATE_DEFAULT for style_device_gang6label_1_main_main_default static lv_style_t style_device_gang6label_1_main_main_default; lv_style_reset(&style_device_gang6label_1_main_main_default); lv_style_set_radius(&style_device_gang6label_1_main_main_default, 0); lv_style_set_bg_color(&style_device_gang6label_1_main_main_default, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_bg_grad_color(&style_device_gang6label_1_main_main_default, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_bg_grad_dir(&style_device_gang6label_1_main_main_default, LV_GRAD_DIR_VER); lv_style_set_bg_opa(&style_device_gang6label_1_main_main_default, 0); lv_style_set_text_color(&style_device_gang6label_1_main_main_default, lv_color_make(0xff, 0xff, 0xff)); lv_style_set_text_font(&style_device_gang6label_1_main_main_default, &lv_font_simsun_16); lv_style_set_text_letter_space(&style_device_gang6label_1_main_main_default, 0); lv_style_set_pad_left(&style_device_gang6label_1_main_main_default, 0); lv_style_set_pad_right(&style_device_gang6label_1_main_main_default, 0); lv_style_set_pad_top(&style_device_gang6label_1_main_main_default, 0); lv_style_set_pad_bottom(&style_device_gang6label_1_main_main_default, 0); lv_obj_add_style(ui->device_gang6label_1, &style_device_gang6label_1_main_main_default, LV_PART_MAIN|LV_STATE_DEFAULT); //Write codes device_gang6imgbtn_1 ui->device_gang6imgbtn_1 = lv_switch_create(ui->device_gang6cont); lv_obj_set_pos(ui->device_gang6imgbtn_1, 362, 27); lv_obj_set_size(ui->device_gang6imgbtn_1, 60, 28); if( GET_nvs_Sys_Info_Gang6relay1() &&GET_nvs_Sys_Info_Gang6relay2() &&GET_nvs_Sys_Info_Gang6relay3() &&GET_nvs_Sys_Info_Gang6relay4() &&GET_nvs_Sys_Info_Gang6relay5() &&GET_nvs_Sys_Info_Gang6relay6() ) { lv_obj_add_state(ui->device_gang6imgbtn_1, LV_STATE_CHECKED);//on } else { lv_obj_clear_state(ui->device_gang6imgbtn_1, LV_STATE_CHECKED);//off } //Write style state: LV_STATE_DEFAULT for style_device_gang6imgbtn_1_main_main_default static lv_style_t style_device_gang6imgbtn_1_main_main_default; lv_style_reset(&style_device_gang6imgbtn_1_main_main_default); lv_style_set_radius(&style_device_gang6imgbtn_1_main_main_default, 100); lv_style_set_bg_color(&style_device_gang6imgbtn_1_main_main_default, lv_color_make(0xaa, 0xaa, 0xaa)); lv_style_set_bg_grad_color(&style_device_gang6imgbtn_1_main_main_default, lv_color_make(0xaa, 0xaa, 0xaa)); lv_style_set_bg_grad_dir(&style_device_gang6imgbtn_1_main_main_default, LV_GRAD_DIR_VER); lv_style_set_bg_opa(&style_device_gang6imgbtn_1_main_main_default, 46); lv_obj_add_style(ui->device_gang6imgbtn_1, &style_device_gang6imgbtn_1_main_main_default, LV_PART_MAIN|LV_STATE_DEFAULT); //Write style state: LV_STATE_CHECKED for style_device_gang6imgbtn_1_main_indicator_checked static lv_style_t style_device_gang6imgbtn_1_main_indicator_checked; lv_style_reset(&style_device_gang6imgbtn_1_main_indicator_checked); lv_style_set_radius(&style_device_gang6imgbtn_1_main_indicator_checked, 100); lv_style_set_bg_color(&style_device_gang6imgbtn_1_main_indicator_checked, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_bg_grad_color(&style_device_gang6imgbtn_1_main_indicator_checked, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_bg_grad_dir(&style_device_gang6imgbtn_1_main_indicator_checked, LV_GRAD_DIR_VER); lv_style_set_bg_opa(&style_device_gang6imgbtn_1_main_indicator_checked, 255); lv_obj_add_style(ui->device_gang6imgbtn_1, &style_device_gang6imgbtn_1_main_indicator_checked, LV_PART_INDICATOR|LV_STATE_CHECKED); //Write style state: LV_STATE_DEFAULT for style_device_gang6imgbtn_1_main_knob_default static lv_style_t style_device_gang6imgbtn_1_main_knob_default; lv_style_reset(&style_device_gang6imgbtn_1_main_knob_default); lv_style_set_radius(&style_device_gang6imgbtn_1_main_knob_default, 100); lv_style_set_bg_color(&style_device_gang6imgbtn_1_main_knob_default, lv_color_make(0xff, 0xff, 0xff)); lv_style_set_bg_grad_color(&style_device_gang6imgbtn_1_main_knob_default, lv_color_make(0xff, 0xff, 0xff)); lv_style_set_bg_grad_dir(&style_device_gang6imgbtn_1_main_knob_default, LV_GRAD_DIR_VER); lv_style_set_bg_opa(&style_device_gang6imgbtn_1_main_knob_default, 255); lv_obj_add_style(ui->device_gang6imgbtn_1, &style_device_gang6imgbtn_1_main_knob_default, LV_PART_KNOB|LV_STATE_DEFAULT); #ifdef CONFIG_OBJICT_IMAGE //Write codes device_gang6swbgimg_1 ui->device_gang6swbgimg_1 = lv_obj_create(ui->device_gang6cont); lv_obj_set_pos(ui->device_gang6swbgimg_1, 71, 84); lv_obj_set_size(ui->device_gang6swbgimg_1, 54, 54); lv_obj_set_style_radius(ui->device_gang6swbgimg_1, 30, LV_PART_MAIN|LV_STATE_DEFAULT); //lv_obj_set_style_bg_color(ui->device_gang6swbgimg_1, lv_color_make(0xeb, 0x95, 0x0f), LV_PART_MAIN|LV_STATE_DEFAULT); //lv_obj_set_style_bg_grad_color(ui->device_gang6swbgimg_1, lv_color_make(0xef, 0x95, 0x0f), LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_grad_dir(ui->device_gang6swbgimg_1, LV_GRAD_DIR_VER, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_opa(ui->device_gang6swbgimg_1, 255, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_border_color(ui->device_gang6swbgimg_1, lv_color_make(0xeb, 0x95, 0x0f), LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_border_width(ui->device_gang6swbgimg_1, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_border_opa(ui->device_gang6swbgimg_1, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_left(ui->device_gang6swbgimg_1, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_right(ui->device_gang6swbgimg_1, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_top(ui->device_gang6swbgimg_1, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_bottom(ui->device_gang6swbgimg_1, 0, LV_PART_MAIN|LV_STATE_DEFAULT); if(GET_nvs_Sys_Info_Gang6relay1()) { lv_obj_set_style_bg_color(ui->device_gang6swbgimg_1,lv_color_make(0xeb, 0x95, 0x0f), LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_grad_color(ui->device_gang6swbgimg_1, lv_color_make(0xef, 0x95, 0x0f), LV_PART_MAIN|LV_STATE_DEFAULT); } else { lv_obj_set_style_bg_color(ui->device_gang6swbgimg_1,lv_color_make(0xb2, 0xb2, 0xb2), LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_grad_color(ui->device_gang6swbgimg_1, lv_color_make(0xb2, 0xb2, 0xb2), LV_PART_MAIN|LV_STATE_DEFAULT); } #else //Write codes device_gang6swbgimg_1 ui->device_gang6swbgimg_1 = lv_img_create(ui->device_gang6cont); lv_obj_set_pos(ui->device_gang6swbgimg_1, 71, 84); lv_obj_set_size(ui->device_gang6swbgimg_1, 54, 54); //Write style state: LV_STATE_DEFAULT for style_device_gang6swbgimg_1_main_main_default static lv_style_t style_device_gang6swbgimg_1_main_main_default; lv_style_reset(&style_device_gang6swbgimg_1_main_main_default); lv_style_set_img_recolor(&style_device_gang6swbgimg_1_main_main_default, lv_color_make(0xff, 0xff, 0xff)); lv_style_set_img_recolor_opa(&style_device_gang6swbgimg_1_main_main_default, 0); lv_style_set_img_opa(&style_device_gang6swbgimg_1_main_main_default, 255); lv_obj_add_style(ui->device_gang6swbgimg_1, &style_device_gang6swbgimg_1_main_main_default, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_add_flag(ui->device_gang6swbgimg_1, LV_OBJ_FLAG_CLICKABLE); lv_img_set_src(ui->device_gang6swbgimg_1,LVGL_PATH(lightonbg.png)); lv_img_set_pivot(ui->device_gang6swbgimg_1, 0,0); lv_img_set_angle(ui->device_gang6swbgimg_1, 0); #endif //Write codes device_gang6swiconimg_1 ui->device_gang6swiconimg_1 = lv_img_create(ui->device_gang6cont); lv_obj_set_pos(ui->device_gang6swiconimg_1, 83, 96); lv_obj_set_size(ui->device_gang6swiconimg_1, 32, 32); //Write style state: LV_STATE_DEFAULT for style_device_gang6swiconimg_1_main_main_default static lv_style_t style_device_gang6swiconimg_1_main_main_default; lv_style_reset(&style_device_gang6swiconimg_1_main_main_default); lv_style_set_img_recolor(&style_device_gang6swiconimg_1_main_main_default, lv_color_make(0xff, 0xff, 0xff)); lv_style_set_img_recolor_opa(&style_device_gang6swiconimg_1_main_main_default, 0); lv_style_set_img_opa(&style_device_gang6swiconimg_1_main_main_default, 255); lv_obj_add_style(ui->device_gang6swiconimg_1, &style_device_gang6swiconimg_1_main_main_default, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_add_flag(ui->device_gang6swiconimg_1, LV_OBJ_FLAG_CLICKABLE); //lv_img_set_src(ui->device_gang6swiconimg_1,LVGL_PATH(onofflightoff7.png)); if(GET_nvs_Sys_Info_Gang61icon()) { lv_img_set_src(ui->device_gang6swiconimg_1,onoff_keyligthimgon_ary[GET_nvs_Sys_Info_Gang61icon()]); } else { lv_img_set_src(ui->device_gang6swiconimg_1,LVGL_PATH(onofflighton7.png));//icon } lv_img_set_pivot(ui->device_gang6swiconimg_1, 0,0); lv_img_set_angle(ui->device_gang6swiconimg_1, 0); //Write codes device_gang6swbtn_1 ui->device_gang6swbtn_1 = lv_btn_create(ui->device_gang6cont); lv_obj_set_pos(ui->device_gang6swbtn_1, 71, 84); lv_obj_set_size(ui->device_gang6swbtn_1, 54, 54); //Write style state: LV_STATE_DEFAULT for style_device_gang6swbtn_1_main_main_default static lv_style_t style_device_gang6swbtn_1_main_main_default; lv_style_reset(&style_device_gang6swbtn_1_main_main_default); lv_style_set_radius(&style_device_gang6swbtn_1_main_main_default, 0); lv_style_set_bg_color(&style_device_gang6swbtn_1_main_main_default, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_bg_grad_color(&style_device_gang6swbtn_1_main_main_default, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_bg_grad_dir(&style_device_gang6swbtn_1_main_main_default, LV_GRAD_DIR_VER); lv_style_set_bg_opa(&style_device_gang6swbtn_1_main_main_default, 0); lv_style_set_shadow_color(&style_device_gang6swbtn_1_main_main_default, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_shadow_opa(&style_device_gang6swbtn_1_main_main_default, 0); lv_style_set_border_color(&style_device_gang6swbtn_1_main_main_default, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_border_width(&style_device_gang6swbtn_1_main_main_default, 0); lv_style_set_border_opa(&style_device_gang6swbtn_1_main_main_default, 0); lv_obj_add_style(ui->device_gang6swbtn_1, &style_device_gang6swbtn_1_main_main_default, LV_PART_MAIN|LV_STATE_DEFAULT); ui->device_gang6swbtn_1_label = lv_label_create(ui->device_gang6swbtn_1); lv_label_set_text(ui->device_gang6swbtn_1_label, ""); lv_obj_set_style_text_color(ui->device_gang6swbtn_1_label, lv_color_make(0x00, 0x00, 0x00), LV_STATE_DEFAULT); lv_obj_set_style_pad_all(ui->device_gang6swbtn_1, 0, LV_STATE_DEFAULT); lv_obj_align(ui->device_gang6swbtn_1_label, LV_ALIGN_CENTER, 0, 0); //Write codes device_gang6swlabel_1 ui->device_gang6swlabel_1 = lv_label_create(ui->device_gang6cont); lv_obj_set_pos(ui->device_gang6swlabel_1, 48, 141); lv_obj_set_size(ui->device_gang6swlabel_1, 120, 22); //lv_label_set_text(ui->device_gang6swlabel_1, "Chandelier"); if( strlen((const char*)nvs_Sys_Info_SysInfo.gang6_sw1.Label) )//用户自己设置的文字(自由设置 不分语言) { lv_label_set_text_fmt(ui->device_gang6swlabel_1, "%s",nvs_Sys_Info_SysInfo.gang6_sw1.Label); } else { lv_label_set_text(ui->device_gang6swlabel_1,Menu_List[GET_nvs_Sys_Info_language()][MENU_LIST_GANG61]); } lv_label_set_long_mode(ui->device_gang6swlabel_1, LV_LABEL_LONG_DOT); lv_obj_set_style_text_align(ui->device_gang6swlabel_1, LV_TEXT_ALIGN_CENTER, 0); //Write style state: LV_STATE_DEFAULT for style_device_gang6swlabel_1_main_main_default static lv_style_t style_device_gang6swlabel_1_main_main_default; lv_style_reset(&style_device_gang6swlabel_1_main_main_default); lv_style_set_radius(&style_device_gang6swlabel_1_main_main_default, 0); lv_style_set_bg_color(&style_device_gang6swlabel_1_main_main_default, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_bg_grad_color(&style_device_gang6swlabel_1_main_main_default, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_bg_grad_dir(&style_device_gang6swlabel_1_main_main_default, LV_GRAD_DIR_VER); lv_style_set_bg_opa(&style_device_gang6swlabel_1_main_main_default, 0); lv_style_set_text_color(&style_device_gang6swlabel_1_main_main_default, lv_color_make(0xff, 0xff, 0xff)); lv_style_set_text_font(&style_device_gang6swlabel_1_main_main_default, &lv_font_simsun_16); lv_style_set_text_letter_space(&style_device_gang6swlabel_1_main_main_default, 0); lv_style_set_pad_left(&style_device_gang6swlabel_1_main_main_default, 0); lv_style_set_pad_right(&style_device_gang6swlabel_1_main_main_default, 0); lv_style_set_pad_top(&style_device_gang6swlabel_1_main_main_default, 0); lv_style_set_pad_bottom(&style_device_gang6swlabel_1_main_main_default, 0); lv_obj_add_style(ui->device_gang6swlabel_1, &style_device_gang6swlabel_1_main_main_default, LV_PART_MAIN|LV_STATE_DEFAULT); #ifdef CONFIG_OBJICT_IMAGE //Write codes device_gang6swbgimg_2 ui->device_gang6swbgimg_2 = lv_obj_create(ui->device_gang6cont); lv_obj_set_pos(ui->device_gang6swbgimg_2, 191, 84); lv_obj_set_size(ui->device_gang6swbgimg_2, 54, 54); lv_obj_set_style_radius(ui->device_gang6swbgimg_2, 30, LV_PART_MAIN|LV_STATE_DEFAULT); //lv_obj_set_style_bg_color(ui->device_gang6swbgimg_2, lv_color_make(0xeb, 0x95, 0x0f), LV_PART_MAIN|LV_STATE_DEFAULT); //lv_obj_set_style_bg_grad_color(ui->device_gang6swbgimg_2, lv_color_make(0xef, 0x95, 0x0f), LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_grad_dir(ui->device_gang6swbgimg_2, LV_GRAD_DIR_VER, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_opa(ui->device_gang6swbgimg_2, 255, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_border_color(ui->device_gang6swbgimg_2, lv_color_make(0xeb, 0x95, 0x0f), LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_border_width(ui->device_gang6swbgimg_2, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_border_opa(ui->device_gang6swbgimg_2, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_left(ui->device_gang6swbgimg_2, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_right(ui->device_gang6swbgimg_2, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_top(ui->device_gang6swbgimg_2, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_bottom(ui->device_gang6swbgimg_2, 0, LV_PART_MAIN|LV_STATE_DEFAULT); if(GET_nvs_Sys_Info_Gang6relay2()) { lv_obj_set_style_bg_color(ui->device_gang6swbgimg_2,lv_color_make(0xeb, 0x95, 0x0f), LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_grad_color(ui->device_gang6swbgimg_2, lv_color_make(0xef, 0x95, 0x0f), LV_PART_MAIN|LV_STATE_DEFAULT); } else { lv_obj_set_style_bg_color(ui->device_gang6swbgimg_2,lv_color_make(0xb2, 0xb2, 0xb2), LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_grad_color(ui->device_gang6swbgimg_2, lv_color_make(0xb2, 0xb2, 0xb2), LV_PART_MAIN|LV_STATE_DEFAULT); } #else //Write codes device_gang6swbgimg_2 ui->device_gang6swbgimg_2 = lv_img_create(ui->device_gang6cont); lv_obj_set_pos(ui->device_gang6swbgimg_2, 191, 84); lv_obj_set_size(ui->device_gang6swbgimg_2, 54, 54); //Write style state: LV_STATE_DEFAULT for style_device_gang6swbgimg_2_main_main_default static lv_style_t style_device_gang6swbgimg_2_main_main_default; lv_style_reset(&style_device_gang6swbgimg_2_main_main_default); lv_style_set_img_recolor(&style_device_gang6swbgimg_2_main_main_default, lv_color_make(0xff, 0xff, 0xff)); lv_style_set_img_recolor_opa(&style_device_gang6swbgimg_2_main_main_default, 0); lv_style_set_img_opa(&style_device_gang6swbgimg_2_main_main_default, 255); lv_obj_add_style(ui->device_gang6swbgimg_2, &style_device_gang6swbgimg_2_main_main_default, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_add_flag(ui->device_gang6swbgimg_2, LV_OBJ_FLAG_CLICKABLE); lv_img_set_src(ui->device_gang6swbgimg_2,LVGL_PATH(lightonbg.png)); lv_img_set_pivot(ui->device_gang6swbgimg_2, 0,0); lv_img_set_angle(ui->device_gang6swbgimg_2, 0); #endif //Write codes device_gang6swiconimg_2 ui->device_gang6swiconimg_2 = lv_img_create(ui->device_gang6cont); lv_obj_set_pos(ui->device_gang6swiconimg_2, 203, 95); lv_obj_set_size(ui->device_gang6swiconimg_2, 32, 32); //Write style state: LV_STATE_DEFAULT for style_device_gang6swiconimg_2_main_main_default static lv_style_t style_device_gang6swiconimg_2_main_main_default; lv_style_reset(&style_device_gang6swiconimg_2_main_main_default); lv_style_set_img_recolor(&style_device_gang6swiconimg_2_main_main_default, lv_color_make(0xff, 0xff, 0xff)); lv_style_set_img_recolor_opa(&style_device_gang6swiconimg_2_main_main_default, 0); lv_style_set_img_opa(&style_device_gang6swiconimg_2_main_main_default, 255); lv_obj_add_style(ui->device_gang6swiconimg_2, &style_device_gang6swiconimg_2_main_main_default, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_add_flag(ui->device_gang6swiconimg_2, LV_OBJ_FLAG_CLICKABLE); // lv_img_set_src(ui->device_gang6swiconimg_2,LVGL_PATH(iconLightstrip.png)); if(GET_nvs_Sys_Info_Gang62icon()) { lv_img_set_src(ui->device_gang6swiconimg_2,onoff_keyligthimgon_ary[GET_nvs_Sys_Info_Gang62icon()]); } else { lv_img_set_src(ui->device_gang6swiconimg_2,LVGL_PATH(onofflighton2.png));//icon } lv_img_set_pivot(ui->device_gang6swiconimg_2, 0,0); lv_img_set_angle(ui->device_gang6swiconimg_2, 0); //Write codes device_gang6swbtn_2 ui->device_gang6swbtn_2 = lv_btn_create(ui->device_gang6cont); lv_obj_set_pos(ui->device_gang6swbtn_2, 191, 84); lv_obj_set_size(ui->device_gang6swbtn_2, 54, 54); //Write style state: LV_STATE_DEFAULT for style_device_gang6swbtn_2_main_main_default static lv_style_t style_device_gang6swbtn_2_main_main_default; lv_style_reset(&style_device_gang6swbtn_2_main_main_default); lv_style_set_radius(&style_device_gang6swbtn_2_main_main_default, 0); lv_style_set_bg_color(&style_device_gang6swbtn_2_main_main_default, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_bg_grad_color(&style_device_gang6swbtn_2_main_main_default, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_bg_grad_dir(&style_device_gang6swbtn_2_main_main_default, LV_GRAD_DIR_VER); lv_style_set_bg_opa(&style_device_gang6swbtn_2_main_main_default, 0); lv_style_set_shadow_color(&style_device_gang6swbtn_2_main_main_default, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_shadow_opa(&style_device_gang6swbtn_2_main_main_default, 0); lv_style_set_border_color(&style_device_gang6swbtn_2_main_main_default, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_border_width(&style_device_gang6swbtn_2_main_main_default, 0); lv_style_set_border_opa(&style_device_gang6swbtn_2_main_main_default, 0); lv_obj_add_style(ui->device_gang6swbtn_2, &style_device_gang6swbtn_2_main_main_default, LV_PART_MAIN|LV_STATE_DEFAULT); ui->device_gang6swbtn_2_label = lv_label_create(ui->device_gang6swbtn_2); lv_label_set_text(ui->device_gang6swbtn_2_label, ""); lv_obj_set_style_text_color(ui->device_gang6swbtn_2_label, lv_color_make(0x00, 0x00, 0x00), LV_STATE_DEFAULT); lv_obj_set_style_pad_all(ui->device_gang6swbtn_2, 0, LV_STATE_DEFAULT); lv_obj_align(ui->device_gang6swbtn_2_label, LV_ALIGN_CENTER, 0, 0); //Write codes device_gang6swlabel_2 ui->device_gang6swlabel_2 = lv_label_create(ui->device_gang6cont); lv_obj_set_pos(ui->device_gang6swlabel_2, 171, 141); lv_obj_set_size(ui->device_gang6swlabel_2, 100, 22); // lv_label_set_text(ui->device_gang6swlabel_2, "Downlight"); if( strlen((const char*)nvs_Sys_Info_SysInfo.gang6_sw2.Label) )//用户自己设置的文字(自由设置 不分语言) { lv_label_set_text_fmt(ui->device_gang6swlabel_2, "%s",nvs_Sys_Info_SysInfo.gang6_sw2.Label); } else { lv_label_set_text(ui->device_gang6swlabel_2,Menu_List[GET_nvs_Sys_Info_language()][MENU_LIST_GANG62]); } lv_label_set_long_mode(ui->device_gang6swlabel_2, LV_LABEL_LONG_DOT); lv_obj_set_style_text_align(ui->device_gang6swlabel_2, LV_TEXT_ALIGN_CENTER, 0); //Write style state: LV_STATE_DEFAULT for style_device_gang6swlabel_2_main_main_default static lv_style_t style_device_gang6swlabel_2_main_main_default; lv_style_reset(&style_device_gang6swlabel_2_main_main_default); lv_style_set_radius(&style_device_gang6swlabel_2_main_main_default, 0); lv_style_set_bg_color(&style_device_gang6swlabel_2_main_main_default, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_bg_grad_color(&style_device_gang6swlabel_2_main_main_default, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_bg_grad_dir(&style_device_gang6swlabel_2_main_main_default, LV_GRAD_DIR_VER); lv_style_set_bg_opa(&style_device_gang6swlabel_2_main_main_default, 0); lv_style_set_text_color(&style_device_gang6swlabel_2_main_main_default, lv_color_make(0xff, 0xff, 0xff)); lv_style_set_text_font(&style_device_gang6swlabel_2_main_main_default, &lv_font_simsun_16); lv_style_set_text_letter_space(&style_device_gang6swlabel_2_main_main_default, 0); lv_style_set_pad_left(&style_device_gang6swlabel_2_main_main_default, 0); lv_style_set_pad_right(&style_device_gang6swlabel_2_main_main_default, 0); lv_style_set_pad_top(&style_device_gang6swlabel_2_main_main_default, 0); lv_style_set_pad_bottom(&style_device_gang6swlabel_2_main_main_default, 0); lv_obj_add_style(ui->device_gang6swlabel_2, &style_device_gang6swlabel_2_main_main_default, LV_PART_MAIN|LV_STATE_DEFAULT); #ifdef CONFIG_OBJICT_IMAGE //Write codes device_gang6swbgimg_3 ui->device_gang6swbgimg_3 = lv_obj_create(ui->device_gang6cont); lv_obj_set_pos(ui->device_gang6swbgimg_3, 304, 84); lv_obj_set_size(ui->device_gang6swbgimg_3, 54, 54); lv_obj_set_style_radius(ui->device_gang6swbgimg_3, 30, LV_PART_MAIN|LV_STATE_DEFAULT); //lv_obj_set_style_bg_color(ui->device_gang6swbgimg_3, lv_color_make(0xeb, 0x95, 0x0f), LV_PART_MAIN|LV_STATE_DEFAULT); //lv_obj_set_style_bg_grad_color(ui->device_gang6swbgimg_3, lv_color_make(0xef, 0x95, 0x0f), LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_grad_dir(ui->device_gang6swbgimg_3, LV_GRAD_DIR_VER, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_opa(ui->device_gang6swbgimg_3, 255, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_border_color(ui->device_gang6swbgimg_3, lv_color_make(0xeb, 0x95, 0x0f), LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_border_width(ui->device_gang6swbgimg_3, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_border_opa(ui->device_gang6swbgimg_3, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_left(ui->device_gang6swbgimg_3, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_right(ui->device_gang6swbgimg_3, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_top(ui->device_gang6swbgimg_3, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_bottom(ui->device_gang6swbgimg_3, 0, LV_PART_MAIN|LV_STATE_DEFAULT); if(GET_nvs_Sys_Info_Gang6relay3()) { lv_obj_set_style_bg_color(ui->device_gang6swbgimg_3,lv_color_make(0xeb, 0x95, 0x0f), LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_grad_color(ui->device_gang6swbgimg_3, lv_color_make(0xef, 0x95, 0x0f), LV_PART_MAIN|LV_STATE_DEFAULT); } else { lv_obj_set_style_bg_color(ui->device_gang6swbgimg_3,lv_color_make(0xb2, 0xb2, 0xb2), LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_grad_color(ui->device_gang6swbgimg_3, lv_color_make(0xb2, 0xb2, 0xb2), LV_PART_MAIN|LV_STATE_DEFAULT); } #else //Write codes device_gang6swbgimg_3 ui->device_gang6swbgimg_3 = lv_img_create(ui->device_gang6cont); lv_obj_set_pos(ui->device_gang6swbgimg_3, 304, 84); lv_obj_set_size(ui->device_gang6swbgimg_3, 54, 54); //Write style state: LV_STATE_DEFAULT for style_device_gang6swbgimg_3_main_main_default static lv_style_t style_device_gang6swbgimg_3_main_main_default; lv_style_reset(&style_device_gang6swbgimg_3_main_main_default); lv_style_set_img_recolor(&style_device_gang6swbgimg_3_main_main_default, lv_color_make(0xff, 0xff, 0xff)); lv_style_set_img_recolor_opa(&style_device_gang6swbgimg_3_main_main_default, 0); lv_style_set_img_opa(&style_device_gang6swbgimg_3_main_main_default, 255); lv_obj_add_style(ui->device_gang6swbgimg_3, &style_device_gang6swbgimg_3_main_main_default, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_add_flag(ui->device_gang6swbgimg_3, LV_OBJ_FLAG_CLICKABLE); lv_img_set_src(ui->device_gang6swbgimg_3,LVGL_PATH(lightonbg.png)); lv_img_set_pivot(ui->device_gang6swbgimg_3, 0,0); lv_img_set_angle(ui->device_gang6swbgimg_3, 0); #endif //Write codes device_gang6swiconimg_3 ui->device_gang6swiconimg_3 = lv_img_create(ui->device_gang6cont); lv_obj_set_pos(ui->device_gang6swiconimg_3, 316, 95); lv_obj_set_size(ui->device_gang6swiconimg_3, 32, 32); //Write style state: LV_STATE_DEFAULT for style_device_gang6swiconimg_3_main_main_default static lv_style_t style_device_gang6swiconimg_3_main_main_default; lv_style_reset(&style_device_gang6swiconimg_3_main_main_default); lv_style_set_img_recolor(&style_device_gang6swiconimg_3_main_main_default, lv_color_make(0xff, 0xff, 0xff)); lv_style_set_img_recolor_opa(&style_device_gang6swiconimg_3_main_main_default, 0); lv_style_set_img_opa(&style_device_gang6swiconimg_3_main_main_default, 255); lv_obj_add_style(ui->device_gang6swiconimg_3, &style_device_gang6swiconimg_3_main_main_default, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_add_flag(ui->device_gang6swiconimg_3, LV_OBJ_FLAG_CLICKABLE); // lv_img_set_src(ui->device_gang6swiconimg_3,LVGL_PATH(onofflightoff10.png)); if(GET_nvs_Sys_Info_Gang63icon()) { lv_img_set_src(ui->device_gang6swiconimg_3,onoff_keyligthimgon_ary[GET_nvs_Sys_Info_Gang63icon()]); } else { lv_img_set_src(ui->device_gang6swiconimg_3,LVGL_PATH(onofflighton10.png));//icon } lv_img_set_pivot(ui->device_gang6swiconimg_3, 0,0); lv_img_set_angle(ui->device_gang6swiconimg_3, 0); //Write codes device_gang6swbtn_3 ui->device_gang6swbtn_3 = lv_btn_create(ui->device_gang6cont); lv_obj_set_pos(ui->device_gang6swbtn_3, 304, 84); lv_obj_set_size(ui->device_gang6swbtn_3, 54, 54); //Write style state: LV_STATE_DEFAULT for style_device_gang6swbtn_3_main_main_default static lv_style_t style_device_gang6swbtn_3_main_main_default; lv_style_reset(&style_device_gang6swbtn_3_main_main_default); lv_style_set_radius(&style_device_gang6swbtn_3_main_main_default, 0); lv_style_set_bg_color(&style_device_gang6swbtn_3_main_main_default, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_bg_grad_color(&style_device_gang6swbtn_3_main_main_default, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_bg_grad_dir(&style_device_gang6swbtn_3_main_main_default, LV_GRAD_DIR_VER); lv_style_set_bg_opa(&style_device_gang6swbtn_3_main_main_default, 0); lv_style_set_shadow_color(&style_device_gang6swbtn_3_main_main_default, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_shadow_opa(&style_device_gang6swbtn_3_main_main_default, 0); lv_style_set_border_color(&style_device_gang6swbtn_3_main_main_default, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_border_width(&style_device_gang6swbtn_3_main_main_default, 0); lv_style_set_border_opa(&style_device_gang6swbtn_3_main_main_default, 0); lv_obj_add_style(ui->device_gang6swbtn_3, &style_device_gang6swbtn_3_main_main_default, LV_PART_MAIN|LV_STATE_DEFAULT); ui->device_gang6swbtn_3_label = lv_label_create(ui->device_gang6swbtn_3); lv_label_set_text(ui->device_gang6swbtn_3_label, ""); lv_obj_set_style_text_color(ui->device_gang6swbtn_3_label, lv_color_make(0x00, 0x00, 0x00), LV_STATE_DEFAULT); lv_obj_set_style_pad_all(ui->device_gang6swbtn_3, 0, LV_STATE_DEFAULT); lv_obj_align(ui->device_gang6swbtn_3_label, LV_ALIGN_CENTER, 0, 0); //Write codes device_gang6swlabel_3 ui->device_gang6swlabel_3 = lv_label_create(ui->device_gang6cont); lv_obj_set_pos(ui->device_gang6swlabel_3, 286, 141); lv_obj_set_size(ui->device_gang6swlabel_3, 100, 22); // lv_label_set_text(ui->device_gang6swlabel_3, "Light strip"); if( strlen((const char*)nvs_Sys_Info_SysInfo.gang6_sw3.Label) )//用户自己设置的文字(自由设置 不分语言) { lv_label_set_text_fmt(ui->device_gang6swlabel_3, "%s",nvs_Sys_Info_SysInfo.gang6_sw3.Label); } else { lv_label_set_text(ui->device_gang6swlabel_3,Menu_List[GET_nvs_Sys_Info_language()][MENU_LIST_GANG63]); } lv_label_set_long_mode(ui->device_gang6swlabel_3, LV_LABEL_LONG_DOT); lv_obj_set_style_text_align(ui->device_gang6swlabel_3, LV_TEXT_ALIGN_CENTER, 0); //Write style state: LV_STATE_DEFAULT for style_device_gang6swlabel_3_main_main_default static lv_style_t style_device_gang6swlabel_3_main_main_default; lv_style_reset(&style_device_gang6swlabel_3_main_main_default); lv_style_set_radius(&style_device_gang6swlabel_3_main_main_default, 0); lv_style_set_bg_color(&style_device_gang6swlabel_3_main_main_default, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_bg_grad_color(&style_device_gang6swlabel_3_main_main_default, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_bg_grad_dir(&style_device_gang6swlabel_3_main_main_default, LV_GRAD_DIR_VER); lv_style_set_bg_opa(&style_device_gang6swlabel_3_main_main_default, 0); lv_style_set_text_color(&style_device_gang6swlabel_3_main_main_default, lv_color_make(0xff, 0xff, 0xff)); lv_style_set_text_font(&style_device_gang6swlabel_3_main_main_default, &lv_font_simsun_16); lv_style_set_text_letter_space(&style_device_gang6swlabel_3_main_main_default, 0); lv_style_set_pad_left(&style_device_gang6swlabel_3_main_main_default, 0); lv_style_set_pad_right(&style_device_gang6swlabel_3_main_main_default, 0); lv_style_set_pad_top(&style_device_gang6swlabel_3_main_main_default, 0); lv_style_set_pad_bottom(&style_device_gang6swlabel_3_main_main_default, 0); lv_obj_add_style(ui->device_gang6swlabel_3, &style_device_gang6swlabel_3_main_main_default, LV_PART_MAIN|LV_STATE_DEFAULT); #ifdef CONFIG_OBJICT_IMAGE //Write codes device_gang6swbgimg_4 ui->device_gang6swbgimg_4 = lv_obj_create(ui->device_gang6cont); lv_obj_set_pos(ui->device_gang6swbgimg_4, 71, 164); lv_obj_set_size(ui->device_gang6swbgimg_4, 54, 54); lv_obj_set_style_radius(ui->device_gang6swbgimg_4, 30, LV_PART_MAIN|LV_STATE_DEFAULT); //lv_obj_set_style_bg_color(ui->device_gang6swbgimg_4, lv_color_make(0xeb, 0x95, 0x0f), LV_PART_MAIN|LV_STATE_DEFAULT); //lv_obj_set_style_bg_grad_color(ui->device_gang6swbgimg_4, lv_color_make(0xef, 0x95, 0x0f), LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_grad_dir(ui->device_gang6swbgimg_4, LV_GRAD_DIR_VER, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_opa(ui->device_gang6swbgimg_4, 255, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_border_color(ui->device_gang6swbgimg_4, lv_color_make(0xeb, 0x95, 0x0f), LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_border_width(ui->device_gang6swbgimg_4, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_border_opa(ui->device_gang6swbgimg_4, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_left(ui->device_gang6swbgimg_4, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_right(ui->device_gang6swbgimg_4, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_top(ui->device_gang6swbgimg_4, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_bottom(ui->device_gang6swbgimg_4, 0, LV_PART_MAIN|LV_STATE_DEFAULT); if(GET_nvs_Sys_Info_Gang6relay4()) { lv_obj_set_style_bg_color(ui->device_gang6swbgimg_4,lv_color_make(0xeb, 0x95, 0x0f), LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_grad_color(ui->device_gang6swbgimg_4, lv_color_make(0xef, 0x95, 0x0f), LV_PART_MAIN|LV_STATE_DEFAULT); } else { lv_obj_set_style_bg_color(ui->device_gang6swbgimg_4,lv_color_make(0xb2, 0xb2, 0xb2), LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_grad_color(ui->device_gang6swbgimg_4, lv_color_make(0xb2, 0xb2, 0xb2), LV_PART_MAIN|LV_STATE_DEFAULT); } #else //Write codes device_gang6swbgimg_4 ui->device_gang6swbgimg_4 = lv_img_create(ui->device_gang6cont); lv_obj_set_pos(ui->device_gang6swbgimg_4, 71, 164); lv_obj_set_size(ui->device_gang6swbgimg_4, 54, 54); //Write style state: LV_STATE_DEFAULT for style_device_gang6swbgimg_4_main_main_default static lv_style_t style_device_gang6swbgimg_4_main_main_default; lv_style_reset(&style_device_gang6swbgimg_4_main_main_default); lv_style_set_img_recolor(&style_device_gang6swbgimg_4_main_main_default, lv_color_make(0xff, 0xff, 0xff)); lv_style_set_img_recolor_opa(&style_device_gang6swbgimg_4_main_main_default, 0); lv_style_set_img_opa(&style_device_gang6swbgimg_4_main_main_default, 255); lv_obj_add_style(ui->device_gang6swbgimg_4, &style_device_gang6swbgimg_4_main_main_default, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_add_flag(ui->device_gang6swbgimg_4, LV_OBJ_FLAG_CLICKABLE); lv_img_set_src(ui->device_gang6swbgimg_4,LVGL_PATH(lightonbg.png)); lv_img_set_pivot(ui->device_gang6swbgimg_4, 0,0); lv_img_set_angle(ui->device_gang6swbgimg_4, 0); #endif //Write codes device_gang6swiconimg_4 ui->device_gang6swiconimg_4 = lv_img_create(ui->device_gang6cont); lv_obj_set_pos(ui->device_gang6swiconimg_4, 83, 178); lv_obj_set_size(ui->device_gang6swiconimg_4, 32, 32); //Write style state: LV_STATE_DEFAULT for style_device_gang6swiconimg_4_main_main_default static lv_style_t style_device_gang6swiconimg_4_main_main_default; lv_style_reset(&style_device_gang6swiconimg_4_main_main_default); lv_style_set_img_recolor(&style_device_gang6swiconimg_4_main_main_default, lv_color_make(0xff, 0xff, 0xff)); lv_style_set_img_recolor_opa(&style_device_gang6swiconimg_4_main_main_default, 0); lv_style_set_img_opa(&style_device_gang6swiconimg_4_main_main_default, 255); lv_obj_add_style(ui->device_gang6swiconimg_4, &style_device_gang6swiconimg_4_main_main_default, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_add_flag(ui->device_gang6swiconimg_4, LV_OBJ_FLAG_CLICKABLE); // lv_img_set_src(ui->device_gang6swiconimg_4,LVGL_PATH(onofflightoff10.png)); if(GET_nvs_Sys_Info_Gang64icon()) { lv_img_set_src(ui->device_gang6swiconimg_4,onoff_keyligthimgon_ary[GET_nvs_Sys_Info_Gang64icon()]); } else { lv_img_set_src(ui->device_gang6swiconimg_4,LVGL_PATH(onofflighton10.png));//icon } lv_img_set_pivot(ui->device_gang6swiconimg_4, 0,0); lv_img_set_angle(ui->device_gang6swiconimg_4, 0); //Write codes device_gang6swlabel_4 ui->device_gang6swlabel_4 = lv_label_create(ui->device_gang6cont); lv_obj_set_pos(ui->device_gang6swlabel_4, 48, 220); lv_obj_set_size(ui->device_gang6swlabel_4, 120, 22); // lv_label_set_text(ui->device_gang6swlabel_4, "Light strip"); if( strlen((const char*)nvs_Sys_Info_SysInfo.gang6_sw4.Label) )//用户自己设置的文字(自由设置 不分语言) { lv_label_set_text_fmt(ui->device_gang6swlabel_4, "%s",nvs_Sys_Info_SysInfo.gang6_sw4.Label); } else { lv_label_set_text(ui->device_gang6swlabel_4,Menu_List[GET_nvs_Sys_Info_language()][MENU_LIST_GANG64]); } lv_label_set_long_mode(ui->device_gang6swlabel_4, LV_LABEL_LONG_DOT); lv_obj_set_style_text_align(ui->device_gang6swlabel_4, LV_TEXT_ALIGN_CENTER, 0); //Write style state: LV_STATE_DEFAULT for style_device_gang6swlabel_4_main_main_default static lv_style_t style_device_gang6swlabel_4_main_main_default; lv_style_reset(&style_device_gang6swlabel_4_main_main_default); lv_style_set_radius(&style_device_gang6swlabel_4_main_main_default, 0); lv_style_set_bg_color(&style_device_gang6swlabel_4_main_main_default, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_bg_grad_color(&style_device_gang6swlabel_4_main_main_default, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_bg_grad_dir(&style_device_gang6swlabel_4_main_main_default, LV_GRAD_DIR_VER); lv_style_set_bg_opa(&style_device_gang6swlabel_4_main_main_default, 0); lv_style_set_text_color(&style_device_gang6swlabel_4_main_main_default, lv_color_make(0xff, 0xff, 0xff)); lv_style_set_text_font(&style_device_gang6swlabel_4_main_main_default, &lv_font_simsun_16); lv_style_set_text_letter_space(&style_device_gang6swlabel_4_main_main_default, 0); lv_style_set_pad_left(&style_device_gang6swlabel_4_main_main_default, 0); lv_style_set_pad_right(&style_device_gang6swlabel_4_main_main_default, 0); lv_style_set_pad_top(&style_device_gang6swlabel_4_main_main_default, 0); lv_style_set_pad_bottom(&style_device_gang6swlabel_4_main_main_default, 0); lv_obj_add_style(ui->device_gang6swlabel_4, &style_device_gang6swlabel_4_main_main_default, LV_PART_MAIN|LV_STATE_DEFAULT); //Write codes device_gang6swbtn_4 ui->device_gang6swbtn_4 = lv_btn_create(ui->device_gang6cont); lv_obj_set_pos(ui->device_gang6swbtn_4, 71, 164); lv_obj_set_size(ui->device_gang6swbtn_4, 54, 54); //Write style state: LV_STATE_DEFAULT for style_device_gang6swbtn_4_main_main_default static lv_style_t style_device_gang6swbtn_4_main_main_default; lv_style_reset(&style_device_gang6swbtn_4_main_main_default); lv_style_set_radius(&style_device_gang6swbtn_4_main_main_default, 0); lv_style_set_bg_color(&style_device_gang6swbtn_4_main_main_default, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_bg_grad_color(&style_device_gang6swbtn_4_main_main_default, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_bg_grad_dir(&style_device_gang6swbtn_4_main_main_default, LV_GRAD_DIR_VER); lv_style_set_bg_opa(&style_device_gang6swbtn_4_main_main_default, 0); lv_style_set_shadow_color(&style_device_gang6swbtn_4_main_main_default, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_shadow_opa(&style_device_gang6swbtn_4_main_main_default, 0); lv_style_set_border_color(&style_device_gang6swbtn_4_main_main_default, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_border_width(&style_device_gang6swbtn_4_main_main_default, 0); lv_style_set_border_opa(&style_device_gang6swbtn_4_main_main_default, 0); lv_obj_add_style(ui->device_gang6swbtn_4, &style_device_gang6swbtn_4_main_main_default, LV_PART_MAIN|LV_STATE_DEFAULT); ui->device_gang6swbtn_4_label = lv_label_create(ui->device_gang6swbtn_4); lv_label_set_text(ui->device_gang6swbtn_4_label, ""); lv_obj_set_style_text_color(ui->device_gang6swbtn_4_label, lv_color_make(0x00, 0x00, 0x00), LV_STATE_DEFAULT); lv_obj_set_style_pad_all(ui->device_gang6swbtn_4, 0, LV_STATE_DEFAULT); lv_obj_align(ui->device_gang6swbtn_4_label, LV_ALIGN_CENTER, 0, 0); #ifdef CONFIG_OBJICT_IMAGE //Write codes device_gang6swbgimg_5 ui->device_gang6swbgimg_5 = lv_obj_create(ui->device_gang6cont); lv_obj_set_pos(ui->device_gang6swbgimg_5, 191, 164); lv_obj_set_size(ui->device_gang6swbgimg_5, 54, 54); lv_obj_set_style_radius(ui->device_gang6swbgimg_5, 30, LV_PART_MAIN|LV_STATE_DEFAULT); //lv_obj_set_style_bg_color(ui->device_gang6swbgimg_5, lv_color_make(0xeb, 0x95, 0x0f), LV_PART_MAIN|LV_STATE_DEFAULT); //lv_obj_set_style_bg_grad_color(ui->device_gang6swbgimg_5, lv_color_make(0xef, 0x95, 0x0f), LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_grad_dir(ui->device_gang6swbgimg_5, LV_GRAD_DIR_VER, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_opa(ui->device_gang6swbgimg_5, 255, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_border_color(ui->device_gang6swbgimg_5, lv_color_make(0xeb, 0x95, 0x0f), LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_border_width(ui->device_gang6swbgimg_5, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_border_opa(ui->device_gang6swbgimg_5, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_left(ui->device_gang6swbgimg_5, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_right(ui->device_gang6swbgimg_5, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_top(ui->device_gang6swbgimg_5, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_bottom(ui->device_gang6swbgimg_5, 0, LV_PART_MAIN|LV_STATE_DEFAULT); if(GET_nvs_Sys_Info_Gang6relay5()) { lv_obj_set_style_bg_color(ui->device_gang6swbgimg_5,lv_color_make(0xeb, 0x95, 0x0f), LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_grad_color(ui->device_gang6swbgimg_5, lv_color_make(0xef, 0x95, 0x0f), LV_PART_MAIN|LV_STATE_DEFAULT); } else { lv_obj_set_style_bg_color(ui->device_gang6swbgimg_5,lv_color_make(0xb2, 0xb2, 0xb2), LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_grad_color(ui->device_gang6swbgimg_5, lv_color_make(0xb2, 0xb2, 0xb2), LV_PART_MAIN|LV_STATE_DEFAULT); } #else //Write codes device_gang6swbgimg_5 ui->device_gang6swbgimg_5 = lv_img_create(ui->device_gang6cont); lv_obj_set_pos(ui->device_gang6swbgimg_5, 191, 164); lv_obj_set_size(ui->device_gang6swbgimg_5, 54, 54); //Write style state: LV_STATE_DEFAULT for style_device_gang6swbgimg_5_main_main_default static lv_style_t style_device_gang6swbgimg_5_main_main_default; lv_style_reset(&style_device_gang6swbgimg_5_main_main_default); lv_style_set_img_recolor(&style_device_gang6swbgimg_5_main_main_default, lv_color_make(0xff, 0xff, 0xff)); lv_style_set_img_recolor_opa(&style_device_gang6swbgimg_5_main_main_default, 0); lv_style_set_img_opa(&style_device_gang6swbgimg_5_main_main_default, 255); lv_obj_add_style(ui->device_gang6swbgimg_5, &style_device_gang6swbgimg_5_main_main_default, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_add_flag(ui->device_gang6swbgimg_5, LV_OBJ_FLAG_CLICKABLE); lv_img_set_src(ui->device_gang6swbgimg_5,LVGL_PATH(lightonbg.png)); lv_img_set_pivot(ui->device_gang6swbgimg_5, 0,0); lv_img_set_angle(ui->device_gang6swbgimg_5, 0); #endif //Write codes device_gang6swiconimg_5 ui->device_gang6swiconimg_5 = lv_img_create(ui->device_gang6cont); lv_obj_set_pos(ui->device_gang6swiconimg_5, 203, 178); lv_obj_set_size(ui->device_gang6swiconimg_5, 32, 32); //Write style state: LV_STATE_DEFAULT for style_device_gang6swiconimg_5_main_main_default static lv_style_t style_device_gang6swiconimg_5_main_main_default; lv_style_reset(&style_device_gang6swiconimg_5_main_main_default); lv_style_set_img_recolor(&style_device_gang6swiconimg_5_main_main_default, lv_color_make(0xff, 0xff, 0xff)); lv_style_set_img_recolor_opa(&style_device_gang6swiconimg_5_main_main_default, 0); lv_style_set_img_opa(&style_device_gang6swiconimg_5_main_main_default, 255); lv_obj_add_style(ui->device_gang6swiconimg_5, &style_device_gang6swiconimg_5_main_main_default, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_add_flag(ui->device_gang6swiconimg_5, LV_OBJ_FLAG_CLICKABLE); // lv_img_set_src(ui->device_gang6swiconimg_5,LVGL_PATH(onofflightoff10.png)); if(GET_nvs_Sys_Info_Gang65icon()) { lv_img_set_src(ui->device_gang6swiconimg_5,onoff_keyligthimgon_ary[GET_nvs_Sys_Info_Gang65icon()]); } else { lv_img_set_src(ui->device_gang6swiconimg_5,LVGL_PATH(onofflighton10.png));//icon } lv_img_set_pivot(ui->device_gang6swiconimg_5, 0,0); lv_img_set_angle(ui->device_gang6swiconimg_5, 0); //Write codes device_gang6swlabel_5 ui->device_gang6swlabel_5 = lv_label_create(ui->device_gang6cont); lv_obj_set_pos(ui->device_gang6swlabel_5, 171, 220); lv_obj_set_size(ui->device_gang6swlabel_5, 100, 22); // lv_label_set_text(ui->device_gang6swlabel_5, "Downlight"); if( strlen((const char*)nvs_Sys_Info_SysInfo.gang6_sw5.Label) )//用户自己设置的文字(自由设置 不分语言) { lv_label_set_text_fmt(ui->device_gang6swlabel_5, "%s",nvs_Sys_Info_SysInfo.gang6_sw5.Label); } else { lv_label_set_text(ui->device_gang6swlabel_5,Menu_List[GET_nvs_Sys_Info_language()][MENU_LIST_GANG65]); } lv_label_set_long_mode(ui->device_gang6swlabel_5, LV_LABEL_LONG_DOT); lv_obj_set_style_text_align(ui->device_gang6swlabel_5, LV_TEXT_ALIGN_CENTER, 0); //Write style state: LV_STATE_DEFAULT for style_device_gang6swlabel_5_main_main_default static lv_style_t style_device_gang6swlabel_5_main_main_default; lv_style_reset(&style_device_gang6swlabel_5_main_main_default); lv_style_set_radius(&style_device_gang6swlabel_5_main_main_default, 0); lv_style_set_bg_color(&style_device_gang6swlabel_5_main_main_default, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_bg_grad_color(&style_device_gang6swlabel_5_main_main_default, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_bg_grad_dir(&style_device_gang6swlabel_5_main_main_default, LV_GRAD_DIR_VER); lv_style_set_bg_opa(&style_device_gang6swlabel_5_main_main_default, 0); lv_style_set_text_color(&style_device_gang6swlabel_5_main_main_default, lv_color_make(0xff, 0xff, 0xff)); lv_style_set_text_font(&style_device_gang6swlabel_5_main_main_default, &lv_font_simsun_16); lv_style_set_text_letter_space(&style_device_gang6swlabel_5_main_main_default, 0); lv_style_set_pad_left(&style_device_gang6swlabel_5_main_main_default, 0); lv_style_set_pad_right(&style_device_gang6swlabel_5_main_main_default, 0); lv_style_set_pad_top(&style_device_gang6swlabel_5_main_main_default, 0); lv_style_set_pad_bottom(&style_device_gang6swlabel_5_main_main_default, 0); lv_obj_add_style(ui->device_gang6swlabel_5, &style_device_gang6swlabel_5_main_main_default, LV_PART_MAIN|LV_STATE_DEFAULT); //Write codes device_gang6swbtn_5 ui->device_gang6swbtn_5 = lv_btn_create(ui->device_gang6cont); lv_obj_set_pos(ui->device_gang6swbtn_5, 191, 164); lv_obj_set_size(ui->device_gang6swbtn_5, 54, 54); //Write style state: LV_STATE_DEFAULT for style_device_gang6swbtn_5_main_main_default static lv_style_t style_device_gang6swbtn_5_main_main_default; lv_style_reset(&style_device_gang6swbtn_5_main_main_default); lv_style_set_radius(&style_device_gang6swbtn_5_main_main_default, 0); lv_style_set_bg_color(&style_device_gang6swbtn_5_main_main_default, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_bg_grad_color(&style_device_gang6swbtn_5_main_main_default, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_bg_grad_dir(&style_device_gang6swbtn_5_main_main_default, LV_GRAD_DIR_VER); lv_style_set_bg_opa(&style_device_gang6swbtn_5_main_main_default, 0); lv_style_set_shadow_color(&style_device_gang6swbtn_5_main_main_default, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_shadow_opa(&style_device_gang6swbtn_5_main_main_default, 0); lv_style_set_border_color(&style_device_gang6swbtn_5_main_main_default, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_border_width(&style_device_gang6swbtn_5_main_main_default, 0); lv_style_set_border_opa(&style_device_gang6swbtn_5_main_main_default, 0); lv_obj_add_style(ui->device_gang6swbtn_5, &style_device_gang6swbtn_5_main_main_default, LV_PART_MAIN|LV_STATE_DEFAULT); ui->device_gang6swbtn_5_label = lv_label_create(ui->device_gang6swbtn_5); lv_label_set_text(ui->device_gang6swbtn_5_label, ""); lv_obj_set_style_text_color(ui->device_gang6swbtn_5_label, lv_color_make(0x00, 0x00, 0x00), LV_STATE_DEFAULT); lv_obj_set_style_pad_all(ui->device_gang6swbtn_5, 0, LV_STATE_DEFAULT); lv_obj_align(ui->device_gang6swbtn_5_label, LV_ALIGN_CENTER, 0, 0); #ifdef CONFIG_OBJICT_IMAGE //Write codes device_gang6swbgimg_6 ui->device_gang6swbgimg_6 = lv_img_create(ui->device_gang6cont); lv_obj_set_pos(ui->device_gang6swbgimg_6, 304, 164); lv_obj_set_size(ui->device_gang6swbgimg_6, 54, 54); lv_obj_set_style_radius(ui->device_gang6swbgimg_6, 30, LV_PART_MAIN|LV_STATE_DEFAULT); //lv_obj_set_style_bg_color(ui->device_gang6swbgimg_6, lv_color_make(0xeb, 0x95, 0x0f), LV_PART_MAIN|LV_STATE_DEFAULT); //lv_obj_set_style_bg_grad_color(ui->device_gang6swbgimg_6, lv_color_make(0xef, 0x95, 0x0f), LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_grad_dir(ui->device_gang6swbgimg_6, LV_GRAD_DIR_VER, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_opa(ui->device_gang6swbgimg_6, 255, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_border_color(ui->device_gang6swbgimg_6, lv_color_make(0xeb, 0x95, 0x0f), LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_border_width(ui->device_gang6swbgimg_6, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_border_opa(ui->device_gang6swbgimg_6, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_left(ui->device_gang6swbgimg_6, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_right(ui->device_gang6swbgimg_6, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_top(ui->device_gang6swbgimg_6, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_bottom(ui->device_gang6swbgimg_6, 0, LV_PART_MAIN|LV_STATE_DEFAULT); if(GET_nvs_Sys_Info_Gang6relay6()) { lv_obj_set_style_bg_color(ui->device_gang6swbgimg_6,lv_color_make(0xeb, 0x95, 0x0f), LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_grad_color(ui->device_gang6swbgimg_6, lv_color_make(0xef, 0x95, 0x0f), LV_PART_MAIN|LV_STATE_DEFAULT); } else { lv_obj_set_style_bg_color(ui->device_gang6swbgimg_6,lv_color_make(0xb2, 0xb2, 0xb2), LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_grad_color(ui->device_gang6swbgimg_6, lv_color_make(0xb2, 0xb2, 0xb2), LV_PART_MAIN|LV_STATE_DEFAULT); } #else //Write codes device_gang6swbgimg_6 ui->device_gang6swbgimg_6 = lv_img_create(ui->device_gang6cont); lv_obj_set_pos(ui->device_gang6swbgimg_6, 304, 164); lv_obj_set_size(ui->device_gang6swbgimg_6, 54, 54); //Write style state: LV_STATE_DEFAULT for style_device_gang6swbgimg_6_main_main_default static lv_style_t style_device_gang6swbgimg_6_main_main_default; lv_style_reset(&style_device_gang6swbgimg_6_main_main_default); lv_style_set_img_recolor(&style_device_gang6swbgimg_6_main_main_default, lv_color_make(0xff, 0xff, 0xff)); lv_style_set_img_recolor_opa(&style_device_gang6swbgimg_6_main_main_default, 0); lv_style_set_img_opa(&style_device_gang6swbgimg_6_main_main_default, 255); lv_obj_add_style(ui->device_gang6swbgimg_6, &style_device_gang6swbgimg_6_main_main_default, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_add_flag(ui->device_gang6swbgimg_6, LV_OBJ_FLAG_CLICKABLE); lv_img_set_src(ui->device_gang6swbgimg_6,LVGL_PATH(lightonbg.png)); lv_img_set_pivot(ui->device_gang6swbgimg_6, 0,0); lv_img_set_angle(ui->device_gang6swbgimg_6, 0); #endif //Write codes device_gang6swiconimg_6 ui->device_gang6swiconimg_6 = lv_img_create(ui->device_gang6cont); lv_obj_set_pos(ui->device_gang6swiconimg_6, 316, 178); lv_obj_set_size(ui->device_gang6swiconimg_6, 32, 32); //Write style state: LV_STATE_DEFAULT for style_device_gang6swiconimg_6_main_main_default static lv_style_t style_device_gang6swiconimg_6_main_main_default; lv_style_reset(&style_device_gang6swiconimg_6_main_main_default); lv_style_set_img_recolor(&style_device_gang6swiconimg_6_main_main_default, lv_color_make(0xff, 0xff, 0xff)); lv_style_set_img_recolor_opa(&style_device_gang6swiconimg_6_main_main_default, 0); lv_style_set_img_opa(&style_device_gang6swiconimg_6_main_main_default, 255); lv_obj_add_style(ui->device_gang6swiconimg_6, &style_device_gang6swiconimg_6_main_main_default, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_add_flag(ui->device_gang6swiconimg_6, LV_OBJ_FLAG_CLICKABLE); // lv_img_set_src(ui->device_gang6swiconimg_6,LVGL_PATH(onofflightoff10.png)); if(GET_nvs_Sys_Info_Gang66icon()) { lv_img_set_src(ui->device_gang6swiconimg_6,onoff_keyligthimgon_ary[GET_nvs_Sys_Info_Gang66icon()]); } else { lv_img_set_src(ui->device_gang6swiconimg_6,LVGL_PATH(onofflighton10.png));//icon } lv_img_set_pivot(ui->device_gang6swiconimg_6, 0,0); lv_img_set_angle(ui->device_gang6swiconimg_6, 0); //Write codes device_gang6swlabel_6 ui->device_gang6swlabel_6 = lv_label_create(ui->device_gang6cont); lv_obj_set_pos(ui->device_gang6swlabel_6, 286, 220); lv_obj_set_size(ui->device_gang6swlabel_6, 100, 22); // lv_label_set_text(ui->device_gang6swlabel_6, "Light strip"); if( strlen((const char*)nvs_Sys_Info_SysInfo.gang6_sw6.Label) )//用户自己设置的文字(自由设置 不分语言) { lv_label_set_text_fmt(ui->device_gang6swlabel_6, "%s",nvs_Sys_Info_SysInfo.gang6_sw6.Label); } else { lv_label_set_text(ui->device_gang6swlabel_6,Menu_List[GET_nvs_Sys_Info_language()][MENU_LIST_GANG66]); } lv_label_set_long_mode(ui->device_gang6swlabel_6, LV_LABEL_LONG_DOT); lv_obj_set_style_text_align(ui->device_gang6swlabel_6, LV_TEXT_ALIGN_CENTER, 0); //Write style state: LV_STATE_DEFAULT for style_device_gang6swlabel_6_main_main_default static lv_style_t style_device_gang6swlabel_6_main_main_default; lv_style_reset(&style_device_gang6swlabel_6_main_main_default); lv_style_set_radius(&style_device_gang6swlabel_6_main_main_default, 0); lv_style_set_bg_color(&style_device_gang6swlabel_6_main_main_default, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_bg_grad_color(&style_device_gang6swlabel_6_main_main_default, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_bg_grad_dir(&style_device_gang6swlabel_6_main_main_default, LV_GRAD_DIR_VER); lv_style_set_bg_opa(&style_device_gang6swlabel_6_main_main_default, 0); lv_style_set_text_color(&style_device_gang6swlabel_6_main_main_default, lv_color_make(0xff, 0xff, 0xff)); lv_style_set_text_font(&style_device_gang6swlabel_6_main_main_default, &lv_font_simsun_16); lv_style_set_text_letter_space(&style_device_gang6swlabel_6_main_main_default, 0); lv_style_set_pad_left(&style_device_gang6swlabel_6_main_main_default, 0); lv_style_set_pad_right(&style_device_gang6swlabel_6_main_main_default, 0); lv_style_set_pad_top(&style_device_gang6swlabel_6_main_main_default, 0); lv_style_set_pad_bottom(&style_device_gang6swlabel_6_main_main_default, 0); lv_obj_add_style(ui->device_gang6swlabel_6, &style_device_gang6swlabel_6_main_main_default, LV_PART_MAIN|LV_STATE_DEFAULT); //Write codes device_gang6swbtn_6 ui->device_gang6swbtn_6 = lv_btn_create(ui->device_gang6cont); lv_obj_set_pos(ui->device_gang6swbtn_6, 304, 164); lv_obj_set_size(ui->device_gang6swbtn_6, 54, 54); //Write style state: LV_STATE_DEFAULT for style_device_gang6swbtn_6_main_main_default static lv_style_t style_device_gang6swbtn_6_main_main_default; lv_style_reset(&style_device_gang6swbtn_6_main_main_default); lv_style_set_radius(&style_device_gang6swbtn_6_main_main_default, 0); lv_style_set_bg_color(&style_device_gang6swbtn_6_main_main_default, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_bg_grad_color(&style_device_gang6swbtn_6_main_main_default, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_bg_grad_dir(&style_device_gang6swbtn_6_main_main_default, LV_GRAD_DIR_VER); lv_style_set_bg_opa(&style_device_gang6swbtn_6_main_main_default, 0); lv_style_set_shadow_color(&style_device_gang6swbtn_6_main_main_default, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_shadow_opa(&style_device_gang6swbtn_6_main_main_default, 0); lv_style_set_border_color(&style_device_gang6swbtn_6_main_main_default, lv_color_make(0x21, 0x95, 0xf6)); lv_style_set_border_width(&style_device_gang6swbtn_6_main_main_default, 0); lv_style_set_border_opa(&style_device_gang6swbtn_6_main_main_default, 0); lv_obj_add_style(ui->device_gang6swbtn_6, &style_device_gang6swbtn_6_main_main_default, LV_PART_MAIN|LV_STATE_DEFAULT); ui->device_gang6swbtn_6_label = lv_label_create(ui->device_gang6swbtn_6); lv_label_set_text(ui->device_gang6swbtn_6_label, ""); lv_obj_set_style_text_color(ui->device_gang6swbtn_6_label, lv_color_make(0x00, 0x00, 0x00), LV_STATE_DEFAULT); lv_obj_set_style_pad_all(ui->device_gang6swbtn_6, 0, LV_STATE_DEFAULT); lv_obj_align(ui->device_gang6swbtn_6_label, LV_ALIGN_CENTER, 0, 0); //Init events for screen events_init_device_gang6(ui); } //空调 void create_device_air(lv_ui *ui,lv_obj_t * parent, lv_coord_t x, lv_coord_t y,lv_coord_t w, lv_coord_t h) { if(!parent) { return; } //Write codes device_aircont ui->device_aircont = lv_obj_create(parent); lv_obj_set_pos(ui->device_aircont, x, y); lv_obj_set_size(ui->device_aircont, w, h); lv_obj_set_scrollbar_mode(ui->device_aircont, LV_SCROLLBAR_MODE_OFF); //Write style for device_aircont, Part: LV_PART_MAIN, State: LV_STATE_DEFAULT. lv_obj_set_style_border_width(ui->device_aircont, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_radius(ui->device_aircont, 15, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_opa(ui->device_aircont, 255, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_color(ui->device_aircont, lv_color_hex(0x252525), LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_grad_dir(ui->device_aircont, LV_GRAD_DIR_VER, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_grad_color(ui->device_aircont, lv_color_hex(0x252525), LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_main_stop(ui->device_aircont, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_grad_stop(ui->device_aircont, 255, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_top(ui->device_aircont, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_bottom(ui->device_aircont, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_left(ui->device_aircont, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_right(ui->device_aircont, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_shadow_width(ui->device_aircont, 0, LV_PART_MAIN|LV_STATE_DEFAULT); //Write codes device_airimg ui->device_airimg = lv_img_create(ui->device_aircont); lv_obj_add_flag(ui->device_airimg, LV_OBJ_FLAG_CLICKABLE); lv_img_set_src(ui->device_airimg, LVGL_PATH(lightonbg.png)); lv_img_set_pivot(ui->device_airimg, 0,0); lv_img_set_angle(ui->device_airimg, 0); lv_obj_set_pos(ui->device_airimg, 19, 12); lv_obj_set_size(ui->device_airimg, 54, 54); //Write style for device_airimg, Part: LV_PART_MAIN, State: LV_STATE_DEFAULT. lv_obj_set_style_img_opa(ui->device_airimg, 255, LV_PART_MAIN|LV_STATE_DEFAULT); //Write codes device_airimg_icon ui->device_airimg_icon = lv_img_create(ui->device_aircont); lv_obj_add_flag(ui->device_airimg_icon, LV_OBJ_FLAG_CLICKABLE); lv_img_set_src(ui->device_airimg_icon, LVGL_PATH(iconair.png)); lv_img_set_pivot(ui->device_airimg_icon, 0,0); lv_img_set_angle(ui->device_airimg_icon, 0); lv_obj_set_pos(ui->device_airimg_icon, 28, 25); lv_obj_set_size(ui->device_airimg_icon, 37, 32); //Write style for device_airimg_icon, Part: LV_PART_MAIN, State: LV_STATE_DEFAULT. lv_obj_set_style_img_opa(ui->device_airimg_icon, 255, LV_PART_MAIN|LV_STATE_DEFAULT); //Write codes device_airicon_label ui->device_airicon_label = lv_label_create(ui->device_aircont); lv_obj_set_pos(ui->device_airicon_label, 1, 72); if(GET_nvs_Sys_Info_language()==LANG_CH) { lv_obj_set_size(ui->device_airicon_label, 100, 24); } else //英文长 不能统一居中处理 { lv_obj_set_size(ui->device_airicon_label, 140, 24); } lv_label_set_text(ui->device_airicon_label, Menu_List[GET_nvs_Sys_Info_language()][MENU_LIST_Airconditioner]); lv_label_set_long_mode(ui->device_airicon_label, LV_LABEL_LONG_WRAP); //Write style for device_airicon_label, Part: LV_PART_MAIN, State: LV_STATE_DEFAULT. lv_obj_set_style_border_width(ui->device_airicon_label, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_radius(ui->device_airicon_label, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_color(ui->device_airicon_label, lv_color_hex(0xffffff), LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_font(ui->device_airicon_label, &lv_font_albbhptR_16, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_opa(ui->device_airicon_label, 255, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_letter_space(ui->device_airicon_label, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_line_space(ui->device_airicon_label, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_align(ui->device_airicon_label, LV_TEXT_ALIGN_CENTER, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_opa(ui->device_airicon_label, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_top(ui->device_airicon_label, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_right(ui->device_airicon_label, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_bottom(ui->device_airicon_label, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_left(ui->device_airicon_label, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_shadow_width(ui->device_airicon_label, 0, LV_PART_MAIN|LV_STATE_DEFAULT); //Write codes device_airbtn ui->device_airbtn = lv_btn_create(ui->device_aircont); ui->device_airbtn_label = lv_label_create(ui->device_airbtn); lv_label_set_text(ui->device_airbtn_label, ""); lv_label_set_long_mode(ui->device_airbtn_label, LV_LABEL_LONG_WRAP); lv_obj_align(ui->device_airbtn_label, LV_ALIGN_CENTER, 0, 0); lv_obj_set_style_pad_all(ui->device_airbtn, 0, LV_STATE_DEFAULT); lv_obj_set_width(ui->device_airbtn_label, LV_PCT(100)); lv_obj_set_pos(ui->device_airbtn, 21, 13); lv_obj_set_size(ui->device_airbtn, 52, 52); //Write style for device_airbtn, Part: LV_PART_MAIN, State: LV_STATE_DEFAULT. lv_obj_set_style_bg_opa(ui->device_airbtn, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_border_width(ui->device_airbtn, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_radius(ui->device_airbtn, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_shadow_width(ui->device_airbtn, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_color(ui->device_airbtn, lv_color_hex(0x000000), LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_font(ui->device_airbtn, &lv_font_albbhptR_16, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_opa(ui->device_airbtn, 255, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_align(ui->device_airbtn, LV_TEXT_ALIGN_CENTER, LV_PART_MAIN|LV_STATE_DEFAULT); //Write codes device_airbtn_1 ui->device_airbtn_1 = lv_btn_create(ui->device_aircont); ui->device_airbtn_1_label = lv_label_create(ui->device_airbtn_1); lv_label_set_text(ui->device_airbtn_1_label, Menu_List[GET_nvs_Sys_Info_language()][MENU_LIST_Airconditioner_off]); lv_label_set_long_mode(ui->device_airbtn_1_label, LV_LABEL_LONG_WRAP); lv_obj_align(ui->device_airbtn_1_label, LV_ALIGN_CENTER, 0, 0); lv_obj_set_style_pad_all(ui->device_airbtn_1, 0, LV_STATE_DEFAULT); lv_obj_set_width(ui->device_airbtn_1_label, LV_PCT(100)); lv_obj_set_pos(ui->device_airbtn_1, 130, 34); lv_obj_set_size(ui->device_airbtn_1, 60, 30); //Write style for device_airbtn_1, Part: LV_PART_MAIN, State: LV_STATE_DEFAULT. lv_obj_set_style_bg_opa(ui->device_airbtn_1, 255, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_color(ui->device_airbtn_1, lv_color_hex(0x2195f6), LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_grad_dir(ui->device_airbtn_1, LV_GRAD_DIR_NONE, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_border_width(ui->device_airbtn_1, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_radius(ui->device_airbtn_1, 30, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_shadow_width(ui->device_airbtn_1, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_color(ui->device_airbtn_1, lv_color_hex(0xffffff), LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_font(ui->device_airbtn_1, &lv_font_albbhptR_16, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_opa(ui->device_airbtn_1, 255, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_align(ui->device_airbtn_1, LV_TEXT_ALIGN_CENTER, LV_PART_MAIN|LV_STATE_DEFAULT); //Write codes device_airbtn_2 ui->device_airbtn_2 = lv_btn_create(ui->device_aircont); ui->device_airbtn_2_label = lv_label_create(ui->device_airbtn_2); lv_label_set_text(ui->device_airbtn_2_label, Menu_List[GET_nvs_Sys_Info_language()][MENU_LIST_Airconditioner_modecool]); lv_label_set_long_mode(ui->device_airbtn_2_label, LV_LABEL_LONG_WRAP); lv_obj_align(ui->device_airbtn_2_label, LV_ALIGN_CENTER, 0, 0); lv_obj_set_style_pad_all(ui->device_airbtn_2, 0, LV_STATE_DEFAULT); lv_obj_set_width(ui->device_airbtn_2_label, LV_PCT(100)); lv_obj_set_pos(ui->device_airbtn_2, 210, 34); lv_obj_set_size(ui->device_airbtn_2, 75, 30); //Write style for device_airbtn_2, Part: LV_PART_MAIN, State: LV_STATE_DEFAULT. lv_obj_set_style_bg_opa(ui->device_airbtn_2, 255, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_color(ui->device_airbtn_2, lv_color_hex(0x2195f6), LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_grad_dir(ui->device_airbtn_2, LV_GRAD_DIR_NONE, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_border_width(ui->device_airbtn_2, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_radius(ui->device_airbtn_2, 30, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_shadow_width(ui->device_airbtn_2, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_color(ui->device_airbtn_2, lv_color_hex(0xffffff), LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_font(ui->device_airbtn_2, &lv_font_albbhptR_16, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_opa(ui->device_airbtn_2, 255, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_align(ui->device_airbtn_2, LV_TEXT_ALIGN_CENTER, LV_PART_MAIN|LV_STATE_DEFAULT); //Write codes device_airbtn_3 ui->device_airbtn_3 = lv_btn_create(ui->device_aircont); ui->device_airbtn_3_label = lv_label_create(ui->device_airbtn_3); lv_label_set_text(ui->device_airbtn_3_label, Menu_List[GET_nvs_Sys_Info_language()][MENU_LIST_Airconditioner_modeheat]); lv_label_set_long_mode(ui->device_airbtn_3_label, LV_LABEL_LONG_WRAP); lv_obj_align(ui->device_airbtn_3_label, LV_ALIGN_CENTER, 0, 0); lv_obj_set_style_pad_all(ui->device_airbtn_3, 0, LV_STATE_DEFAULT); lv_obj_set_width(ui->device_airbtn_3_label, LV_PCT(100)); lv_obj_set_pos(ui->device_airbtn_3, 300, 34); lv_obj_set_size(ui->device_airbtn_3, 75, 30); //Write style for device_airbtn_3, Part: LV_PART_MAIN, State: LV_STATE_DEFAULT. lv_obj_set_style_bg_opa(ui->device_airbtn_3, 255, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_color(ui->device_airbtn_3, lv_color_hex(0x2195f6), LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_grad_dir(ui->device_airbtn_3, LV_GRAD_DIR_NONE, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_border_width(ui->device_airbtn_3, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_radius(ui->device_airbtn_3, 30, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_shadow_width(ui->device_airbtn_3, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_color(ui->device_airbtn_3, lv_color_hex(0xffffff), LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_font(ui->device_airbtn_3, &lv_font_albbhptR_16, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_opa(ui->device_airbtn_3, 255, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_align(ui->device_airbtn_3, LV_TEXT_ALIGN_CENTER, LV_PART_MAIN|LV_STATE_DEFAULT); //Write codes device_airbtn_4 ui->device_airbtn_4 = lv_btn_create(ui->device_aircont); ui->device_airbtn_4_label = lv_label_create(ui->device_airbtn_4); lv_label_set_text(ui->device_airbtn_4_label, Menu_List[GET_nvs_Sys_Info_language()][MENU_LIST_Airconditioner_on]); lv_label_set_long_mode(ui->device_airbtn_4_label, LV_LABEL_LONG_WRAP); lv_obj_align(ui->device_airbtn_4_label, LV_ALIGN_CENTER, 0, 0); lv_obj_set_style_pad_all(ui->device_airbtn_4, 0, LV_STATE_DEFAULT); lv_obj_set_width(ui->device_airbtn_4_label, LV_PCT(100)); lv_obj_set_pos(ui->device_airbtn_4, 391, 34); lv_obj_set_size(ui->device_airbtn_4, 60, 30); //Write style for device_airbtn_4, Part: LV_PART_MAIN, State: LV_STATE_DEFAULT. lv_obj_set_style_bg_opa(ui->device_airbtn_4, 255, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_color(ui->device_airbtn_4, lv_color_hex(0x2195f6), LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_grad_dir(ui->device_airbtn_4, LV_GRAD_DIR_NONE, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_border_width(ui->device_airbtn_4, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_radius(ui->device_airbtn_4, 30, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_shadow_width(ui->device_airbtn_4, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_color(ui->device_airbtn_4, lv_color_hex(0xffffff), LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_font(ui->device_airbtn_4, &lv_font_albbhptR_16, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_opa(ui->device_airbtn_4, 255, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_align(ui->device_airbtn_4, LV_TEXT_ALIGN_CENTER, LV_PART_MAIN|LV_STATE_DEFAULT); if(nvs_SysInfo.airconditioner.onoff) { lv_obj_clear_state(ui->device_airbtn_2, LV_STATE_DISABLED); lv_obj_clear_state(ui->device_airbtn_3, LV_STATE_DISABLED); } else { lv_obj_add_state(ui->device_airbtn_2, LV_STATE_DISABLED); lv_obj_add_state(ui->device_airbtn_3, LV_STATE_DISABLED); } //创建事件 events_init_device_air(ui); } //投影仪 void create_device_projector(lv_ui *ui,lv_obj_t * parent, lv_coord_t x, lv_coord_t y,lv_coord_t w, lv_coord_t h) { if(!parent) { return; } //Write codes device_projectorcont ui->device_projectorcont = lv_obj_create(parent); lv_obj_set_pos(ui->device_projectorcont, x, y); lv_obj_set_size(ui->device_projectorcont, w, h); lv_obj_set_scrollbar_mode(ui->device_projectorcont, LV_SCROLLBAR_MODE_OFF); //Write style for device_projectorcont, Part: LV_PART_MAIN, State: LV_STATE_DEFAULT. lv_obj_set_style_border_width(ui->device_projectorcont, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_radius(ui->device_projectorcont, 15, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_opa(ui->device_projectorcont, 255, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_color(ui->device_projectorcont, lv_color_hex(0x252525), LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_grad_dir(ui->device_projectorcont, LV_GRAD_DIR_VER, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_grad_color(ui->device_projectorcont, lv_color_hex(0x252525), LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_main_stop(ui->device_projectorcont, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_grad_stop(ui->device_projectorcont, 255, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_top(ui->device_projectorcont, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_bottom(ui->device_projectorcont, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_left(ui->device_projectorcont, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_right(ui->device_projectorcont, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_shadow_width(ui->device_projectorcont, 0, LV_PART_MAIN|LV_STATE_DEFAULT); //Write codes device_projectorimg ui->device_projectorimg = lv_img_create(ui->device_projectorcont); lv_obj_add_flag(ui->device_projectorimg, LV_OBJ_FLAG_CLICKABLE); lv_img_set_src(ui->device_projectorimg, LVGL_PATH(lightonbg.png)); lv_img_set_pivot(ui->device_projectorimg, 0,0); lv_img_set_angle(ui->device_projectorimg, 0); lv_obj_set_pos(ui->device_projectorimg, 18, 12); lv_obj_set_size(ui->device_projectorimg, 54, 54); //Write style for device_projectorimg, Part: LV_PART_MAIN, State: LV_STATE_DEFAULT. lv_obj_set_style_img_opa(ui->device_projectorimg, 255, LV_PART_MAIN|LV_STATE_DEFAULT); //Write codes device_projectorimg_icon ui->device_projectorimg_icon = lv_img_create(ui->device_projectorcont); lv_obj_add_flag(ui->device_projectorimg_icon, LV_OBJ_FLAG_CLICKABLE); lv_img_set_src(ui->device_projectorimg_icon, LVGL_PATH(iconprojector.png)); lv_img_set_pivot(ui->device_projectorimg_icon, 0,0); lv_img_set_angle(ui->device_projectorimg_icon, 0); lv_obj_set_pos(ui->device_projectorimg_icon, 24, 28); lv_obj_set_size(ui->device_projectorimg_icon, 44, 26); //Write style for device_projectorimg_icon, Part: LV_PART_MAIN, State: LV_STATE_DEFAULT. lv_obj_set_style_img_opa(ui->device_projectorimg_icon, 255, LV_PART_MAIN|LV_STATE_DEFAULT); //Write codes device_projectoricon_label ui->device_projectoricon_label = lv_label_create(ui->device_projectorcont); lv_label_set_text(ui->device_projectoricon_label, Menu_List[GET_nvs_Sys_Info_language()][MENU_LIST_Projector]); lv_label_set_long_mode(ui->device_projectoricon_label, LV_LABEL_LONG_WRAP); lv_obj_set_pos(ui->device_projectoricon_label, 0, 70); lv_obj_set_size(ui->device_projectoricon_label, 100, 24); //Write style for device_projectoricon_label, Part: LV_PART_MAIN, State: LV_STATE_DEFAULT. lv_obj_set_style_border_width(ui->device_projectoricon_label, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_radius(ui->device_projectoricon_label, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_color(ui->device_projectoricon_label, lv_color_hex(0xffffff), LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_font(ui->device_projectoricon_label, &lv_font_albbhptR_16, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_opa(ui->device_projectoricon_label, 255, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_letter_space(ui->device_projectoricon_label, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_line_space(ui->device_projectoricon_label, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_align(ui->device_projectoricon_label, LV_TEXT_ALIGN_CENTER, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_opa(ui->device_projectoricon_label, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_top(ui->device_projectoricon_label, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_right(ui->device_projectoricon_label, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_bottom(ui->device_projectoricon_label, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_left(ui->device_projectoricon_label, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_shadow_width(ui->device_projectoricon_label, 0, LV_PART_MAIN|LV_STATE_DEFAULT); //Write codes device_projectorbtn ui->device_projectorbtn = lv_btn_create(ui->device_projectorcont); ui->device_projectorbtn_label = lv_label_create(ui->device_projectorbtn); lv_label_set_text(ui->device_projectorbtn_label, ""); lv_label_set_long_mode(ui->device_projectorbtn_label, LV_LABEL_LONG_WRAP); lv_obj_align(ui->device_projectorbtn_label, LV_ALIGN_CENTER, 0, 0); lv_obj_set_style_pad_all(ui->device_projectorbtn, 0, LV_STATE_DEFAULT); lv_obj_set_width(ui->device_projectorbtn_label, LV_PCT(100)); lv_obj_set_pos(ui->device_projectorbtn, 20, 13); lv_obj_set_size(ui->device_projectorbtn, 52, 52); //Write style for device_projectorbtn, Part: LV_PART_MAIN, State: LV_STATE_DEFAULT. lv_obj_set_style_bg_opa(ui->device_projectorbtn, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_border_width(ui->device_projectorbtn, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_radius(ui->device_projectorbtn, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_shadow_width(ui->device_projectorbtn, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_color(ui->device_projectorbtn, lv_color_hex(0x000000), LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_font(ui->device_projectorbtn, &lv_font_albbhptR_16, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_opa(ui->device_projectorbtn, 255, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_align(ui->device_projectorbtn, LV_TEXT_ALIGN_CENTER, LV_PART_MAIN|LV_STATE_DEFAULT); //Write codes device_projectoroff_label ui->device_projectoroff_label = lv_label_create(ui->device_projectorcont); lv_label_set_text(ui->device_projectoroff_label, Menu_List[GET_nvs_Sys_Info_language()][MENU_LIST_Projector_close]); lv_label_set_long_mode(ui->device_projectoroff_label, LV_LABEL_LONG_WRAP); lv_obj_set_pos(ui->device_projectoroff_label, 138, 47); lv_obj_set_size(ui->device_projectoroff_label, 77, 24); //Write style for device_projectoroff_label, Part: LV_PART_MAIN, State: LV_STATE_DEFAULT. lv_obj_set_style_border_width(ui->device_projectoroff_label, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_radius(ui->device_projectoroff_label, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_color(ui->device_projectoroff_label, lv_color_hex(0xffffff), LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_font(ui->device_projectoroff_label, &lv_font_albbhptR_16, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_opa(ui->device_projectoroff_label, 255, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_letter_space(ui->device_projectoroff_label, 2, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_line_space(ui->device_projectoroff_label, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_align(ui->device_projectoroff_label, LV_TEXT_ALIGN_CENTER, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_opa(ui->device_projectoroff_label, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_top(ui->device_projectoroff_label, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_right(ui->device_projectoroff_label, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_bottom(ui->device_projectoroff_label, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_left(ui->device_projectoroff_label, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_shadow_width(ui->device_projectoroff_label, 0, LV_PART_MAIN|LV_STATE_DEFAULT); //Write codes device_projectoron_label ui->device_projectoron_label = lv_label_create(ui->device_projectorcont); lv_label_set_text(ui->device_projectoron_label, Menu_List[GET_nvs_Sys_Info_language()][MENU_LIST_Projector_open]); lv_label_set_long_mode(ui->device_projectoron_label, LV_LABEL_LONG_WRAP); lv_obj_set_pos(ui->device_projectoron_label, 342, 47); lv_obj_set_size(ui->device_projectoron_label, 77, 24); //Write style for device_projectoron_label, Part: LV_PART_MAIN, State: LV_STATE_DEFAULT. lv_obj_set_style_border_width(ui->device_projectoron_label, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_radius(ui->device_projectoron_label, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_color(ui->device_projectoron_label, lv_color_hex(0xffffff), LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_font(ui->device_projectoron_label, &lv_font_albbhptR_16, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_opa(ui->device_projectoron_label, 255, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_letter_space(ui->device_projectoron_label, 2, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_line_space(ui->device_projectoron_label, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_align(ui->device_projectoron_label, LV_TEXT_ALIGN_CENTER, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_opa(ui->device_projectoron_label, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_top(ui->device_projectoron_label, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_right(ui->device_projectoron_label, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_bottom(ui->device_projectoron_label, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_left(ui->device_projectoron_label, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_shadow_width(ui->device_projectoron_label, 0, LV_PART_MAIN|LV_STATE_DEFAULT); //Write codes device_projectorsw ui->device_projectorsw = lv_switch_create(ui->device_projectorcont); lv_obj_set_pos(ui->device_projectorsw, 241, 41); lv_obj_set_size(ui->device_projectorsw, 68, 30); //Write style for device_projectorsw, Part: LV_PART_MAIN, State: LV_STATE_DEFAULT. lv_obj_set_style_bg_opa(ui->device_projectorsw, 47, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_color(ui->device_projectorsw, lv_color_hex(0xe6e2e6), LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_grad_dir(ui->device_projectorsw, LV_GRAD_DIR_NONE, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_border_width(ui->device_projectorsw, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_radius(ui->device_projectorsw, 30, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_shadow_width(ui->device_projectorsw, 0, LV_PART_MAIN|LV_STATE_DEFAULT); //Write style for device_projectorsw, Part: LV_PART_INDICATOR, State: LV_STATE_CHECKED. lv_obj_set_style_bg_opa(ui->device_projectorsw, 255, LV_PART_INDICATOR|LV_STATE_CHECKED); lv_obj_set_style_bg_color(ui->device_projectorsw, lv_color_hex(0x2195f6), LV_PART_INDICATOR|LV_STATE_CHECKED); lv_obj_set_style_bg_grad_dir(ui->device_projectorsw, LV_GRAD_DIR_NONE, LV_PART_INDICATOR|LV_STATE_CHECKED); lv_obj_set_style_border_width(ui->device_projectorsw, 0, LV_PART_INDICATOR|LV_STATE_CHECKED); //Write style for device_projectorsw, Part: LV_PART_KNOB, State: LV_STATE_DEFAULT. lv_obj_set_style_bg_opa(ui->device_projectorsw, 255, LV_PART_KNOB|LV_STATE_DEFAULT); lv_obj_set_style_bg_color(ui->device_projectorsw, lv_color_hex(0xffffff), LV_PART_KNOB|LV_STATE_DEFAULT); lv_obj_set_style_bg_grad_dir(ui->device_projectorsw, LV_GRAD_DIR_NONE, LV_PART_KNOB|LV_STATE_DEFAULT); lv_obj_set_style_border_width(ui->device_projectorsw, 0, LV_PART_KNOB|LV_STATE_DEFAULT); lv_obj_set_style_radius(ui->device_projectorsw, 30, LV_PART_KNOB|LV_STATE_DEFAULT); //The custom code of device. if(nvs_SysInfo.projector.onoff) { lv_obj_add_state(ui->device_projectorsw, LV_STATE_CHECKED); // 开 } else { lv_obj_clear_state(ui->device_projectorsw, LV_STATE_CHECKED); // 关 } //Update current screen layout. lv_obj_update_layout(ui->device); //Init events for screen. //创建事件 events_init_device_projector(ui); } void setup_scr_device(lv_ui *ui) { //Write codes device ui->device = lv_obj_create(ui->screen_main_tileview_devices); lv_obj_set_pos(ui->device, 0, 0); lv_obj_set_size(ui->device, 480, 480); lv_obj_set_scrollbar_mode(ui->device,LV_SCROLLBAR_MODE_OFF);//不显示滚动条 lv_obj_clear_flag(ui->device, LV_OBJ_FLAG_SCROLLABLE); // 禁止滚动 //Write style for onoff4, Part: LV_PART_MAIN, State: LV_STATE_DEFAULT. lv_obj_set_style_border_width(ui->device, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_radius(ui->device, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_opa(ui->device, 0, LV_PART_MAIN|LV_STATE_DEFAULT); // lv_obj_set_style_bg_color(ui->device, lv_color_hex(0x000000), LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_grad_dir(ui->device, LV_GRAD_DIR_NONE, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_all(ui->device, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_shadow_width(ui->device, 0, LV_PART_MAIN|LV_STATE_DEFAULT); // //Write codes device_settings_icon // ui->device_settings_icon = lv_img_create(ui->device); // lv_obj_add_flag(ui->device_settings_icon, LV_OBJ_FLAG_CLICKABLE); // lv_img_set_src(ui->device_settings_icon, LVGL_PATH(settings_icon.png)); // lv_img_set_pivot(ui->device_settings_icon, 50,50); // lv_img_set_angle(ui->device_settings_icon, 0); // lv_obj_set_pos(ui->device_settings_icon, 432, 24); // lv_obj_set_size(ui->device_settings_icon, 27, 27); // //Write style for device_settings_icon, Part: LV_PART_MAIN, State: LV_STATE_DEFAULT. // lv_obj_set_style_img_opa(ui->device_settings_icon, 255, LV_PART_MAIN|LV_STATE_DEFAULT); // //Write codes device_settings_btn // ui->device_settings_btn = lv_btn_create(ui->device); // ui->device_settings_btn_label = lv_label_create(ui->device_settings_btn); // lv_label_set_text(ui->device_settings_btn_label, ""); // lv_label_set_long_mode(ui->device_settings_btn_label, LV_LABEL_LONG_WRAP); // lv_obj_align(ui->device_settings_btn_label, LV_ALIGN_CENTER, 0, 0); // lv_obj_set_style_pad_all(ui->device_settings_btn, 0, LV_STATE_DEFAULT); // lv_obj_set_width(ui->device_settings_btn_label, LV_PCT(100)); // lv_obj_set_pos(ui->device_settings_btn, 418, 12); // lv_obj_set_size(ui->device_settings_btn, 50, 50); // //Write style for device_settings_btn, Part: LV_PART_MAIN, State: LV_STATE_DEFAULT. // lv_obj_set_style_border_width(ui->device_settings_btn, 0, LV_PART_MAIN|LV_STATE_DEFAULT); // lv_obj_set_style_radius(ui->device_settings_btn, 5, LV_PART_MAIN|LV_STATE_DEFAULT); // lv_obj_set_style_bg_opa(ui->device_settings_btn, 0, LV_PART_MAIN|LV_STATE_DEFAULT); // lv_obj_set_style_shadow_width(ui->device_settings_btn, 0, LV_PART_MAIN|LV_STATE_DEFAULT); // lv_obj_set_style_text_color(ui->device_settings_btn, lv_color_hex(0xffffff), LV_PART_MAIN|LV_STATE_DEFAULT); // lv_obj_set_style_text_font(ui->device_settings_btn, &lv_font_simsun_16, LV_PART_MAIN|LV_STATE_DEFAULT); // lv_obj_set_style_text_opa(ui->device_settings_btn, 255, LV_PART_MAIN|LV_STATE_DEFAULT); // lv_obj_set_style_text_align(ui->device_settings_btn, LV_TEXT_ALIGN_CENTER, LV_PART_MAIN|LV_STATE_DEFAULT); //创建右上角子设备添加按钮 //Write codes device_managebtn ui->device_managebtn = lv_btn_create(ui->device); lv_obj_set_pos(ui->device_managebtn, 408, 20); lv_obj_set_size(ui->device_managebtn, 50, 50); //Write style state: LV_STATE_DEFAULT for style_device_managebtn_main_main_default static lv_style_t style_device_managebtn_main_main_default; lv_style_reset(&style_device_managebtn_main_main_default); lv_style_set_radius(&style_device_managebtn_main_main_default, 25); lv_style_set_bg_color(&style_device_managebtn_main_main_default, lv_color_make(0x10, 0xa6, 0xea)); lv_style_set_bg_grad_color(&style_device_managebtn_main_main_default, lv_color_make(0x10, 0xa6, 0xea)); lv_style_set_bg_grad_dir(&style_device_managebtn_main_main_default, LV_GRAD_DIR_VER); lv_style_set_bg_opa(&style_device_managebtn_main_main_default, 255); lv_style_set_shadow_color(&style_device_managebtn_main_main_default, lv_color_make(0x10, 0xa6, 0xea)); lv_style_set_shadow_opa(&style_device_managebtn_main_main_default, 0); lv_style_set_border_color(&style_device_managebtn_main_main_default, lv_color_make(0x10, 0xa6, 0xea)); lv_style_set_border_width(&style_device_managebtn_main_main_default, 0); lv_style_set_border_opa(&style_device_managebtn_main_main_default, 0); lv_obj_add_style(ui->device_managebtn, &style_device_managebtn_main_main_default, LV_PART_MAIN|LV_STATE_DEFAULT); ui->device_managebtn_label = lv_label_create(ui->device_managebtn); lv_label_set_text(ui->device_managebtn_label, "+"); lv_obj_set_style_text_color(ui->device_managebtn_label, lv_color_make(0xff, 0xff, 0xff), LV_STATE_DEFAULT); lv_obj_set_style_text_font(ui->device_managebtn_label, &lv_font_simsun_48, LV_STATE_DEFAULT); lv_obj_set_style_pad_all(ui->device_managebtn, 0, LV_STATE_DEFAULT); lv_obj_align(ui->device_managebtn_label, LV_ALIGN_CENTER, 0, 0); //创建设备容器 //Write codes device_cont_1 ui->device_cont_1 = lv_obj_create(ui->device); lv_obj_set_pos(ui->device_cont_1, 5, 80); lv_obj_set_size(ui->device_cont_1, 470, 300); lv_obj_set_scrollbar_mode(ui->device_cont_1,LV_SCROLLBAR_MODE_OFF);//不显示滚动条 //lv_obj_clear_flag(ui->device_cont_1, LV_OBJ_FLAG_SCROLLABLE); // 禁止滚动 lv_obj_remove_style(ui->device_cont_1, NULL, LV_PART_SCROLLBAR);//移除滚动条 //Write style for device_cont_1, Part: LV_PART_MAIN, State: LV_STATE_DEFAULT. lv_obj_set_style_border_width(ui->device_cont_1, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_border_opa(ui->device_cont_1, 0, LV_PART_MAIN|LV_STATE_DEFAULT); // lv_obj_set_style_border_color(ui->device_cont_1, lv_color_hex(0x000000), LV_PART_MAIN|LV_STATE_DEFAULT); // lv_obj_set_style_border_side(ui->device_cont_1, LV_BORDER_SIDE_FULL, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_radius(ui->device_cont_1, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_opa(ui->device_cont_1, 255, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_color(ui->device_cont_1, lv_color_hex(0x000000), LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_grad_dir(ui->device_cont_1, LV_GRAD_DIR_NONE, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_shadow_width(ui->device_cont_1, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_all(ui->device_cont_1, 0, LV_PART_MAIN|LV_STATE_DEFAULT); //The custom code of device. //其它设备动态显示 #define D_SUBDEVICE_X 5//x坐标固定不变 #define D_SUBDEVICE_WIDTH 460//宽度固定不变 //可变得只有y和每个字设备的高度 lv_coord_t y=0; for(int i=0;idevice_cont_1,D_SUBDEVICE_X,y,D_SUBDEVICE_WIDTH,170); y=y+170+2;//2个空格的间隙 LOG_I_LINE("create gang after x=%d",y); } if((i==1)&&nvs_SysInfo.subdevice_array[i])//场景开关2路 { LOG_I_LINE("create gang before x=%d",y); create_device_gang2(ui,ui->device_cont_1,D_SUBDEVICE_X,y,D_SUBDEVICE_WIDTH,170); y=y+170+2;//2个空格的间隙 LOG_I_LINE("create gang after x=%d",y); } if((i==2)&&nvs_SysInfo.subdevice_array[i])//场景开关3路 { LOG_I_LINE("create gang before x=%d",y); create_device_gang3(ui,ui->device_cont_1,D_SUBDEVICE_X,y,D_SUBDEVICE_WIDTH,170); y=y+170+2;//2个空格的间隙 LOG_I_LINE("create gang after x=%d",y); } if((i==3)&&nvs_SysInfo.subdevice_array[i])//场景开关4路 { LOG_I_LINE("create gang before x=%d",y); create_device_gang4(ui,ui->device_cont_1,D_SUBDEVICE_X,y,D_SUBDEVICE_WIDTH,170); y=y+170+2;//2个空格的间隙 LOG_I_LINE("create gang after x=%d",y); } if((i==4)&&nvs_SysInfo.subdevice_array[i])//场景开关6路 { LOG_I_LINE("create gang before x=%d",y); create_device_gang6(ui,ui->device_cont_1,D_SUBDEVICE_X,y,D_SUBDEVICE_WIDTH,250); y=y+250+2;//2个空格的间隙 LOG_I_LINE("create gang after x=%d",y); } else if((i==5)&&nvs_SysInfo.subdevice_array[i])//空调 { LOG_I_LINE("create air before x=%d",y); create_device_air(ui,ui->device_cont_1,D_SUBDEVICE_X,y,D_SUBDEVICE_WIDTH,100); y=y+100+2;//2个空格的间隙 LOG_I_LINE("create air after x=%d",y); } else if((i==6)&&nvs_SysInfo.subdevice_array[i])//投影仪 { LOG_I_LINE("create curtain before x=%d",y); create_device_projector(ui,ui->device_cont_1,D_SUBDEVICE_X,y,D_SUBDEVICE_WIDTH,100); y=y+100+2;//2个空格的间隙 LOG_I_LINE("create curtain after x=%d",y); } } //Update current screen layout. lv_obj_update_layout(ui->device); //Init events for screen. events_init_device(ui); }