优化回退

This commit is contained in:
冯佳
2025-12-22 16:51:27 +08:00
parent 8bddc34c88
commit 03ee79d03b
25 changed files with 2284 additions and 2056 deletions

View File

@ -1,83 +0,0 @@
# This is the CMakeCache file.
# For build in directory: e:/Jfen_work/local_git_code/menu/examples/build
# It was generated by CMake: C:/Users/ZHIZHANKEJI/AppData/Local/Programs/Python/Python311/Lib/site-packages/cmake/data/bin/cmake.exe
# You can edit this file to change values found and used by cmake.
# If you do not want to change any of the values, simply exit the editor.
# If you do want to change a value, simply edit, save, and exit the editor.
# The syntax for the file is as follows:
# KEY:TYPE=VALUE
# KEY is the name of a variable in the cache.
# TYPE is a hint to GUIs for the type of VALUE, DO NOT EDIT TYPE!.
# VALUE is the current value for the KEY.
########################
# EXTERNAL cache entries
########################
//Value Computed by CMake.
CMAKE_FIND_PACKAGE_REDIRECTS_DIR:STATIC=E:/Jfen_work/local_git_code/menu/examples/build/CMakeFiles/pkgRedirects
//Program used to build from makefiles.
CMAKE_MAKE_PROGRAM:STRING=nmake
//Value Computed by CMake
CMAKE_PROJECT_DESCRIPTION:STATIC=
//Value Computed by CMake
CMAKE_PROJECT_HOMEPAGE_URL:STATIC=
//Value Computed by CMake
CMAKE_PROJECT_NAME:STATIC=Project
//Value Computed by CMake
Project_BINARY_DIR:STATIC=E:/Jfen_work/local_git_code/menu/examples/build
//Value Computed by CMake
Project_IS_TOP_LEVEL:STATIC=ON
//Value Computed by CMake
Project_SOURCE_DIR:STATIC=E:/Jfen_work/local_git_code/menu/examples
########################
# INTERNAL cache entries
########################
//This is the directory where this CMakeCache.txt was created
CMAKE_CACHEFILE_DIR:INTERNAL=e:/Jfen_work/local_git_code/menu/examples/build
//Major version of cmake used to create the current loaded cache
CMAKE_CACHE_MAJOR_VERSION:INTERNAL=3
//Minor version of cmake used to create the current loaded cache
CMAKE_CACHE_MINOR_VERSION:INTERNAL=31
//Patch version of cmake used to create the current loaded cache
CMAKE_CACHE_PATCH_VERSION:INTERNAL=2
//Path to CMake executable.
CMAKE_COMMAND:INTERNAL=C:/Users/ZHIZHANKEJI/AppData/Local/Programs/Python/Python311/Lib/site-packages/cmake/data/bin/cmake.exe
//Path to cpack program executable.
CMAKE_CPACK_COMMAND:INTERNAL=C:/Users/ZHIZHANKEJI/AppData/Local/Programs/Python/Python311/Lib/site-packages/cmake/data/bin/cpack.exe
//Path to ctest program executable.
CMAKE_CTEST_COMMAND:INTERNAL=C:/Users/ZHIZHANKEJI/AppData/Local/Programs/Python/Python311/Lib/site-packages/cmake/data/bin/ctest.exe
//Path to cache edit program executable.
CMAKE_EDIT_COMMAND:INTERNAL=C:/Users/ZHIZHANKEJI/AppData/Local/Programs/Python/Python311/Lib/site-packages/cmake/data/bin/cmake-gui.exe
//Name of external makefile project generator.
CMAKE_EXTRA_GENERATOR:INTERNAL=
//Name of generator.
CMAKE_GENERATOR:INTERNAL=NMake Makefiles
//Generator instance identifier.
CMAKE_GENERATOR_INSTANCE:INTERNAL=
//Name of generator platform.
CMAKE_GENERATOR_PLATFORM:INTERNAL=
//Name of generator toolset.
CMAKE_GENERATOR_TOOLSET:INTERNAL=
//Source directory with the top level CMakeLists.txt file for this
// project
CMAKE_HOME_DIRECTORY:INTERNAL=E:/Jfen_work/local_git_code/menu/examples
//ADVANCED property for variable: CMAKE_MAKE_PROGRAM
CMAKE_MAKE_PROGRAM-ADVANCED:INTERNAL=1
//number of local generators
CMAKE_NUMBER_OF_MAKEFILES:INTERNAL=1
//Platform information initialized
CMAKE_PLATFORM_INFO_INITIALIZED:INTERNAL=1
//Path to CMake installation.
CMAKE_ROOT:INTERNAL=C:/Users/ZHIZHANKEJI/AppData/Local/Programs/Python/Python311/Lib/site-packages/cmake/data/share/cmake-3.31

