From c85f9e72c685df6fd836deb3442edf359c3a9c01 Mon Sep 17 00:00:00 2001 From: Mk16kawai <1041324852hzq@sina.com> Date: Thu, 21 Nov 2024 16:53:12 +0800 Subject: [PATCH] rename lt9611 panels --- .../vision/port/maixcam/maix_display_mmf.hpp | 52 +++++-------------- 1 file changed, 14 insertions(+), 38 deletions(-) diff --git a/components/vision/port/maixcam/maix_display_mmf.hpp b/components/vision/port/maixcam/maix_display_mmf.hpp index 21c899da..bb261144 100644 --- a/components/vision/port/maixcam/maix_display_mmf.hpp +++ b/components/vision/port/maixcam/maix_display_mmf.hpp @@ -33,47 +33,23 @@ namespace maix::display }; inline static PanelType __g_panel_type = PanelType::UNKNOWN; - static bool __check_lt9611() - { - return fs::exists("/boot/lt9611.txt"); - } - - static bool _get_board_config_path(char *path, int path_size) - { - if (fs::exists("/boot/board")) { - snprintf(path, path_size, "/boot/board"); - return true; - } - return false; - } - __attribute__((unused)) static int _get_vo_max_size(int *width, int *height, int rotate) { int w = 0, h = 0; - char line[1024]; char panel_value[256]; + ::memset(panel_value, 0x00, std::size(panel_value)); char *panel_env = getenv("MMF_PANEL_NAME"); if (panel_env) { log::info("Found panel env MMF_PANEL_NAME=%s\r\n", panel_env); strncpy(panel_value, panel_env, sizeof(panel_value)); } else { - FILE *file = fopen("/boot/uEnv.txt", "r"); - if (file == NULL) { - perror("Error opening file"); - return 1; - } - - while (fgets(line, sizeof(line), file)) { - if (strncmp(line, "panel=", 6) == 0) { - strcpy(panel_value, line + 6); - panel_value[strcspn(panel_value, "\n")] = '\0'; - break; + for (const auto& [k, v] : sys::device_configs(false)) { + if (k == "panel") { + std::copy(v.begin(), v.end(), panel_value); } } - - fclose(file); } if (strlen(panel_value) > 0) { @@ -86,19 +62,9 @@ namespace maix::display if (!strcmp(panel_value, "st7701_hd228001c31")) { // maixcam w = 368; h = 552; - if (__check_lt9611()) { - /* for LT9611 552x368 */ - __g_panel_type = PanelType::LT9611; - std::swap(w, h); - } } else if (!strcmp(panel_value, "st7701_lct024bsi20")) { // maixcam_pro w = 480; h = 640; - if (__check_lt9611()) { - /* for LT9611 640x480 */ - __g_panel_type = PanelType::LT9611; - std::swap(w, h); - } } else if (!strcmp(panel_value, "zct2133v1")) { w = 800; h = 1280; @@ -124,6 +90,16 @@ namespace maix::display w = 720; h = 1280; __g_panel_type = PanelType::LT9611; + } else if (!strcmp(panel_value, "lt9611_640x480_60hz")) { + /* for LT9611 640x480 */ + w = 640; + h = 480; + __g_panel_type = PanelType::LT9611; + } else if (!strcmp(panel_value, "lt9611_552x368_60hz")) { + /* for LT9611 552x368 */ + w = 552; + h = 368; + __g_panel_type = PanelType::LT9611; } if(w == 0 || h == 0)