Merge pull request #867 from XPila/MK3-new_lang
Mk3 new lang - multiple languages in internal flash + menu optimalization
This commit is contained in:
commit
860a0b0858
7 changed files with 589 additions and 423 deletions
|
@ -229,13 +229,18 @@ bool IsStopped();
|
||||||
|
|
||||||
//put an ASCII command at the end of the current buffer.
|
//put an ASCII command at the end of the current buffer.
|
||||||
void enquecommand(const char *cmd, bool from_progmem = false);
|
void enquecommand(const char *cmd, bool from_progmem = false);
|
||||||
|
|
||||||
//put an ASCII command at the end of the current buffer, read from flash
|
//put an ASCII command at the end of the current buffer, read from flash
|
||||||
#define enquecommand_P(cmd) enquecommand(cmd, true)
|
#define enquecommand_P(cmd) enquecommand(cmd, true)
|
||||||
|
|
||||||
|
//put an ASCII command at the begin of the current buffer
|
||||||
void enquecommand_front(const char *cmd, bool from_progmem = false);
|
void enquecommand_front(const char *cmd, bool from_progmem = false);
|
||||||
//put an ASCII command at the end of the current buffer, read from flash
|
|
||||||
#define enquecommand_P(cmd) enquecommand(cmd, true)
|
//put an ASCII command at the begin of the current buffer, read from flash
|
||||||
#define enquecommand_front_P(cmd) enquecommand_front(cmd, true)
|
#define enquecommand_front_P(cmd) enquecommand_front(cmd, true)
|
||||||
|
|
||||||
void repeatcommand_front();
|
void repeatcommand_front();
|
||||||
|
|
||||||
// Remove all lines from the command queue.
|
// Remove all lines from the command queue.
|
||||||
void cmdqueue_reset();
|
void cmdqueue_reset();
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
//LANG - Multi-language support
|
//LANG - Multi-language support
|
||||||
//#define LANG_MODE 0 // primary language only
|
//#define LANG_MODE 0 // primary language only
|
||||||
#define LANG_MODE 1 // sec. language support
|
#define LANG_MODE 1 // sec. language support
|
||||||
#define LANG_SIZE_RESERVED 0x2400 // reserved space for secondary language (~10kb)
|
#define LANG_SIZE_RESERVED 0x2400 // reserved space for secondary language (~12kb)
|
||||||
//#define LANG_SIZE_RESERVED 0x1ef8 // reserved space for secondary language (~10kb)
|
//#define LANG_SIZE_RESERVED 0x1ef8 // reserved space for secondary language (~10kb)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -153,7 +153,6 @@ uint8_t lang_get_header(uint8_t lang, lang_table_header_t* header, uint32_t* off
|
||||||
if (--lang == 0) return 1;
|
if (--lang == 0) return 1;
|
||||||
addr += header->size; //calc address of next table
|
addr += header->size; //calc address of next table
|
||||||
}
|
}
|
||||||
return 0;
|
|
||||||
#else //W25X20CL
|
#else //W25X20CL
|
||||||
if (lang == LANG_ID_SEC)
|
if (lang == LANG_ID_SEC)
|
||||||
{
|
{
|
||||||
|
@ -163,6 +162,7 @@ uint8_t lang_get_header(uint8_t lang, lang_table_header_t* header, uint32_t* off
|
||||||
return (header->magic == LANG_MAGIC)?1:0; //return 1 if magic valid
|
return (header->magic == LANG_MAGIC)?1:0; //return 1 if magic valid
|
||||||
}
|
}
|
||||||
#endif //W25X20CL
|
#endif //W25X20CL
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t lang_get_code(uint8_t lang)
|
uint16_t lang_get_code(uint8_t lang)
|
||||||
|
@ -187,11 +187,13 @@ uint16_t lang_get_code(uint8_t lang)
|
||||||
addr += header.size; //calc address of next table
|
addr += header.size; //calc address of next table
|
||||||
}
|
}
|
||||||
#else //W25X20CL
|
#else //W25X20CL
|
||||||
if (lang == LANG_ID_SEC)
|
uint16_t table = _SEC_LANG_TABLE;
|
||||||
|
uint8_t count = 1; //count = 1 (primary)
|
||||||
|
while (pgm_read_dword((uint32_t*)table) == LANG_MAGIC) //magic valid
|
||||||
{
|
{
|
||||||
uint16_t ui = _SEC_LANG_TABLE; //table pointer
|
if (count == lang) return pgm_read_word(((uint16_t*)(table + 10))); //read language code
|
||||||
if (pgm_read_dword(((uint32_t*)(ui + 0))) == LANG_MAGIC) //magic num is OK
|
table += pgm_read_word((uint16_t*)(table + 4));
|
||||||
return pgm_read_word(((uint16_t*)(ui + 10))); //read language code
|
count++;
|
||||||
}
|
}
|
||||||
#endif //W25X20CL
|
#endif //W25X20CL
|
||||||
return LANG_CODE_XX;
|
return LANG_CODE_XX;
|
||||||
|
|
|
@ -2,8 +2,6 @@
|
||||||
#ifndef LANGUAGE_H
|
#ifndef LANGUAGE_H
|
||||||
#define LANGUAGE_H
|
#define LANGUAGE_H
|
||||||
|
|
||||||
//#define W25X20CL
|
|
||||||
|
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1358,18 +1358,7 @@ static void lcd_implementation_drawmenu_sddirectory(uint8_t row, const char* pst
|
||||||
while(n--)
|
while(n--)
|
||||||
lcd.print(' ');
|
lcd.print(' ');
|
||||||
}
|
}
|
||||||
#define lcd_implementation_drawmenu_back_selected(row, pstr, data) lcd_implementation_drawmenu_generic(row, pstr, LCD_STR_UPLEVEL[0], LCD_STR_UPLEVEL[0])
|
|
||||||
#define lcd_implementation_drawmenu_back(row, pstr, data) lcd_implementation_drawmenu_generic(row, pstr, ' ', LCD_STR_UPLEVEL[0])
|
|
||||||
#define lcd_implementation_drawmenu_back_RAM_selected(row, str, data) lcd_implementation_drawmenu_generic_RAM(row, str, LCD_STR_UPLEVEL[0], LCD_STR_UPLEVEL[0])
|
|
||||||
#define lcd_implementation_drawmenu_back_RAM(row, str, data) lcd_implementation_drawmenu_generic_RAM(row, str, ' ', LCD_STR_UPLEVEL[0])
|
|
||||||
#define lcd_implementation_drawmenu_submenu_selected(row, pstr, data) lcd_implementation_drawmenu_generic(row, pstr, '>', LCD_STR_ARROW_RIGHT[0])
|
|
||||||
#define lcd_implementation_drawmenu_submenu(row, pstr, data) lcd_implementation_drawmenu_generic(row, pstr, ' ', LCD_STR_ARROW_RIGHT[0])
|
|
||||||
#define lcd_implementation_drawmenu_gcode_selected(row, pstr, gcode) lcd_implementation_drawmenu_generic(row, pstr, '>', ' ')
|
|
||||||
#define lcd_implementation_drawmenu_gcode(row, pstr, gcode) lcd_implementation_drawmenu_generic(row, pstr, ' ', ' ')
|
|
||||||
#define lcd_implementation_drawmenu_function_selected(row, pstr, data) lcd_implementation_drawmenu_generic(row, pstr, '>', ' ')
|
|
||||||
#define lcd_implementation_drawmenu_function(row, pstr, data) lcd_implementation_drawmenu_generic(row, pstr, ' ', ' ')
|
|
||||||
#define lcd_implementation_drawmenu_setlang_selected(row, pstr, data) lcd_implementation_drawmenu_generic(row, pstr, '>', ' ')
|
|
||||||
#define lcd_implementation_drawmenu_setlang(row, pstr, data) lcd_implementation_drawmenu_generic(row, pstr, ' ', ' ')
|
|
||||||
|
|
||||||
static void lcd_implementation_quick_feedback()
|
static void lcd_implementation_quick_feedback()
|
||||||
{
|
{
|
||||||
|
|
|
@ -149,7 +149,6 @@
|
||||||
//#define DEBUG_BUILD
|
//#define DEBUG_BUILD
|
||||||
//#define DEBUG_SEC_LANG //secondary language debug output at startup
|
//#define DEBUG_SEC_LANG //secondary language debug output at startup
|
||||||
//#define DEBUG_W25X20CL //debug external spi flash
|
//#define DEBUG_W25X20CL //debug external spi flash
|
||||||
//#define DEBUG_MENU_PRINTF_TEST
|
|
||||||
#ifdef DEBUG_BUILD
|
#ifdef DEBUG_BUILD
|
||||||
//#define _NO_ASM
|
//#define _NO_ASM
|
||||||
#define DEBUG_DCODES //D codes
|
#define DEBUG_DCODES //D codes
|
||||||
|
|
Loading…
Reference in a new issue