View File

@ -1,15 +0,0 @@
set(CMAKE_HOST_SYSTEM "Windows-10.0.26200")
set(CMAKE_HOST_SYSTEM_NAME "Windows")
set(CMAKE_HOST_SYSTEM_VERSION "10.0.26200")
set(CMAKE_HOST_SYSTEM_PROCESSOR "AMD64")
set(CMAKE_SYSTEM "Windows-10.0.26200")
set(CMAKE_SYSTEM_NAME "Windows")
set(CMAKE_SYSTEM_VERSION "10.0.26200")
set(CMAKE_SYSTEM_PROCESSOR "AMD64")
set(CMAKE_CROSSCOMPILING "FALSE")
set(CMAKE_SYSTEM_LOADED 1)

View File

@ -1,11 +0,0 @@
---
events:
-
kind: "message-v1"
backtrace:
- "C:/Users/ZHIZHANKEJI/AppData/Local/Programs/Python/Python311/Lib/site-packages/cmake/data/share/cmake-3.31/Modules/CMakeDetermineSystem.cmake:205 (message)"
- "CMakeLists.txt"
message: |
The system is: Windows - 10.0.26200 - AMD64
...

View File

@ -1 +0,0 @@
# This file is generated by cmake for dependency checking of the CMakeCache.txt file

View File

@ -1,13 +0,0 @@
#ifndef HMI_CAMERA_H
#define HMI_CAMERA_H
#include "hmi_common.h"
extern const MenuImage_t sgc_CameraImage;
void Hmi_CameraEnter(const MenuItemInfo_t *pItemInfo);
void Hmi_CameraExit(const MenuItemInfo_t *pItemInfo);
void Hmi_CameraLoad(const MenuItemInfo_t *pItemInfo);
void Hmi_CameraTask(const MenuItemInfo_t *pItemInfo);
#endif

View File

@ -1,20 +0,0 @@
#ifndef HMI_COMMON_H
#define HMI_COMMON_H
#include "menu.h"
/* 自定义图标数据 */
typedef struct
{
const char *pImageFrame;
const char *pImage;
} MenuImage_t;
// 清除屏幕
#define CLEAR() printf("\033[2J")
// 定位光标
#define MOVETO(x,y) printf("\033[%d;%dH", (x), (y))
void Hmi_OnCommonFunction(const MenuItemInfo_t *pItemInfo);
#endif

View File

@ -1,12 +0,0 @@
#ifndef HMI_MORE_SET_H
#define HMI_MORE_SET_H
#include "hmi_common.h"
void Hmi_MoreSetEnter(const MenuItemInfo_t *pItemInfo);
void Hmi_MoreSetExit(const MenuItemInfo_t *pItemInfo);
void Hmi_MoreSetLoad(const MenuItemInfo_t *pItemInfo);
void Hmi_MoreSetTask(const MenuItemInfo_t *pItemInfo);
#endif

View File

@ -1,14 +0,0 @@
#ifndef HMI_MUSIC_H
#define HMI_MUSIC_H
#include "hmi_common.h"
extern const MenuImage_t sgc_MusicImage;
void Hmi_MusicEnter(const MenuItemInfo_t *pItemInfo);
void Hmi_MusicExit(const MenuItemInfo_t *pItemInfo);
void Hmi_MusicLoad(const MenuItemInfo_t *pItemInfo);
void Hmi_MusicTask(const MenuItemInfo_t *pItemInfo);
#endif

View File

@ -1,13 +0,0 @@
#ifndef HMI_SET_H
#define HMI_SET_H
#include "hmi_common.h"
extern const MenuImage_t sgc_SettingImage;
void Hmi_SetEnter(const MenuItemInfo_t *pItemInfo);
void Hmi_SetExit(const MenuItemInfo_t *pItemInfo);
void Hmi_SetLoad(const MenuItemInfo_t *pItemInfo);
void Hmi_SetTask(const MenuItemInfo_t *pItemInfo);
#endif

View File

