From f00a9ce6367317960f11c861ed4c5fa2bddfb69e Mon Sep 17 00:00:00 2001 From: Robert Pelnar Date: Wed, 23 May 2018 15:46:08 +0200 Subject: [PATCH] New ML support - language.c, language.h - code fixed, Marlin_main.cpp - debug output --- Firmware/Marlin_main.cpp | 16 ++++++++++++---- Firmware/language.c | 2 +- Firmware/language.h | 9 ++++----- 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 6893fa75..f2a9ba9d 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -1258,10 +1258,18 @@ void setup() // In the future, somewhere here would one compare the current firmware version against the firmware version stored in the EEPROM. // If they differ, an update procedure may need to be performed. At the end of this block, the current firmware version // is being written into the EEPROM, so the update procedure will be triggered only once. - lang_selected = eeprom_read_byte((uint8_t*)EEPROM_LANG); - if (lang_selected >= LANG_NUM){ - lcd_mylang(); - } + +/// lang_selected = eeprom_read_byte((uint8_t*)EEPROM_LANG); +/// if (lang_selected >= LANG_NUM){ +/// lcd_mylang(); +/// } + lang_select(0); + puts_P(_n("\nNew ML support")); + printf_P(_n(" lang_selected =%d\n"), lang_selected); + printf_P(_n(" &_SEC_LANG =%04x\n"), &_SEC_LANG); + printf_P(_n(" sizeof(_SEC_LANG) =%04x\n"), sizeof(_SEC_LANG)); + puts_P(_n("\n")); + if (eeprom_read_byte((uint8_t*)EEPROM_TEMP_CAL_ACTIVE) == 255) { eeprom_write_byte((uint8_t*)EEPROM_TEMP_CAL_ACTIVE, 0); diff --git a/Firmware/language.c b/Firmware/language.c index d992b87e..a7f38fd1 100644 --- a/Firmware/language.c +++ b/Firmware/language.c @@ -10,7 +10,7 @@ unsigned char lang_selected = 0; #if (LANG_MODE == 0) //primary language only #else //(LANG_MODE == 0) //reserved xx kbytes for secondary language table -static const char _SEC_LANG[LANG_SIZE_RESERVED] PROGMEM_I2 = "_SEC_LANG"; +const char _SEC_LANG[LANG_SIZE_RESERVED] PROGMEM_I2 = "_SEC_LANG"; #endif //(LANG_MODE == 0) //lang_table_t structure - 16byte header diff --git a/Firmware/language.h b/Firmware/language.h index add874d6..fbd3ecde 100644 --- a/Firmware/language.h +++ b/Firmware/language.h @@ -21,11 +21,6 @@ #define STRINGIFY_(n) #n #define STRINGIFY(n) STRINGIFY_(n) -#if (LANG_MODE == 0) -//#define _i PSTR -//#define _I(s) (__extension__({static const char __c[] __attribute__((section("Txt_i"))) = s; &__c[0];})) -#endif //(LANG_MODE == 0) - //section progmem0 will be used for localized translated strings #define PROGMEM_I2 __attribute__((section(".progmem0"))) //section progmem1 will be used for localized strings in english @@ -70,6 +65,10 @@ extern "C" { // Currectly active language selection. extern unsigned char lang_selected; +#if (LANG_MODE != 0) +extern const char _SEC_LANG[LANG_SIZE_RESERVED]; +#endif //(LANG_MODE == 0) + extern const char* lang_get_translation(const char* s); extern const char* lang_select(unsigned char lang);