custom.c 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /*
  2. * Copyright 2024 NXP
  3. * NXP Proprietary. This software is owned or controlled by NXP and may only be used strictly in
  4. * accordance with the applicable license terms. By expressly accepting such terms or by downloading, installing,
  5. * activating and/or otherwise using the software, you are agreeing that you have read, and that you agree to
  6. * comply with and are bound by, such license terms. If you do not agree to be bound by the applicable license
  7. * terms, then you may not retain, install, activate or otherwise use the software.
  8. */
  9. /*********************
  10. * INCLUDES
  11. *********************/
  12. #include <stdio.h>
  13. #include <esp_app_desc.h>
  14. #include "lvgl.h"
  15. #include "custom.h"
  16. #include "wifi.h"
  17. #include "system/miscellaneous_interface.h"
  18. /*********************
  19. * DEFINES
  20. *********************/
  21. /**********************
  22. * TYPEDEFS
  23. **********************/
  24. /**********************
  25. * STATIC PROTOTYPES
  26. **********************/
  27. /**********************
  28. * STATIC VARIABLES
  29. **********************/
  30. /**
  31. * Create a demo application
  32. */
  33. void custom_init(lv_ui *ui) {
  34. /* Add your codes here */
  35. }
  36. void setting_page_init(lv_ui *ui) {
  37. static lv_style_t style_SettingPage_tabview_1_extra_btnm_items_default;
  38. ui_init_style(&style_SettingPage_tabview_1_extra_btnm_items_default);
  39. lv_style_set_text_color(&style_SettingPage_tabview_1_extra_btnm_items_default, lv_color_hex(0xffb204));
  40. lv_style_set_text_font(&style_SettingPage_tabview_1_extra_btnm_items_default, &lv_font_Alibaba_PuHuiTi_Medium_16);
  41. lv_style_set_text_opa(&style_SettingPage_tabview_1_extra_btnm_items_default, 255);
  42. lv_obj_add_style(lv_tabview_get_tab_bar(ui->SettingPage_tabview_1),
  43. &style_SettingPage_tabview_1_extra_btnm_items_default, LV_PART_MAIN | LV_STATE_DEFAULT);
  44. lv_label_set_text(ui->SettingPage_lab_wifi_status, get_wifi_status() == 1 ? "已连接" : "未连接");
  45. if(get_wifi_status())
  46. lv_obj_add_flag(ui->SettingPage_btn_1, LV_OBJ_FLAG_HIDDEN);
  47. // 填充“关于”页面信息
  48. esp_app_desc_t * desc = esp_app_get_description();
  49. lv_label_set_text(ui->SettingPage_lab_version, desc->version);
  50. char device_serial[12];
  51. get_device_serial(device_serial);
  52. lv_label_set_text(ui->SettingPage_lab_serial, device_serial);
  53. lv_qrcode_update(ui->SettingPage_qr_device_code, device_serial, 12);
  54. }