@ -1,12 +0,0 @@
#ifndef HMI_VIDEO_H
#define HMI_VIDEO_H
#include "hmi_common.h"
extern const MenuImage_t sgc_VideoImage;
void Hmi_VideoLoad(const MenuItemInfo_t *pItemInfo);
void Hmi_VideoExit(const MenuItemInfo_t *pItemInfo);
void Hmi_VideoTask(const MenuItemInfo_t *pItemInfo);
#endif

View File

@ -1,9 +0,0 @@
#ifndef MAIN_HMI_H
#define MAIN_HMI_H
#include "hmi_common.h"
void Hmi_LoadMainHmi(const MenuItemInfo_t *pItemInfo);
void Hmi_MainTask(const MenuItemInfo_t *pItemInfo);
#endif

View File

@ -1,103 +0,0 @@
#include "hmi_camera.h"
#include "menu.h"
#include "language.h"
#include <stdio.h>
#include <string.h>
#ifdef _WIN32
#include <windows.h>
#else
#include <unistd.h>
#endif
const MenuImage_t sgc_CameraImage = {
"**********",
"&"
};
MenuList_t sg_CameraMenuTable[] =
{
MENU_ITEM_BIND("TEXT_PHOTO", NULL, NULL, NULL, Hmi_OnCommonFunction, NULL),
MENU_ITEM_BIND(TEXT_PHOTOGRAPHY, NULL, NULL, NULL, Hmi_OnCommonFunction, NULL),
};
static void ShowCameraMenu(MenuShow_t *ptShowInfo)
{
uint8_t showNum = 3;
menusize_t tmpselect;
Menu_LimitShowListNum(ptShowInfo, &showNum);
printf("\e[0;30;46m ------------- %s ------------- \e[0m\n", get_text(ptShowInfo->uMenuDesc.textId));
for (int i = 0; i < showNum; i++)
{
tmpselect = i + ptShowInfo->showBaseItem;
if (tmpselect == ptShowInfo->selectItem)
{
printf("\e[0;30;47m %d. %-34s\e[0m\n", tmpselect + 1, get_text(ptShowInfo->uItemsListDesc[tmpselect].textId));
}
else
{
printf("\e[7;30;47m %d. %-34s\e[0m\n", tmpselect + 1, get_text(ptShowInfo->uItemsListDesc[tmpselect].textId));
}
}
}
void Hmi_CameraEnter(const MenuItemInfo_t *pItemInfo)
{
Menu_Bind(sg_CameraMenuTable, MENU_GET_NUM(sg_CameraMenuTable), ShowCameraMenu);
}
void Hmi_CameraLoad(const MenuItemInfo_t *pItemInfo)
{
CLEAR();
MOVETO(0, 0);
printf("---%s-----\n", get_text(TEXT_LOADING));
}
void Hmi_CameraExit(const MenuItemInfo_t *pItemInfo)
{
printf("--------------------------\n");
printf(" %s%s...\n", get_text(TEXT_VIDEO), get_text(TEXT_STOPPING_PLAYBACK));
printf("--------------------------\n");
#ifdef _WIN32
Sleep(1000);
#else
sleep(1);
#endif
}
void Hmi_CameraTask(const MenuItemInfo_t *pItemInfo)
{
int cmd;
printf("%s(0-%s; 1-%s%s; 2-%s; 3-%s; 4-%s): ",
get_text(TEXT_SELECT_OPTION), get_text(TEXT_RETURN), get_text(TEXT_RETURN), get_text(TEXT_MAIN_MENU),
get_text(TEXT_ENTER), get_text(TEXT_NEXT), get_text(TEXT_PREVIOUS));
scanf(" %d", &cmd);
switch (cmd)
{
case 0:
Menu_Exit(true);
break;
case 1:
Menu_Reset();
break;
case 2:
Menu_Enter();
break;
case 3:
Menu_SelectNext(true);
break;
case 4:
Menu_SelectPrevious(true);
break;
default:
break;
}
}

View File

@ -1,28 +0,0 @@
#include "hmi_common.h"
#include "language.h"
#include <stdio.h>
#include <string.h>
#ifdef _WIN32
#include <windows.h>
#else
#include <unistd.h>
#endif
void Hmi_OnCommonFunction(const MenuItemInfo_t *pItemInfo)
{
int cmd;
printf("--------------------------\n");
printf(" %s%s\n", get_text(pItemInfo->uMenuDesc.textId), get_text(TEXT_FUNCTION_TEST));
printf("--------------------------\n");
printf("%s(0-%s): ",
get_text(TEXT_SELECT_OPTION), get_text(TEXT_EXIT));
scanf(" %d", &cmd); // 空格作用是忽略上次的回车
if (cmd == 0)
{
Menu_Exit(false);
}
}

