New ML support - language select menu
+cond. translation for W25X20CL
This commit is contained in:
parent
bd1e410228
commit
59e65b7f47
2 changed files with 25 additions and 6 deletions
|
@ -57,6 +57,7 @@ uint8_t lang_select(uint8_t lang)
|
||||||
lang_selected = 0;
|
lang_selected = 0;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
#ifdef W25X20CL
|
||||||
if (lang == LANG_ID_SEC) //current secondary language
|
if (lang == LANG_ID_SEC) //current secondary language
|
||||||
{
|
{
|
||||||
uint16_t ui = ((((uint16_t)&_SEC_LANG) + 0x00ff) & 0xff00); //table pointer
|
uint16_t ui = ((((uint16_t)&_SEC_LANG) + 0x00ff) & 0xff00); //table pointer
|
||||||
|
@ -65,6 +66,8 @@ uint8_t lang_select(uint8_t lang)
|
||||||
lang_selected = 1; // set language id
|
lang_selected = 1; // set language id
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
#else //W25X20CL
|
||||||
|
#endif //W25X20CL
|
||||||
/*
|
/*
|
||||||
uint16_t ui = (uint16_t)&_SEC_LANG; //pointer to _SEC_LANG reserved space
|
uint16_t ui = (uint16_t)&_SEC_LANG; //pointer to _SEC_LANG reserved space
|
||||||
ui += 0x00ff; //add 1 page
|
ui += 0x00ff; //add 1 page
|
||||||
|
@ -77,8 +80,8 @@ uint8_t lang_select(uint8_t lang)
|
||||||
|
|
||||||
uint8_t lang_get_count()
|
uint8_t lang_get_count()
|
||||||
{
|
{
|
||||||
//#ifdef W25X20CL
|
#ifdef W25X20CL
|
||||||
uint8_t count = 1; //count = 1+n (primary + all in xflash)
|
uint8_t count = 2; //count = 1+n (primary + secondary + all in xflash)
|
||||||
uint32_t addr = 0x00000; //start of xflash
|
uint32_t addr = 0x00000; //start of xflash
|
||||||
lang_table_header_t header; //table header structure
|
lang_table_header_t header; //table header structure
|
||||||
while (1)
|
while (1)
|
||||||
|
@ -89,10 +92,13 @@ uint8_t lang_get_count()
|
||||||
count++; //inc counter
|
count++; //inc counter
|
||||||
}
|
}
|
||||||
return count;
|
return count;
|
||||||
|
#else //W25X20CL
|
||||||
|
#endif //W25X20CL
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t lang_get_code(uint8_t lang)
|
uint16_t lang_get_code(uint8_t lang)
|
||||||
{
|
{
|
||||||
|
#ifdef W25X20CL
|
||||||
if (lang == LANG_ID_PRI) return LANG_CODE_EN; //primary lang = EN
|
if (lang == LANG_ID_PRI) return LANG_CODE_EN; //primary lang = EN
|
||||||
if (lang == LANG_ID_SEC)
|
if (lang == LANG_ID_SEC)
|
||||||
{
|
{
|
||||||
|
@ -110,6 +116,8 @@ uint16_t lang_get_code(uint8_t lang)
|
||||||
if (--lang == 0) return header.code;
|
if (--lang == 0) return header.code;
|
||||||
addr += header.size; //calc address of next table
|
addr += header.size; //calc address of next table
|
||||||
}
|
}
|
||||||
|
#else //W25X20CL
|
||||||
|
#endif //W25X20CL
|
||||||
|
|
||||||
// if (lang == LANG_ID_SEC)
|
// if (lang == LANG_ID_SEC)
|
||||||
// {
|
// {
|
||||||
|
|
|
@ -3769,8 +3769,9 @@ static void lcd_language_menu()
|
||||||
else if (langsel == LANGSEL_ACTIVE)
|
else if (langsel == LANGSEL_ACTIVE)
|
||||||
MENU_ITEM(back, _T(MSG_WATCH), 0);
|
MENU_ITEM(back, _T(MSG_WATCH), 0);
|
||||||
MENU_ITEM(setlang, lang_get_name_by_code(lang_get_code(0)), 0);
|
MENU_ITEM(setlang, lang_get_name_by_code(lang_get_code(0)), 0);
|
||||||
for (int i = 1; i < lang_get_count(); i++)
|
// MENU_ITEM(setlang, lang_get_name_by_code(lang_get_code(1)), 1);
|
||||||
MENU_ITEM(setlang, lang_get_name_by_code(lang_get_code(i+1)), i);
|
for (int i = 2; i < lang_get_count(); i++)
|
||||||
|
MENU_ITEM(setlang, lang_get_name_by_code(lang_get_code(i)), i);
|
||||||
END_MENU();
|
END_MENU();
|
||||||
}
|
}
|
||||||
#endif //(LANG_MODE != 0)
|
#endif //(LANG_MODE != 0)
|
||||||
|
@ -7349,9 +7350,19 @@ static void menu_action_submenu(menuFunc_t data) {
|
||||||
static void menu_action_gcode(const char* pgcode) {
|
static void menu_action_gcode(const char* pgcode) {
|
||||||
enquecommand_P(pgcode);
|
enquecommand_P(pgcode);
|
||||||
}
|
}
|
||||||
static void menu_action_setlang(unsigned char lang) {
|
|
||||||
|
static void menu_action_setlang(unsigned char lang)
|
||||||
|
{
|
||||||
|
if (lang <= LANG_ID_SEC)
|
||||||
|
{
|
||||||
|
lcd_set_lang(lang);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
uint16_t code = lang_get_code(lang);
|
||||||
|
if (code == lang_get_code(1)) lcd_set_lang(1);
|
||||||
lcd_set_lang(lang);
|
lcd_set_lang(lang);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void menu_action_function(menuFunc_t data) {
|
static void menu_action_function(menuFunc_t data) {
|
||||||
(*data)();
|
(*data)();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue