diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index b06e7bfd..8b04d56f 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -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 diff --git a/Firmware/language.c b/Firmware/language.c index 85d5510a..3c068b14 100644 --- a/Firmware/language.c +++ b/Firmware/language.c @@ -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() diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 76a5efc6..1293b6a7 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -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); }