View File

@ -1,110 +0,0 @@
#include "hmi_more_set.h"
#include "menu.h"
#include "language.h"
#include <stdio.h>
#include <string.h>
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
MenuList_t sg_MoreSetMenuTable[] =
{
MENU_ITEM_BIND(TEXT_UPGRADE, NULL, NULL, NULL, Hmi_OnCommonFunction, NULL),
MENU_ITEM_BIND(TEXT_ABOUT, NULL, NULL, NULL, Hmi_OnCommonFunction, NULL),
};
static void ShowMoreSetMenu(MenuShow_t *ptShowInfo)
{
uint8_t showNum = 3;
uint8_t showsubNum = 3;
menusize_t tmpselect;
MenuShow_t tParentMenuShowInfo;
if (Menu_QueryParentMenu(&tParentMenuShowInfo, 1) != 0)
{
return;
}
Menu_LimitShowListNum(&tParentMenuShowInfo, &showNum);
Menu_LimitShowListNum(ptShowInfo, &showsubNum);
printf("\e[0;30;46m ------------- %s ------------- \e[0m\n", get_text(tParentMenuShowInfo.uMenuDesc.textId));
for (int i = 0; i < showNum; i++)
{
tmpselect = i + tParentMenuShowInfo.showBaseItem;
if (tmpselect == tParentMenuShowInfo.selectItem)
{
printf("\e[0;30;47m %d. %-16s\e[0m |", tmpselect + 1, get_text(tParentMenuShowInfo.uItemsListDesc[tmpselect].textId));
}
else
{
printf("\e[7;30;47m %d. %-16s\e[0m |", tmpselect + 1, get_text(tParentMenuShowInfo.uItemsListDesc[tmpselect].textId));
}
if (i < showsubNum)
{
tmpselect = i + ptShowInfo->showBaseItem;
if (tmpselect == ptShowInfo->selectItem)
{
printf(" \e[0;30;47m %-14s\e[0m", get_text(ptShowInfo->uItemsListDesc[tmpselect].textId));
}
else
{
printf(" \e[7;30;47m %-14s\e[0m", get_text(ptShowInfo->uItemsListDesc[tmpselect].textId));
}
}
printf("\n");
}
}
void Hmi_MoreSetEnter(const MenuItemInfo_t *pItemInfo)
{
Menu_Bind(sg_MoreSetMenuTable, MENU_GET_NUM(sg_MoreSetMenuTable), ShowMoreSetMenu);
}
void Hmi_MoreSetLoad(const MenuItemInfo_t *pItemInfo)
{
}
void Hmi_MoreSetExit(const MenuItemInfo_t *pItemInfo)
{
}
void Hmi_MoreSetTask(const MenuItemInfo_t *pItemInfo)
{
int cmd;
printf("%s(0-%s; 1-%s%s; 2-%s; 3-%s; 4-%s): ",
get_text(TEXT_SELECT_OPTION), get_text(TEXT_RETURN), get_text(TEXT_RETURN), get_text(TEXT_MAIN_MENU),
get_text(TEXT_ENTER), get_text(TEXT_NEXT), get_text(TEXT_PREVIOUS));
scanf(" %d", &cmd);
switch (cmd)
{
case 0:
Menu_Exit(false);
break;
case 1:
Menu_Reset();
break;
case 2:
Menu_Enter();
break;
case 3:
Menu_SelectNext(true);
break;
case 4:
Menu_SelectPrevious(true);
break;
default:
break;
}
}

View File

@ -1,58 +0,0 @@
#include "hmi_music.h"
#include "menu.h"
#include "language.h"
#include <stdio.h>
#include <string.h>
#ifdef _WIN32
#include <windows.h>
#else
#include <unistd.h>
#endif
static bool sg_isInit = false;
const MenuImage_t sgc_MusicImage = {
"mmmmmmmmmm",
"@"
};
void Hmi_MusicEnter(const MenuItemInfo_t *pItemInfo)
{
}
void Hmi_MusicExit(const MenuItemInfo_t *pItemInfo)
{
}
void Hmi_MusicLoad(const MenuItemInfo_t *pItemInfo)
{
sg_isInit = true;
}
void Hmi_MusicTask(const MenuItemInfo_t *pItemInfo)
{
int cmd = 0;
if (sg_isInit)
{
sg_isInit = false;
printf("--------------------------\n");
printf(" %s%s\n", get_text(pItemInfo->uMenuDesc.textId), get_text(TEXT_FUNCTION_TEST));
printf("--------------------------\n");
#ifdef _WIN32
Sleep(1000);
#else
sleep(1);
#endif
}
printf("%s(0-%s): ",
get_text(TEXT_SELECT_OPTION), get_text(TEXT_EXIT));
scanf(" %d", &cmd);
if (cmd == 0)
{
Menu_Exit(false);
}
}

