New ML support - secondary language name, language selection

This commit is contained in:
Robert Pelnar 2018-05-28 17:14:55 +02:00
parent 8f87d75637
commit baa66a0887
4 changed files with 26 additions and 11 deletions

View file

@ -1271,11 +1271,13 @@ void setup()
// 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_select(1);
lang_selected = eeprom_read_byte((uint8_t*)EEPROM_LANG);
if (lang_selected >= LANG_NUM)
{
lcd_mylang();
}
lang_select(lang_selected);
puts_P(_n("\nNew ML support"));
printf_P(_n(" lang_selected = %d\n"), lang_selected);
printf_P(_n(" &_SEC_LANG = 0x%04x\n"), &_SEC_LANG);

View file

@ -75,3 +75,11 @@ const char* lang_select(unsigned char lang)
return (const char*)((char*)lang_table + ui); //return calculated pointer
#endif //(LANG_MODE == 0)
}
const char* lang_get_name(unsigned char lang)
{
if (lang == 0) return MSG_LANGUAGE_NAME + 2;
return lang_get_sec_lang_str(MSG_LANGUAGE_NAME);
}
const char MSG_LANGUAGE_NAME[] PROGMEM_I1 = ISTR("English"); ////c=0 r=0

View file

@ -44,15 +44,16 @@
// Language indices into their particular symbol tables.
#define LANG_ID_EN 0
#define LANG_ID_CZ 1
#define LANG_ID_PRI 0
#define LANG_ID_SEC 1
// Language is not defined and it shall be selected from the menu.
#define LANG_ID_FORCE_SELECTION 254
// Language is not defined on a virgin RAMBo board.
#define LANG_ID_UNDEFINED 255
// Default language ID, if no language is selected.
#define LANG_ID_DEFAULT LANG_ID_CZ
#define LANG_ID_DEFAULT LANG_ID_PRI
// Number of languages available in the language table.
#define LANG_NUM 2
@ -72,6 +73,7 @@ extern const char _SEC_LANG[LANG_SIZE_RESERVED];
extern const char* lang_get_translation(const char* s);
extern const char* lang_get_sec_lang_str(const char* s);
extern const char* lang_select(unsigned char lang);
extern const char* lang_get_name(unsigned char lang);
#if defined(__cplusplus)
}
@ -79,9 +81,12 @@ extern const char* lang_select(unsigned char lang);
#define CAT2(_s1, _s2) _s1
#define CAT4(_s1, _s2, _s3, _s4) _s1
#define MSG_LANGUAGE_NAME_EXPLICIT(i) ((i==0)?PSTR("ENG"):PSTR("CZE"))
#define MSG_LANGUAGE_NAME_EXPLICIT(i) lang_get_name(i)
extern const char MSG_LANGUAGE_NAME[];
#include "messages.h"
#endif //__LANGUAGE_H

View file

@ -28,7 +28,7 @@ LANG=$1
#if [ -z "$LANG" ]; then LANG='cz'; fi
#
# Params:
IGNORE_MISSING_TEXT=0
IGNORE_MISSING_TEXT=1
function finish
{