/* * Copyright 2026 NXP * NXP 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" #include "esp_log.h" void setup_scr_screen_sleep(lv_ui *ui) { // ESP_LOGI("setup_scr", ">>> %s", __func__); //Write codes screen_sleep ui->screen_sleep = lv_obj_create(NULL); lv_obj_set_size(ui->screen_sleep, 502, 410); lv_obj_set_scrollbar_mode(ui->screen_sleep, LV_SCROLLBAR_MODE_OFF); //Write style for screen_sleep, Part: LV_PART_MAIN, State: LV_STATE_DEFAULT. lv_obj_set_style_bg_opa(ui->screen_sleep, 255, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_color(ui->screen_sleep, lv_color_hex(0x000000), LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_grad_dir(ui->screen_sleep, LV_GRAD_DIR_NONE, LV_PART_MAIN|LV_STATE_DEFAULT); //Write codes screen_sleep_label_time ui->screen_sleep_label_time = lv_label_create(ui->screen_sleep); lv_obj_set_pos(ui->screen_sleep_label_time, 90, 145); lv_obj_set_size(ui->screen_sleep_label_time, 320, 60); lv_label_set_text(ui->screen_sleep_label_time, ""); lv_label_set_long_mode(ui->screen_sleep_label_time, LV_LABEL_LONG_WRAP); //Write style for screen_sleep_label_time, Part: LV_PART_MAIN, State: LV_STATE_DEFAULT. lv_obj_set_style_border_width(ui->screen_sleep_label_time, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_radius(ui->screen_sleep_label_time, 17, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_color(ui->screen_sleep_label_time, lv_color_hex(0x000000), LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_font(ui->screen_sleep_label_time, &lv_font_montserrat_14, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_opa(ui->screen_sleep_label_time, 255, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_letter_space(ui->screen_sleep_label_time, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_line_space(ui->screen_sleep_label_time, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_align(ui->screen_sleep_label_time, LV_TEXT_ALIGN_CENTER, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_opa(ui->screen_sleep_label_time, 255, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_color(ui->screen_sleep_label_time, lv_color_hex(0x242323), LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_grad_dir(ui->screen_sleep_label_time, LV_GRAD_DIR_NONE, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_top(ui->screen_sleep_label_time, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_right(ui->screen_sleep_label_time, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_bottom(ui->screen_sleep_label_time, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_left(ui->screen_sleep_label_time, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_shadow_width(ui->screen_sleep_label_time, 0, LV_PART_MAIN|LV_STATE_DEFAULT); //Write codes screen_sleep_label_1 ui->screen_sleep_label_1 = lv_label_create(ui->screen_sleep); lv_obj_set_pos(ui->screen_sleep_label_1, 90, 230); lv_obj_set_size(ui->screen_sleep_label_1, 320, 60); lv_label_set_text(ui->screen_sleep_label_1, ""); lv_label_set_long_mode(ui->screen_sleep_label_1, LV_LABEL_LONG_WRAP); //Write style for screen_sleep_label_1, Part: LV_PART_MAIN, State: LV_STATE_DEFAULT. lv_obj_set_style_border_width(ui->screen_sleep_label_1, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_radius(ui->screen_sleep_label_1, 17, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_color(ui->screen_sleep_label_1, lv_color_hex(0x000000), LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_font(ui->screen_sleep_label_1, &lv_font_montserrat_14, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_opa(ui->screen_sleep_label_1, 255, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_letter_space(ui->screen_sleep_label_1, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_line_space(ui->screen_sleep_label_1, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_align(ui->screen_sleep_label_1, LV_TEXT_ALIGN_CENTER, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_opa(ui->screen_sleep_label_1, 255, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_color(ui->screen_sleep_label_1, lv_color_hex(0x242323), LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_grad_dir(ui->screen_sleep_label_1, LV_GRAD_DIR_NONE, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_top(ui->screen_sleep_label_1, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_right(ui->screen_sleep_label_1, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_bottom(ui->screen_sleep_label_1, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_left(ui->screen_sleep_label_1, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_shadow_width(ui->screen_sleep_label_1, 0, LV_PART_MAIN|LV_STATE_DEFAULT); //Write codes screen_sleep_btn_10min ui->screen_sleep_btn_10min = lv_button_create(ui->screen_sleep); lv_obj_set_pos(ui->screen_sleep_btn_10min, 310, 150); lv_obj_set_size(ui->screen_sleep_btn_10min, 72, 50); ui->screen_sleep_btn_10min_label = lv_label_create(ui->screen_sleep_btn_10min); lv_label_set_text(ui->screen_sleep_btn_10min_label, "10min"); lv_label_set_long_mode(ui->screen_sleep_btn_10min_label, LV_LABEL_LONG_WRAP); lv_obj_align(ui->screen_sleep_btn_10min_label, LV_ALIGN_CENTER, 0, 0); lv_obj_set_style_pad_all(ui->screen_sleep_btn_10min, 0, LV_STATE_DEFAULT); lv_obj_set_width(ui->screen_sleep_btn_10min_label, LV_PCT(100)); //Write style for screen_sleep_btn_10min, Part: LV_PART_MAIN, State: LV_STATE_DEFAULT. lv_obj_set_style_bg_opa(ui->screen_sleep_btn_10min, 255, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_color(ui->screen_sleep_btn_10min, lv_color_hex(0x242323), LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_grad_dir(ui->screen_sleep_btn_10min, LV_GRAD_DIR_NONE, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_border_width(ui->screen_sleep_btn_10min, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_radius(ui->screen_sleep_btn_10min, 15, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_shadow_width(ui->screen_sleep_btn_10min, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_color(ui->screen_sleep_btn_10min, lv_color_hex(0x6B6C6C), LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_font(ui->screen_sleep_btn_10min, &lv_font_montserrat_14, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_opa(ui->screen_sleep_btn_10min, 255, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_align(ui->screen_sleep_btn_10min, LV_TEXT_ALIGN_CENTER, LV_PART_MAIN|LV_STATE_DEFAULT); //Write style for screen_sleep_btn_10min, Part: LV_PART_MAIN, State: LV_STATE_CHECKED. lv_obj_set_style_bg_opa(ui->screen_sleep_btn_10min, 255, LV_PART_MAIN|LV_STATE_CHECKED); lv_obj_set_style_bg_color(ui->screen_sleep_btn_10min, lv_color_hex(0x56D695), LV_PART_MAIN|LV_STATE_CHECKED); lv_obj_set_style_bg_grad_dir(ui->screen_sleep_btn_10min, LV_GRAD_DIR_NONE, LV_PART_MAIN|LV_STATE_CHECKED); lv_obj_set_style_border_width(ui->screen_sleep_btn_10min, 0, LV_PART_MAIN|LV_STATE_CHECKED); lv_obj_set_style_radius(ui->screen_sleep_btn_10min, 15, LV_PART_MAIN|LV_STATE_CHECKED); lv_obj_set_style_shadow_width(ui->screen_sleep_btn_10min, 0, LV_PART_MAIN|LV_STATE_CHECKED); lv_obj_set_style_text_color(ui->screen_sleep_btn_10min, lv_color_hex(0xffffff), LV_PART_MAIN|LV_STATE_CHECKED); lv_obj_set_style_text_font(ui->screen_sleep_btn_10min, &lv_font_montserrat_14, LV_PART_MAIN|LV_STATE_CHECKED); lv_obj_set_style_text_opa(ui->screen_sleep_btn_10min, 255, LV_PART_MAIN|LV_STATE_CHECKED); //Write codes screen_sleep_btn_5min ui->screen_sleep_btn_5min = lv_button_create(ui->screen_sleep); lv_obj_set_pos(ui->screen_sleep_btn_5min, 200, 150); lv_obj_set_size(ui->screen_sleep_btn_5min, 70, 50); ui->screen_sleep_btn_5min_label = lv_label_create(ui->screen_sleep_btn_5min); lv_label_set_text(ui->screen_sleep_btn_5min_label, "5min"); lv_label_set_long_mode(ui->screen_sleep_btn_5min_label, LV_LABEL_LONG_WRAP); lv_obj_align(ui->screen_sleep_btn_5min_label, LV_ALIGN_CENTER, 0, 0); lv_obj_set_style_pad_all(ui->screen_sleep_btn_5min, 0, LV_STATE_DEFAULT); lv_obj_set_width(ui->screen_sleep_btn_5min_label, LV_PCT(100)); //Write style for screen_sleep_btn_5min, Part: LV_PART_MAIN, State: LV_STATE_DEFAULT. lv_obj_set_style_bg_opa(ui->screen_sleep_btn_5min, 255, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_color(ui->screen_sleep_btn_5min, lv_color_hex(0x242323), LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_grad_dir(ui->screen_sleep_btn_5min, LV_GRAD_DIR_NONE, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_border_width(ui->screen_sleep_btn_5min, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_radius(ui->screen_sleep_btn_5min, 15, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_shadow_width(ui->screen_sleep_btn_5min, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_color(ui->screen_sleep_btn_5min, lv_color_hex(0x6B6C6C), LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_font(ui->screen_sleep_btn_5min, &lv_font_montserrat_14, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_opa(ui->screen_sleep_btn_5min, 255, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_align(ui->screen_sleep_btn_5min, LV_TEXT_ALIGN_CENTER, LV_PART_MAIN|LV_STATE_DEFAULT); //Write style for screen_sleep_btn_5min, Part: LV_PART_MAIN, State: LV_STATE_CHECKED. lv_obj_set_style_bg_opa(ui->screen_sleep_btn_5min, 255, LV_PART_MAIN|LV_STATE_CHECKED); lv_obj_set_style_bg_color(ui->screen_sleep_btn_5min, lv_color_hex(0x56D695), LV_PART_MAIN|LV_STATE_CHECKED); lv_obj_set_style_bg_grad_dir(ui->screen_sleep_btn_5min, LV_GRAD_DIR_NONE, LV_PART_MAIN|LV_STATE_CHECKED); lv_obj_set_style_border_width(ui->screen_sleep_btn_5min, 0, LV_PART_MAIN|LV_STATE_CHECKED); lv_obj_set_style_radius(ui->screen_sleep_btn_5min, 15, LV_PART_MAIN|LV_STATE_CHECKED); lv_obj_set_style_shadow_width(ui->screen_sleep_btn_5min, 0, LV_PART_MAIN|LV_STATE_CHECKED); lv_obj_set_style_text_color(ui->screen_sleep_btn_5min, lv_color_hex(0xffffff), LV_PART_MAIN|LV_STATE_CHECKED); lv_obj_set_style_text_font(ui->screen_sleep_btn_5min, &lv_font_montserrat_14, LV_PART_MAIN|LV_STATE_CHECKED); lv_obj_set_style_text_opa(ui->screen_sleep_btn_5min, 255, LV_PART_MAIN|LV_STATE_CHECKED); //Write codes screen_sleep_btn_never ui->screen_sleep_btn_never = lv_button_create(ui->screen_sleep); lv_obj_set_pos(ui->screen_sleep_btn_never, 283, 235); lv_obj_set_size(ui->screen_sleep_btn_never, 114, 50); ui->screen_sleep_btn_never_label = lv_label_create(ui->screen_sleep_btn_never); lv_label_set_text(ui->screen_sleep_btn_never_label, "永 不"); lv_label_set_long_mode(ui->screen_sleep_btn_never_label, LV_LABEL_LONG_WRAP); lv_obj_align(ui->screen_sleep_btn_never_label, LV_ALIGN_CENTER, 0, 0); lv_obj_set_style_pad_all(ui->screen_sleep_btn_never, 0, LV_STATE_DEFAULT); lv_obj_set_width(ui->screen_sleep_btn_never_label, LV_PCT(100)); //Write style for screen_sleep_btn_never, Part: LV_PART_MAIN, State: LV_STATE_DEFAULT. lv_obj_set_style_bg_opa(ui->screen_sleep_btn_never, 255, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_color(ui->screen_sleep_btn_never, lv_color_hex(0x242323), LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_grad_dir(ui->screen_sleep_btn_never, LV_GRAD_DIR_NONE, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_border_width(ui->screen_sleep_btn_never, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_radius(ui->screen_sleep_btn_never, 15, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_shadow_width(ui->screen_sleep_btn_never, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_color(ui->screen_sleep_btn_never, lv_color_hex(0x6B6C6C), LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_font(ui->screen_sleep_btn_never, &lv_font_montserrat_14, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_opa(ui->screen_sleep_btn_never, 255, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_align(ui->screen_sleep_btn_never, LV_TEXT_ALIGN_CENTER, LV_PART_MAIN|LV_STATE_DEFAULT); //Write style for screen_sleep_btn_never, Part: LV_PART_MAIN, State: LV_STATE_CHECKED. lv_obj_set_style_bg_opa(ui->screen_sleep_btn_never, 255, LV_PART_MAIN|LV_STATE_CHECKED); lv_obj_set_style_bg_color(ui->screen_sleep_btn_never, lv_color_hex(0x56D695), LV_PART_MAIN|LV_STATE_CHECKED); lv_obj_set_style_bg_grad_dir(ui->screen_sleep_btn_never, LV_GRAD_DIR_NONE, LV_PART_MAIN|LV_STATE_CHECKED); lv_obj_set_style_border_width(ui->screen_sleep_btn_never, 0, LV_PART_MAIN|LV_STATE_CHECKED); lv_obj_set_style_radius(ui->screen_sleep_btn_never, 15, LV_PART_MAIN|LV_STATE_CHECKED); lv_obj_set_style_shadow_width(ui->screen_sleep_btn_never, 0, LV_PART_MAIN|LV_STATE_CHECKED); lv_obj_set_style_text_color(ui->screen_sleep_btn_never, lv_color_hex(0xffffff), LV_PART_MAIN|LV_STATE_CHECKED); lv_obj_set_style_text_font(ui->screen_sleep_btn_never, &lv_font_montserrat_14, LV_PART_MAIN|LV_STATE_CHECKED); lv_obj_set_style_text_opa(ui->screen_sleep_btn_never, 255, LV_PART_MAIN|LV_STATE_CHECKED); //Write codes screen_sleep_btn_30s ui->screen_sleep_btn_30s = lv_button_create(ui->screen_sleep); lv_obj_set_pos(ui->screen_sleep_btn_30s, 100, 150); lv_obj_set_size(ui->screen_sleep_btn_30s, 70, 50); ui->screen_sleep_btn_30s_label = lv_label_create(ui->screen_sleep_btn_30s); lv_label_set_text(ui->screen_sleep_btn_30s_label, "30s"); lv_label_set_long_mode(ui->screen_sleep_btn_30s_label, LV_LABEL_LONG_WRAP); lv_obj_align(ui->screen_sleep_btn_30s_label, LV_ALIGN_CENTER, 0, 0); lv_obj_set_style_pad_all(ui->screen_sleep_btn_30s, 0, LV_STATE_DEFAULT); lv_obj_set_width(ui->screen_sleep_btn_30s_label, LV_PCT(100)); //Write style for screen_sleep_btn_30s, Part: LV_PART_MAIN, State: LV_STATE_DEFAULT. lv_obj_set_style_bg_opa(ui->screen_sleep_btn_30s, 255, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_color(ui->screen_sleep_btn_30s, lv_color_hex(0x242323), LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_grad_dir(ui->screen_sleep_btn_30s, LV_GRAD_DIR_NONE, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_border_width(ui->screen_sleep_btn_30s, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_radius(ui->screen_sleep_btn_30s, 15, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_shadow_width(ui->screen_sleep_btn_30s, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_color(ui->screen_sleep_btn_30s, lv_color_hex(0x6B6C6C), LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_font(ui->screen_sleep_btn_30s, &lv_font_montserrat_14, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_opa(ui->screen_sleep_btn_30s, 255, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_align(ui->screen_sleep_btn_30s, LV_TEXT_ALIGN_CENTER, LV_PART_MAIN|LV_STATE_DEFAULT); //Write style for screen_sleep_btn_30s, Part: LV_PART_MAIN, State: LV_STATE_CHECKED. lv_obj_set_style_bg_opa(ui->screen_sleep_btn_30s, 255, LV_PART_MAIN|LV_STATE_CHECKED); lv_obj_set_style_bg_color(ui->screen_sleep_btn_30s, lv_color_hex(0x56D695), LV_PART_MAIN|LV_STATE_CHECKED); lv_obj_set_style_bg_grad_dir(ui->screen_sleep_btn_30s, LV_GRAD_DIR_NONE, LV_PART_MAIN|LV_STATE_CHECKED); lv_obj_set_style_border_width(ui->screen_sleep_btn_30s, 0, LV_PART_MAIN|LV_STATE_CHECKED); lv_obj_set_style_radius(ui->screen_sleep_btn_30s, 15, LV_PART_MAIN|LV_STATE_CHECKED); lv_obj_set_style_shadow_width(ui->screen_sleep_btn_30s, 0, LV_PART_MAIN|LV_STATE_CHECKED); lv_obj_set_style_text_color(ui->screen_sleep_btn_30s, lv_color_hex(0xffffff), LV_PART_MAIN|LV_STATE_CHECKED); lv_obj_set_style_text_font(ui->screen_sleep_btn_30s, &lv_font_montserrat_14, LV_PART_MAIN|LV_STATE_CHECKED); lv_obj_set_style_text_opa(ui->screen_sleep_btn_30s, 255, LV_PART_MAIN|LV_STATE_CHECKED); //Write codes screen_sleep_label_sleep ui->screen_sleep_label_sleep = lv_label_create(ui->screen_sleep); lv_obj_set_pos(ui->screen_sleep_label_sleep, 129, 96); lv_obj_set_size(ui->screen_sleep_label_sleep, 238, 26); lv_label_set_text(ui->screen_sleep_label_sleep, "请选择自动休眠时间"); lv_label_set_long_mode(ui->screen_sleep_label_sleep, LV_LABEL_LONG_WRAP); //Write style for screen_sleep_label_sleep, Part: LV_PART_MAIN, State: LV_STATE_DEFAULT. lv_obj_set_style_border_width(ui->screen_sleep_label_sleep, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_radius(ui->screen_sleep_label_sleep, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_color(ui->screen_sleep_label_sleep, lv_color_hex(0xffffff), LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_font(ui->screen_sleep_label_sleep, &lv_font_montserrat_14, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_opa(ui->screen_sleep_label_sleep, 255, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_letter_space(ui->screen_sleep_label_sleep, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_line_space(ui->screen_sleep_label_sleep, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_align(ui->screen_sleep_label_sleep, LV_TEXT_ALIGN_CENTER, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_opa(ui->screen_sleep_label_sleep, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_top(ui->screen_sleep_label_sleep, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_right(ui->screen_sleep_label_sleep, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_bottom(ui->screen_sleep_label_sleep, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_left(ui->screen_sleep_label_sleep, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_shadow_width(ui->screen_sleep_label_sleep, 0, LV_PART_MAIN|LV_STATE_DEFAULT); //Write codes screen_sleep_btn_now ui->screen_sleep_btn_now = lv_button_create(ui->screen_sleep); lv_obj_set_pos(ui->screen_sleep_btn_now, 100, 235); lv_obj_set_size(ui->screen_sleep_btn_now, 114, 50); ui->screen_sleep_btn_now_label = lv_label_create(ui->screen_sleep_btn_now); lv_label_set_text(ui->screen_sleep_btn_now_label, "立 即"); lv_label_set_long_mode(ui->screen_sleep_btn_now_label, LV_LABEL_LONG_WRAP); lv_obj_align(ui->screen_sleep_btn_now_label, LV_ALIGN_CENTER, 0, 0); lv_obj_set_style_pad_all(ui->screen_sleep_btn_now, 0, LV_STATE_DEFAULT); lv_obj_set_width(ui->screen_sleep_btn_now_label, LV_PCT(100)); //Write style for screen_sleep_btn_now, Part: LV_PART_MAIN, State: LV_STATE_DEFAULT. lv_obj_set_style_bg_opa(ui->screen_sleep_btn_now, 255, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_color(ui->screen_sleep_btn_now, lv_color_hex(0x242323), LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_grad_dir(ui->screen_sleep_btn_now, LV_GRAD_DIR_NONE, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_border_width(ui->screen_sleep_btn_now, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_radius(ui->screen_sleep_btn_now, 15, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_shadow_width(ui->screen_sleep_btn_now, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_color(ui->screen_sleep_btn_now, lv_color_hex(0x6B6C6C), LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_font(ui->screen_sleep_btn_now, &lv_font_montserrat_14, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_opa(ui->screen_sleep_btn_now, 255, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_align(ui->screen_sleep_btn_now, LV_TEXT_ALIGN_CENTER, LV_PART_MAIN|LV_STATE_DEFAULT); //Write style for screen_sleep_btn_now, Part: LV_PART_MAIN, State: LV_STATE_CHECKED. lv_obj_set_style_bg_opa(ui->screen_sleep_btn_now, 255, LV_PART_MAIN|LV_STATE_CHECKED); lv_obj_set_style_bg_color(ui->screen_sleep_btn_now, lv_color_hex(0x56D695), LV_PART_MAIN|LV_STATE_CHECKED); lv_obj_set_style_bg_grad_dir(ui->screen_sleep_btn_now, LV_GRAD_DIR_NONE, LV_PART_MAIN|LV_STATE_CHECKED); lv_obj_set_style_border_width(ui->screen_sleep_btn_now, 0, LV_PART_MAIN|LV_STATE_CHECKED); lv_obj_set_style_radius(ui->screen_sleep_btn_now, 15, LV_PART_MAIN|LV_STATE_CHECKED); lv_obj_set_style_shadow_width(ui->screen_sleep_btn_now, 0, LV_PART_MAIN|LV_STATE_CHECKED); lv_obj_set_style_text_color(ui->screen_sleep_btn_now, lv_color_hex(0xffffff), LV_PART_MAIN|LV_STATE_CHECKED); lv_obj_set_style_text_font(ui->screen_sleep_btn_now, &lv_font_montserrat_14, LV_PART_MAIN|LV_STATE_CHECKED); lv_obj_set_style_text_opa(ui->screen_sleep_btn_now, 255, LV_PART_MAIN|LV_STATE_CHECKED); //Write codes screen_sleep_btn_set_back ui->screen_sleep_btn_set_back = lv_button_create(ui->screen_sleep); lv_obj_set_pos(ui->screen_sleep_btn_set_back, 25, 30); lv_obj_set_size(ui->screen_sleep_btn_set_back, 57, 45); ui->screen_sleep_btn_set_back_label = lv_label_create(ui->screen_sleep_btn_set_back); lv_label_set_text(ui->screen_sleep_btn_set_back_label, ""); lv_label_set_long_mode(ui->screen_sleep_btn_set_back_label, LV_LABEL_LONG_WRAP); lv_obj_align(ui->screen_sleep_btn_set_back_label, LV_ALIGN_CENTER, 0, 0); lv_obj_set_style_pad_all(ui->screen_sleep_btn_set_back, 0, LV_STATE_DEFAULT); lv_obj_set_width(ui->screen_sleep_btn_set_back_label, LV_PCT(100)); //Write style for screen_sleep_btn_set_back, Part: LV_PART_MAIN, State: LV_STATE_DEFAULT. lv_obj_set_style_bg_opa(ui->screen_sleep_btn_set_back, 255, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_color(ui->screen_sleep_btn_set_back, lv_color_hex(0x000000), LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_grad_dir(ui->screen_sleep_btn_set_back, LV_GRAD_DIR_NONE, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_border_width(ui->screen_sleep_btn_set_back, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_radius(ui->screen_sleep_btn_set_back, 17, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_shadow_width(ui->screen_sleep_btn_set_back, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_color(ui->screen_sleep_btn_set_back, lv_color_hex(0xffffff), LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_font(ui->screen_sleep_btn_set_back, &lv_font_montserrat_14, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_opa(ui->screen_sleep_btn_set_back, 255, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_align(ui->screen_sleep_btn_set_back, LV_TEXT_ALIGN_CENTER, LV_PART_MAIN|LV_STATE_DEFAULT); //Write style for screen_sleep_btn_set_back, Part: LV_PART_MAIN, State: LV_STATE_CHECKED. lv_obj_set_style_bg_opa(ui->screen_sleep_btn_set_back, 255, LV_PART_MAIN|LV_STATE_CHECKED); lv_obj_set_style_bg_color(ui->screen_sleep_btn_set_back, lv_color_hex(0x000000), LV_PART_MAIN|LV_STATE_CHECKED); lv_obj_set_style_bg_grad_dir(ui->screen_sleep_btn_set_back, LV_GRAD_DIR_NONE, LV_PART_MAIN|LV_STATE_CHECKED); lv_obj_set_style_border_width(ui->screen_sleep_btn_set_back, 0, LV_PART_MAIN|LV_STATE_CHECKED); lv_obj_set_style_radius(ui->screen_sleep_btn_set_back, 17, LV_PART_MAIN|LV_STATE_CHECKED); lv_obj_set_style_shadow_width(ui->screen_sleep_btn_set_back, 0, LV_PART_MAIN|LV_STATE_CHECKED); lv_obj_set_style_text_color(ui->screen_sleep_btn_set_back, lv_color_hex(0xffffff), LV_PART_MAIN|LV_STATE_CHECKED); lv_obj_set_style_text_font(ui->screen_sleep_btn_set_back, &lv_font_montserrat_14, LV_PART_MAIN|LV_STATE_CHECKED); lv_obj_set_style_text_opa(ui->screen_sleep_btn_set_back, 255, LV_PART_MAIN|LV_STATE_CHECKED); //The custom code of screen_sleep. //Update current screen layout. // ESP_LOGI("setup_scr", "%s: lv_obj_update_layout", __func__); lv_obj_update_layout(ui->screen_sleep); //Init events for screen. // ESP_LOGI("setup_scr", "%s: events_init_screen_sleep", __func__); events_init_screen_sleep(ui); // ESP_LOGI("setup_scr", "<<< %s done", __func__); }