View File

@ -1,176 +0,0 @@
#include "hmi_set.h"
#include "hmi_more_set.h"
#include "menu.h"
#include "language.h"
#include <stdio.h>
#include <string.h>
const MenuImage_t sgc_SettingImage = {
"$$$$$$$$$$",
"%"
};
static void OnLanguageFunction(const MenuItemInfo_t *pItemInfo);
static void OnBluetoothFunction(const MenuItemInfo_t *pItemInfo);
static void OnBatteryFunction(const MenuItemInfo_t *pItemInfo);
static void OnStorageFunction(const MenuItemInfo_t *pItemInfo);
MenuList_t sg_SetMenuTable[] =
{
MENU_ITEM_BIND(TEXT_LANGUAGE, NULL, NULL, NULL, OnLanguageFunction, NULL),
MENU_ITEM_BIND(TEXT_BLUETOOTH, NULL, NULL, NULL, OnBluetoothFunction, NULL),
MENU_ITEM_BIND(TEXT_BATTERY, NULL, NULL, NULL, OnBatteryFunction, NULL),
MENU_ITEM_BIND(TEXT_STORE, NULL, NULL, NULL, OnStorageFunction, NULL),
MENU_ITEM_BIND(TEXT_MORE, Hmi_MoreSetEnter, Hmi_MoreSetExit, Hmi_MoreSetLoad, Hmi_MoreSetTask, NULL),
};
static void ShowSetMenu(MenuShow_t *ptShowInfo)
{
uint8_t showNum = 3;
menusize_t tmpselect;
Menu_LimitShowListNum(ptShowInfo, &showNum);
printf("\e[0;30;46m ------------- %s ------------- \e[0m\n", get_text(ptShowInfo->uMenuDesc.textId));
for (int i = 0; i < showNum; i++)
{
tmpselect = i + ptShowInfo->showBaseItem;
if (tmpselect == ptShowInfo->selectItem)
{
printf("\e[0;30;47m %d. %-16s\e[0m |\n", tmpselect + 1, get_text(ptShowInfo->uItemsListDesc[tmpselect].textId));
}
else
{
printf("\e[7;30;47m %d. %-16s\e[0m |\n", tmpselect + 1, get_text(ptShowInfo->uItemsListDesc[tmpselect].textId));
}
}
}
void Hmi_SetEnter(const MenuItemInfo_t *pItemInfo)
{
Menu_Bind(sg_SetMenuTable, MENU_GET_NUM(sg_SetMenuTable), ShowSetMenu);
}
void Hmi_SetLoad(const MenuItemInfo_t *pItemInfo)
{
}
void Hmi_SetExit(const MenuItemInfo_t *pItemInfo)
{
}
void Hmi_SetTask(const MenuItemInfo_t *pItemInfo)
{
int cmd;
printf("%s(0-%s; 1-%s; 2-%s; 3-%s; 4-%s): ",
get_text(TEXT_SELECT_OPTION), get_text(TEXT_RETURN), get_text(TEXT_RETURN_MAIN_MENU),
get_text(TEXT_ENTER), get_text(TEXT_NEXT), get_text(TEXT_PREVIOUS));
scanf(" %d", &cmd);
switch (cmd)
{
case 0:
Menu_Exit(false);
break;
case 1:
Menu_Reset();
break;
case 2:
Menu_Enter();
break;
case 3:
Menu_SelectNext(true);
break;
case 4:
Menu_SelectPrevious(true);
break;
default:
break;
}
}
static void OnLanguageFunction(const MenuItemInfo_t *pItemInfo)
{
int cmd;
printf("--------------------------\n");
printf(" %s%s\n", get_text(TEXT_LANGUAGE), get_text(TEXT_FUNCTION_TEST));
printf("--------------------------\n");
printf("%s(0-中文; 1-English): ",
get_text(TEXT_SELECT_OPTION));
scanf(" %d", &cmd);
if (cmd == 0)
{
set_language(SYSTEM_LANGUAGE_CHINESE);
}
else
{
set_language(SYSTEM_LANGUAGE_ENGLISH);
}
Menu_Exit(false);
}
static void OnBluetoothFunction(const MenuItemInfo_t *pItemInfo)
{
int cmd;
printf("--------------------------\n");
printf(" %s%s\n", get_text(TEXT_BLUETOOTH), get_text(TEXT_FUNCTION_TEST));
printf("--------------------------\n");
printf("%s(0-%s): ",
get_text(TEXT_SELECT_OPTION), get_text(TEXT_EXIT));
scanf(" %d", &cmd);
if (cmd == 0)
{
Menu_Exit(false);
}
}
static void OnBatteryFunction(const MenuItemInfo_t *pItemInfo)
{
int cmd;
printf("--------------------------\n");
printf(" %s%s\n", get_text(TEXT_BATTERY), get_text(TEXT_FUNCTION_TEST));
printf("--------------------------\n");
printf("%s(0-%s): ",
get_text(TEXT_SELECT_OPTION), get_text(TEXT_EXIT));
scanf(" %d", &cmd);
if (cmd == 0)
{
Menu_Exit(false);
}
}
static void OnStorageFunction(const MenuItemInfo_t *pItemInfo)
{
int cmd;
printf("--------------------------\n");
printf(" %s%s\n", get_text(TEXT_STORE), get_text(TEXT_FUNCTION_TEST));
printf("--------------------------\n");
printf("%s(0-%s): ",
get_text(TEXT_SELECT_OPTION), get_text(TEXT_EXIT));
scanf(" %d", &cmd);
if (cmd == 0)
{
Menu_Exit(false);
}
}

