From 5a7088746755b46521d1342875cb2f49c40959fa Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 8 Feb 2018 23:03:47 -0600 Subject: [PATCH] Size lcd_status_message based on language (#9545) --- .travis.yml | 3 ++- Marlin/src/lcd/language/language_bg.h | 1 + Marlin/src/lcd/language/language_ca.h | 1 + Marlin/src/lcd/language/language_cn.h | 1 + Marlin/src/lcd/language/language_cz_utf8.h | 1 + Marlin/src/lcd/language/language_da.h | 1 + Marlin/src/lcd/language/language_de.h | 1 + Marlin/src/lcd/language/language_el-gr.h | 1 + Marlin/src/lcd/language/language_el.h | 1 + Marlin/src/lcd/language/language_en.h | 4 ++++ Marlin/src/lcd/language/language_es.h | 2 +- Marlin/src/lcd/language/language_fi.h | 1 + Marlin/src/lcd/language/language_fr.h | 1 + Marlin/src/lcd/language/language_hr.h | 1 + Marlin/src/lcd/language/language_kana.h | 1 + Marlin/src/lcd/language/language_kana_utf8.h | 1 + Marlin/src/lcd/language/language_pl-DOGM.h | 1 + Marlin/src/lcd/language/language_pt-br_utf8.h | 1 + Marlin/src/lcd/language/language_pt_utf8.h | 1 + Marlin/src/lcd/language/language_ru.h | 1 + Marlin/src/lcd/language/language_sk_utf8.h | 1 + Marlin/src/lcd/language/language_tr.h | 1 + Marlin/src/lcd/language/language_uk.h | 1 + Marlin/src/lcd/language/language_zh_CN.h | 2 ++ Marlin/src/lcd/language/language_zh_TW.h | 2 ++ Marlin/src/lcd/ultralcd.cpp | 6 +++++- 26 files changed, 36 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index f400ca6ecb..6fb5d200c1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -86,8 +86,9 @@ script: - opt_enable_adv CUSTOM_USER_MENUS I2C_POSITION_ENCODERS BABYSTEPPING BABYSTEP_XY LIN_ADVANCE NANODLP_Z_SYNC - build_marlin_pio ${TRAVIS_BUILD_DIR} ${TEST_PLATFORM} # - # Add a Sled Z Probe, do non-segmented moves + # Add a Sled Z Probe, do non-segmented moves, use Japanese language # + - opt_set LANGUAGE kana_utf8 - opt_enable Z_PROBE_SLED - opt_disable SEGMENT_LEVELED_MOVES - opt_enable_adv BABYSTEP_ZPROBE_OFFSET DOUBLECLICK_FOR_Z_BABYSTEPPING diff --git a/Marlin/src/lcd/language/language_bg.h b/Marlin/src/lcd/language/language_bg.h index bf80f49ef8..5c25f3ea03 100644 --- a/Marlin/src/lcd/language/language_bg.h +++ b/Marlin/src/lcd/language/language_bg.h @@ -32,6 +32,7 @@ #define MAPPER_D0D1 // For Cyrillic #define DISPLAY_CHARSET_ISO10646_5 +#define CHARSIZE 2 #define WELCOME_MSG MACHINE_NAME _UxGT(" Готов.") #define MSG_SD_INSERTED _UxGT("Картата е поставена") diff --git a/Marlin/src/lcd/language/language_ca.h b/Marlin/src/lcd/language/language_ca.h index 3103b7cd3a..ed3ea45045 100644 --- a/Marlin/src/lcd/language/language_ca.h +++ b/Marlin/src/lcd/language/language_ca.h @@ -32,6 +32,7 @@ #define MAPPER_C2C3 // because of "ó" #define DISPLAY_CHARSET_ISO10646_1 +#define CHARSIZE 2 #define WELCOME_MSG MACHINE_NAME _UxGT(" preparada.") #define MSG_SD_INSERTED _UxGT("Targeta detectada.") diff --git a/Marlin/src/lcd/language/language_cn.h b/Marlin/src/lcd/language/language_cn.h index 584dcc4d04..40c330d1a5 100644 --- a/Marlin/src/lcd/language/language_cn.h +++ b/Marlin/src/lcd/language/language_cn.h @@ -31,6 +31,7 @@ #define LANGUAGE_CN_H #define DISPLAY_CHARSET_ISO10646_CN +#define CHARSIZE 2 #define WELCOME_MSG "\xa4\xa5\xa6\xa7" #define MSG_SD_INSERTED "\xa8\xa9\xaa\xab" diff --git a/Marlin/src/lcd/language/language_cz_utf8.h b/Marlin/src/lcd/language/language_cz_utf8.h index d4d4b6f674..f3bf1ebb6b 100644 --- a/Marlin/src/lcd/language/language_cz_utf8.h +++ b/Marlin/src/lcd/language/language_cz_utf8.h @@ -37,6 +37,7 @@ #define MAPPER_C3C4C5_CZ #define DISPLAY_CHARSET_ISO10646_CZ +#define CHARSIZE 2 #define WELCOME_MSG MACHINE_NAME _UxGT(" připraven.") #define MSG_BACK _UxGT("Zpět") diff --git a/Marlin/src/lcd/language/language_da.h b/Marlin/src/lcd/language/language_da.h index 390726f75a..60c9d2ae14 100644 --- a/Marlin/src/lcd/language/language_da.h +++ b/Marlin/src/lcd/language/language_da.h @@ -32,6 +32,7 @@ #define MAPPER_C2C3 #define DISPLAY_CHARSET_ISO10646_1 +#define CHARSIZE 2 #define WELCOME_MSG MACHINE_NAME _UxGT(" er klar") #define MSG_SD_INSERTED _UxGT("Kort isat") diff --git a/Marlin/src/lcd/language/language_de.h b/Marlin/src/lcd/language/language_de.h index 6584484354..98d9425e18 100644 --- a/Marlin/src/lcd/language/language_de.h +++ b/Marlin/src/lcd/language/language_de.h @@ -32,6 +32,7 @@ #define MAPPER_C2C3 #define DISPLAY_CHARSET_ISO10646_1 +#define CHARSIZE 2 #define THIS_LANGUAGES_SPECIAL_SYMBOLS _UxGT("ÄäÖöÜüß²³") diff --git a/Marlin/src/lcd/language/language_el-gr.h b/Marlin/src/lcd/language/language_el-gr.h index ee1e42e90f..ad2895cfdb 100644 --- a/Marlin/src/lcd/language/language_el-gr.h +++ b/Marlin/src/lcd/language/language_el-gr.h @@ -32,6 +32,7 @@ #define MAPPER_CECF #define DISPLAY_CHARSET_ISO10646_GREEK +#define CHARSIZE 2 #define WELCOME_MSG MACHINE_NAME _UxGT(" έτοιμο.") #define MSG_SD_INSERTED _UxGT("Εισαγωγή κάρτας") diff --git a/Marlin/src/lcd/language/language_el.h b/Marlin/src/lcd/language/language_el.h index e50ec764ca..5211fbe576 100644 --- a/Marlin/src/lcd/language/language_el.h +++ b/Marlin/src/lcd/language/language_el.h @@ -32,6 +32,7 @@ #define MAPPER_CECF #define DISPLAY_CHARSET_ISO10646_GREEK +#define CHARSIZE 2 #define WELCOME_MSG MACHINE_NAME _UxGT(" έτοιμο.") #define MSG_SD_INSERTED _UxGT("Εισαγωγή κάρτας") diff --git a/Marlin/src/lcd/language/language_en.h b/Marlin/src/lcd/language/language_en.h index f887b5992e..8812de9b82 100644 --- a/Marlin/src/lcd/language/language_en.h +++ b/Marlin/src/lcd/language/language_en.h @@ -36,6 +36,10 @@ #endif #undef en +#ifndef CHARSIZE + #define CHARSIZE 1 +#endif + #ifndef WELCOME_MSG #define WELCOME_MSG MACHINE_NAME _UxGT(" Ready.") #endif diff --git a/Marlin/src/lcd/language/language_es.h b/Marlin/src/lcd/language/language_es.h index 9cdd209d5f..df693e55a6 100644 --- a/Marlin/src/lcd/language/language_es.h +++ b/Marlin/src/lcd/language/language_es.h @@ -32,7 +32,7 @@ #define DISPLAY_CHARSET_ISO10646_1 #define NOT_EXTENDED_ISO10646_1_5X7 - +#define CHARSIZE 2 #define WELCOME_MSG MACHINE_NAME _UxGT(" lista.") #define MSG_BACK _UxGT("Atras") #define MSG_SD_INSERTED _UxGT("Tarjeta colocada") diff --git a/Marlin/src/lcd/language/language_fi.h b/Marlin/src/lcd/language/language_fi.h index 174d5c4202..aa5013f949 100644 --- a/Marlin/src/lcd/language/language_fi.h +++ b/Marlin/src/lcd/language/language_fi.h @@ -32,6 +32,7 @@ #define MAPPER_C2C3 #define DISPLAY_CHARSET_ISO10646_1 +#define CHARSIZE 2 #define WELCOME_MSG MACHINE_NAME _UxGT(" valmis.") #define MSG_SD_INSERTED _UxGT("Kortti asetettu") diff --git a/Marlin/src/lcd/language/language_fr.h b/Marlin/src/lcd/language/language_fr.h index c2f2be9a46..6159002030 100644 --- a/Marlin/src/lcd/language/language_fr.h +++ b/Marlin/src/lcd/language/language_fr.h @@ -32,6 +32,7 @@ #define MAPPER_NON #define NOT_EXTENDED_ISO10646_1_5X7 +#define CHARSIZE 2 #define WELCOME_MSG MACHINE_NAME _UxGT(" prete.") #define MSG_BACK _UxGT("Retour") diff --git a/Marlin/src/lcd/language/language_hr.h b/Marlin/src/lcd/language/language_hr.h index f9e45737b9..0cd9b89bd8 100644 --- a/Marlin/src/lcd/language/language_hr.h +++ b/Marlin/src/lcd/language/language_hr.h @@ -31,6 +31,7 @@ #define LANGUAGE_HR_H #define DISPLAY_CHARSET_ISO10646_1 // use the better font on full graphic displays. +#define CHARSIZE 2 #define WELCOME_MSG MACHINE_NAME _UxGT(" spreman.") #define MSG_SD_INSERTED _UxGT("SD kartica umetnuta") diff --git a/Marlin/src/lcd/language/language_kana.h b/Marlin/src/lcd/language/language_kana.h index 9ee69f2afc..76a88be533 100644 --- a/Marlin/src/lcd/language/language_kana.h +++ b/Marlin/src/lcd/language/language_kana.h @@ -34,6 +34,7 @@ // Define SIMULATE_ROMFONT to see what is seen on the character based display defined in Configuration.h #define SIMULATE_ROMFONT #define DISPLAY_CHARSET_ISO10646_KANA +#define CHARSIZE 2 // 片仮名表示定義 #define WELCOME_MSG MACHINE_NAME " ready." diff --git a/Marlin/src/lcd/language/language_kana_utf8.h b/Marlin/src/lcd/language/language_kana_utf8.h index 7c7a6eb92a..eaa970a289 100644 --- a/Marlin/src/lcd/language/language_kana_utf8.h +++ b/Marlin/src/lcd/language/language_kana_utf8.h @@ -34,6 +34,7 @@ #define MAPPER_E382E383 #define DISPLAY_CHARSET_ISO10646_KANA +#define CHARSIZE 3 // This just to show the potential benefit of unicode. // This translation can be improved by using the full charset of unicode codeblock U+30A0 to U+30FF. diff --git a/Marlin/src/lcd/language/language_pl-DOGM.h b/Marlin/src/lcd/language/language_pl-DOGM.h index d1e9b070da..a7d3d268c5 100644 --- a/Marlin/src/lcd/language/language_pl-DOGM.h +++ b/Marlin/src/lcd/language/language_pl-DOGM.h @@ -26,6 +26,7 @@ #ifndef LANGUAGE_PL_DOGM_H #define LANGUAGE_PL_DOGM_H +#define CHARSIZE 2 #define WELCOME_MSG MACHINE_NAME _UxGT(" gotowy.") #define MSG_SD_INSERTED _UxGT("Karta włożona") diff --git a/Marlin/src/lcd/language/language_pt-br_utf8.h b/Marlin/src/lcd/language/language_pt-br_utf8.h index d304b5d8f9..1843cfa6e0 100644 --- a/Marlin/src/lcd/language/language_pt-br_utf8.h +++ b/Marlin/src/lcd/language/language_pt-br_utf8.h @@ -32,6 +32,7 @@ #define LANGUAGE_PT_BR_UTF_H #define DISPLAY_CHARSET_ISO10646_1 +#define CHARSIZE 2 #define WELCOME_MSG MACHINE_NAME _UxGT(" pronto.") #define MSG_SD_INSERTED _UxGT("Cartão inserido") diff --git a/Marlin/src/lcd/language/language_pt_utf8.h b/Marlin/src/lcd/language/language_pt_utf8.h index 56618f7b19..40b3d81b5d 100644 --- a/Marlin/src/lcd/language/language_pt_utf8.h +++ b/Marlin/src/lcd/language/language_pt_utf8.h @@ -32,6 +32,7 @@ #define LANGUAGE_PT_UTF_H #define DISPLAY_CHARSET_ISO10646_1 +#define CHARSIZE 2 #define WELCOME_MSG MACHINE_NAME _UxGT(" pronta.") #define MSG_SD_INSERTED _UxGT("Cartão inserido") diff --git a/Marlin/src/lcd/language/language_ru.h b/Marlin/src/lcd/language/language_ru.h index c139d82e1d..bd89f4562d 100644 --- a/Marlin/src/lcd/language/language_ru.h +++ b/Marlin/src/lcd/language/language_ru.h @@ -32,6 +32,7 @@ #define MAPPER_D0D1 // For Cyrillic #define DISPLAY_CHARSET_ISO10646_5 +#define CHARSIZE 2 #define WELCOME_MSG MACHINE_NAME _UxGT(" Готов.") #define MSG_BACK _UxGT("Назад") diff --git a/Marlin/src/lcd/language/language_sk_utf8.h b/Marlin/src/lcd/language/language_sk_utf8.h index f0284c367f..601e30d3a6 100644 --- a/Marlin/src/lcd/language/language_sk_utf8.h +++ b/Marlin/src/lcd/language/language_sk_utf8.h @@ -36,6 +36,7 @@ #define MAPPER_C3C4C5_SK #define DISPLAY_CHARSET_ISO10646_SK +#define CHARSIZE 2 #define WELCOME_MSG MACHINE_NAME _UxGT(" pripravená.") #define MSG_BACK _UxGT("Naspať") diff --git a/Marlin/src/lcd/language/language_tr.h b/Marlin/src/lcd/language/language_tr.h index 5b4e740918..fc7432005b 100644 --- a/Marlin/src/lcd/language/language_tr.h +++ b/Marlin/src/lcd/language/language_tr.h @@ -32,6 +32,7 @@ #define MAPPER_C2C3_TR #define DISPLAY_CHARSET_ISO10646_TR +#define CHARSIZE 2 #if DISABLED(DOGLCD) #error "Turkish needs a graphical display." diff --git a/Marlin/src/lcd/language/language_uk.h b/Marlin/src/lcd/language/language_uk.h index 4dac5d0e84..6ae0acfb0d 100644 --- a/Marlin/src/lcd/language/language_uk.h +++ b/Marlin/src/lcd/language/language_uk.h @@ -32,6 +32,7 @@ #define MAPPER_D0D1 // For Cyrillic #define DISPLAY_CHARSET_ISO10646_5 +#define CHARSIZE 2 #define WELCOME_MSG MACHINE_NAME _UxGT(" готовий.") #define MSG_SD_INSERTED _UxGT("Картка вставлена") diff --git a/Marlin/src/lcd/language/language_zh_CN.h b/Marlin/src/lcd/language/language_zh_CN.h index f35ae3faa2..2d52c9426d 100644 --- a/Marlin/src/lcd/language/language_zh_CN.h +++ b/Marlin/src/lcd/language/language_zh_CN.h @@ -30,6 +30,8 @@ #ifndef LANGUAGE_ZH_CN_H #define LANGUAGE_ZH_CN_H +#define CHARSIZE 3 + #define WELCOME_MSG MACHINE_NAME _UxGT("已就绪.") //" ready." #define MSG_SD_INSERTED _UxGT("存储卡已插入") //"Card inserted" #define MSG_SD_REMOVED _UxGT("存储卡被拔出") //"Card removed" diff --git a/Marlin/src/lcd/language/language_zh_TW.h b/Marlin/src/lcd/language/language_zh_TW.h index 12682c7b13..f7e0ffac7d 100644 --- a/Marlin/src/lcd/language/language_zh_TW.h +++ b/Marlin/src/lcd/language/language_zh_TW.h @@ -30,6 +30,8 @@ #ifndef LANGUAGE_ZH_TW_H #define LANGUAGE_ZH_TW_H +#define CHARSIZE 3 + #define WELCOME_MSG MACHINE_NAME _UxGT("已就緒.") //" ready." #define MSG_SD_INSERTED _UxGT("記憶卡已插入") //"Card inserted" #define MSG_SD_REMOVED _UxGT("記憶卡被拔出") //"Card removed" diff --git a/Marlin/src/lcd/ultralcd.cpp b/Marlin/src/lcd/ultralcd.cpp index bbcf4156ef..d5b439e904 100644 --- a/Marlin/src/lcd/ultralcd.cpp +++ b/Marlin/src/lcd/ultralcd.cpp @@ -90,12 +90,16 @@ int16_t lcd_preheat_hotend_temp[2], lcd_preheat_bed_temp[2], lcd_preheat_fan_spe uint8_t lcd_status_update_delay = 1, // First update one loop delayed lcd_status_message_level; // Higher level blocks lower level -char lcd_status_message[3 * (LCD_WIDTH) + 1] = WELCOME_MSG; // worst case is kana with up to 3*LCD_WIDTH+1 #if ENABLED(STATUS_MESSAGE_SCROLLING) + #define MAX_MESSAGE_LENGTH max(2 * CHARSIZE * LCD_WIDTH, LONG_FILENAME_LENGTH) uint8_t status_scroll_pos = 0; +#else + #define MAX_MESSAGE_LENGTH CHARSIZE * (LCD_WIDTH) #endif +char lcd_status_message[MAX_MESSAGE_LENGTH + 1]; + #if ENABLED(SCROLL_LONG_FILENAMES) uint8_t filename_scroll_pos, filename_scroll_max, filename_scroll_hash; #endif