New ML support - lang select menu fix

This commit is contained in:
Robert Pelnar 2018-06-08 02:03:25 +02:00
parent 59e65b7f47
commit 37f82118c8
3 changed files with 15 additions and 5 deletions

View file

@ -1372,11 +1372,9 @@ void setup()
}
lang_select(lang_selected);
uint16_t sec_lang_code=lang_get_code(1);
uint16_t sec_lang_code = lang_get_code(1);
printf_P(_n("SEC_LANG_CODE=0x%04x (%c%c)\n"), sec_lang_code, sec_lang_code >> 8, sec_lang_code & 0xff);
#ifdef DEBUG_SEC_LANG
lang_print_sec_lang(uartout);
#endif //DEBUG_SEC_LANG

View file

@ -76,6 +76,7 @@ uint8_t lang_select(uint8_t lang)
ui = pgm_read_word(((uint16_t*)(((char*)lang_table + 16)))); //read relative offset of first string (language name)
return (const char*)((char*)lang_table + ui); //return calculated pointer
*/
return 0;
}
uint8_t lang_get_count()

View file

@ -3717,6 +3717,13 @@ static void lcd_crash_mode_set()
static void lcd_set_lang(unsigned char lang)
{
if (lang > LANG_ID_SEC)
if (!lcd_show_fullscreen_message_yes_no_and_wait_P(_i("Copy selected language from XFLASH?"), false, true))
{
lcd_return_to_status();
lcd_update_enable(true);
return;
}
lang_select(lang);
/*
lang_selected = lang;
@ -3770,7 +3777,7 @@ static void lcd_language_menu()
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(1)), 1);
for (int i = 2; i < lang_get_count(); i++)
for (int i = 2; i < lang_get_count(); i++) //skip seconday language - solved in menu_action_setlang
MENU_ITEM(setlang, lang_get_name_by_code(lang_get_code(i)), i);
END_MENU();
}
@ -7359,7 +7366,11 @@ static void menu_action_setlang(unsigned char lang)
return;
}
uint16_t code = lang_get_code(lang);
if (code == lang_get_code(1)) lcd_set_lang(1);
if (code == lang_get_code(1))
{
lcd_set_lang(1);
return;
}
lcd_set_lang(lang);
}