View File

@ -1,67 +0,0 @@
#include "hmi_video.h"
#include "menu.h"
#include "language.h"
#include <stdio.h>
#include <string.h>
#ifdef _WIN32
#include <windows.h>
#else
#include <unistd.h>
#endif
const MenuImage_t sgc_VideoImage = {
"vvvvvvvvvv",
"#"
};
void Hmi_VideoLoad(const MenuItemInfo_t *pItemInfo)
{
printf("--------------------------\n");
printf(" %s %s...\n", get_text(pItemInfo->uMenuDesc.textId), get_text(TEXT_LOADING));
printf("--------------------------\n");
#ifdef _WIN32
Sleep(1000);
#else
sleep(1);
#endif
CLEAR();
MOVETO(0, 0);
}
void Hmi_VideoExit(const MenuItemInfo_t *pItemInfo)
{
CLEAR();
MOVETO(0, 0);
printf("--------------------------\n");
printf(" %s %s...\n", get_text(pItemInfo->uMenuDesc.textId), get_text(TEXT_EXIT));
printf("--------------------------\n");
#ifdef _WIN32
Sleep(1000);
#else
sleep(1);
#endif
}
void Hmi_VideoTask(const MenuItemInfo_t *pItemInfo)
{
int cmd;
printf("--------------------------\n");
printf(" %s%s\n", get_text(pItemInfo->uMenuDesc.textId), get_text(TEXT_FUNCTION_TEST));
printf("--------------------------\n");
printf("%s(0-%s): ",
get_text(TEXT_SELECT_OPTION), get_text(TEXT_EXIT));
scanf(" %d", &cmd);
if (cmd == 0)
{
Menu_Exit(false);
}
}

View File

