Skip to content

Commit

Permalink
rename lt9611 panels
Browse files Browse the repository at this point in the history
  • Loading branch information
MK16kawai committed Nov 21, 2024
1 parent 91900c6 commit c85f9e7
Showing 1 changed file with 14 additions and 38 deletions.
52 changes: 14 additions & 38 deletions components/vision/port/maixcam/maix_display_mmf.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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;
Expand All @@ -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)
Expand Down

0 comments on commit c85f9e7

Please sign in to comment.