@ -1,140 +0,0 @@
#include "mainhmi.h"
#include "hmi_camera.h"
#include "hmi_music.h"
#include "hmi_set.h"
#include "hmi_video.h"
#include "hmi_common.h"
#include "menu.h"
#include "language.h"
#include <stdio.h>
#include <string.h>
MenuList_t sg_MainMenuTable[] =
{
MENU_ITEM_BIND(TEXT_MUSIC, Hmi_MusicEnter, Hmi_MusicExit, Hmi_MusicLoad, Hmi_MusicTask, (MenuImage_t *)&sgc_MusicImage),
MENU_ITEM_BIND(TEXT_VIDEO, NULL, Hmi_VideoExit, Hmi_VideoLoad, Hmi_VideoTask, (MenuImage_t *)&sgc_VideoImage),
MENU_ITEM_BIND(TEXT_CAMERA, Hmi_CameraEnter, Hmi_CameraExit, Hmi_CameraLoad, Hmi_CameraTask, (MenuImage_t *)&sgc_CameraImage),
MENU_ITEM_BIND(TEXT_SETTING, Hmi_SetEnter, Hmi_SetExit, Hmi_SetLoad, Hmi_SetTask, (MenuImage_t *)&sgc_SettingImage),
};
static void ShowMainMenu(MenuShow_t *ptShowInfo)
{
uint8_t showNum = 3;
MenuImage_t *pMenuImage;
menusize_t tmpselect;
Menu_LimitShowListNum(ptShowInfo, &showNum);
printf("\e[0;30;47m ------------- %s ------------- \e[0m\n", get_text(ptShowInfo->uMenuDesc.textId));
for (int i = 0; i < showNum; i++)
{
tmpselect = i + ptShowInfo->showBaseItem;
pMenuImage = (MenuImage_t *)ptShowInfo->pItemsListExtendData[tmpselect];
if (tmpselect == ptShowInfo->selectItem)
{
printf("\e[0;30;47m %-10s \e[0m", pMenuImage->pImageFrame);
}
else
{
printf("\e[7;30;47m %-10s \e[0m", pMenuImage->pImageFrame);
}
}
printf("\n");
for (int i = 0; i < showNum; i++)
{
tmpselect = i + ptShowInfo->showBaseItem;
pMenuImage = (MenuImage_t *)ptShowInfo->pItemsListExtendData[tmpselect];
if (tmpselect == ptShowInfo->selectItem)
{
printf("\e[0;30;47m %-s%-8s%-s \e[0m", pMenuImage->pImage, get_text(ptShowInfo->uItemsListDesc[tmpselect].textId), pMenuImage->pImage);
}
else
{
printf("\e[7;30;47m %-s%-8s%-s \e[0m", pMenuImage->pImage, get_text(ptShowInfo->uItemsListDesc[tmpselect].textId), pMenuImage->pImage);
}
}
printf("\n");
for (int i = 0; i < showNum; i++)
{
tmpselect = i + ptShowInfo->showBaseItem;
pMenuImage = (MenuImage_t *)ptShowInfo->pItemsListExtendData[tmpselect];
if (tmpselect == ptShowInfo->selectItem)
{
printf("\e[0;30;47m %-10s \e[0m", pMenuImage->pImageFrame);
}
else
{
printf("\e[7;30;47m %-10s \e[0m", pMenuImage->pImageFrame);
}
}
printf("\n");
}
void Hmi_LoadMainHmi(const MenuItemInfo_t *pItemInfo)
{
Menu_Bind(sg_MainMenuTable, MENU_GET_NUM(sg_MainMenuTable), ShowMainMenu);
}
void Hmi_MainTask(const MenuItemInfo_t *pItemInfo)
{
int cmd;
printf("%s(0-%s; 2-%s; 3-%s; 4-%s; 5-%s(%s); 6-%s(%s); 7-%s(%s)): ",
get_text(TEXT_SELECT_OPTION), get_text(TEXT_EXIT_MAIN_MENU),
get_text(TEXT_ENTER), get_text(TEXT_NEXT), get_text(TEXT_PREVIOUS),
get_text(TEXT_MUSIC), get_text(TEXT_SHORTCUT),
get_text(TEXT_LANGUAGE), get_text(TEXT_SHORTCUT),
get_text(TEXT_MORE_SETTING), get_text(TEXT_SHORTCUT));
scanf(" %d", &cmd);
switch (cmd)
{
case 0:
Menu_MainExit();
break;
case 1:
Menu_Reset();
break;
case 2:
Menu_Enter();
break;
case 3:
Menu_SelectNext(true);
break;
case 4:
Menu_SelectPrevious(true);
break;
case 5:
Menu_ShortcutEnter(true, 1, 0);
break;
case 6:
Menu_ShortcutEnter(true, 2, 3, 0);
break;
case 7:
Menu_ShortcutEnter(true, 2, 3, 4);
break;
default:
break;
}
}

View File

@ -1,70 +0,0 @@
#include "language.h"
static SystemLanguage_e sg_eSystemLanguage = SYSTEM_LANGUAGE_CHINESE;
const char *(sg_kSystemLanguage[TEXT_ALL])[SYSTEM_LANGUAGE_ALL] =
{
[TEXT_MENU] = {"菜单", "menu"},
[TEXT_MAIN_MENU] = {"主菜单", "main menu"},
[TEXT_SELECT_OPTION] = {"选择操作", "select option"},
[TEXT_ENTER] = {"进入", "enter"},
[TEXT_EXIT] = {"退出", "exit"},
[TEXT_RETURN] = {"返回", "return"},
[TEXT_MUSIC] = {"音乐", "music"},
[TEXT_VIDEO] = {"视频", "video"},
[TEXT_CAMERA] = {"摄像机", "camera"},
[TEXT_SETTING] = {"设置", "setting"},
[TEXT_SHORTCUT] = {"快捷", "shortcut"},
[TEXT_MORE] = {"更多", "more"},
[TEXT_LANGUAGE] = {"语言", "language"},
[TEXT_NEXT] = {"下一个", "next"},
[TEXT_PREVIOUS] = {"上一个", "previous"},
[TEXT_FUNCTION_TEST] = {"功能测试", "functional testing"},
[TEXT_TEST] = {"测试", "test"},
[TEXT_BLUETOOTH] = {"蓝牙", "bluetooth"},
[TEXT_BATTERY] = {"电池", "battery"},
[TEXT_STORE] = {"储存", "store"},
[TEXT_UPGRADE] = {"升级", "upgrade"},
[TEXT_ABOUT] = {"关于", "about"},
[TEXT_PHOTO] = {"拍照", "Photo"},
[TEXT_PHOTOGRAPHY] = {"摄影", "photography"},
[TEXT_LOADING] = {"加载中", "loading"},
[TEXT_STOPPING_PLAYBACK] = {"正在停止播放", "stopping playback"},
[TEXT_EXIT_MAIN_MENU] = {"退出主菜单", "exit main menu"},
[TEXT_RETURN_MAIN_MENU] = {"返回主菜单", "return main menu"},
[TEXT_MORE_SETTING] = {"更多设置", "more setting"},
};
void set_language(SystemLanguage_e lang)
{
if (lang >= 0 && lang < SYSTEM_LANGUAGE_ALL)
{
sg_eSystemLanguage = lang;
}
}
const char *get_text(TextId_e id)
{
static const char *pszNullString = "N/A";
if (id >= 0 && id < TEXT_ALL)
{
return sg_kSystemLanguage[id][sg_eSystemLanguage];
}
return pszNullString; // 未找到对应的文本
}
const char *get_text_by_language(SystemLanguage_e lang, TextId_e id)
{
static const char *pszNullString = "N/A";
if (id >= 0 && id < TEXT_ALL)
{
return sg_kSystemLanguage[id][lang];
}
return pszNullString; // 未找到对应的文本
}

View File

@ -1,52 +0,0 @@
#ifndef LANGUAGE_H
#define LANGUAGE_H
typedef enum
{
SYSTEM_LANGUAGE_CHINESE = 0,
SYSTEM_LANGUAGE_ENGLISH,
SYSTEM_LANGUAGE_ALL,
} SystemLanguage_e;
typedef enum
{
TEXT_MENU = 0, // 菜单
TEXT_MAIN_MENU, // 主菜单
TEXT_SELECT_OPTION, // 选择操作
TEXT_ENTER, // 进入
TEXT_EXIT, // 退出
TEXT_RETURN, // 返回
TEXT_MUSIC, // 音乐
TEXT_VIDEO, // 视频
TEXT_CAMERA, // 摄像机
TEXT_SETTING, // 设置
TEXT_SHORTCUT, // 快捷
TEXT_MORE, // 更多
TEXT_LANGUAGE, // 语言
TEXT_NEXT, // 下一个
TEXT_PREVIOUS, // 上一个
TEXT_FUNCTION_TEST, // 功能测试
TEXT_TEST, // 测试
TEXT_BLUETOOTH, // 蓝牙
TEXT_BATTERY, // 电池
TEXT_STORE, // 储存
TEXT_UPGRADE, // 升级
TEXT_ABOUT, // 关于
TEXT_PHOTO, // 拍照
TEXT_PHOTOGRAPHY, // 摄影
TEXT_LOADING, // 加载中
TEXT_STOPPING_PLAYBACK, // 正在停止播放
TEXT_EXIT_MAIN_MENU, // 退出主菜单
TEXT_RETURN_MAIN_MENU, // 返回主菜单
TEXT_MORE_SETTING, // 更多设置
TEXT_ALL,
} TextId_e;
void set_language(SystemLanguage_e lang);
const char *get_text(TextId_e id);
const char *get_text_by_language(SystemLanguage_e lang, TextId_e id);
#endif