From 795b1d1cf79324630ed360f93863363d57f1b007 Mon Sep 17 00:00:00 2001 From: leptun Date: Sat, 31 Aug 2019 16:56:14 +0300 Subject: [PATCH] Toggle Sound --- Firmware/messages.c | 4 ++++ Firmware/messages.h | 4 ++++ Firmware/sound.h | 6 ----- Firmware/ultralcd.cpp | 53 +++++++++++++++---------------------------- lang/lang_en.txt | 15 +++++------- lang/lang_en_cz.txt | 22 ++++++++---------- lang/lang_en_de.txt | 22 ++++++++---------- lang/lang_en_es.txt | 22 ++++++++---------- lang/lang_en_fr.txt | 22 ++++++++---------- lang/lang_en_it.txt | 22 ++++++++---------- lang/lang_en_pl.txt | 22 ++++++++---------- 11 files changed, 86 insertions(+), 128 deletions(-) diff --git a/Firmware/messages.c b/Firmware/messages.c index 07ca8883..46bd750b 100644 --- a/Firmware/messages.c +++ b/Firmware/messages.c @@ -121,6 +121,10 @@ const char MSG_SORT[] PROGMEM_I1 = ISTR("Sort"); //// const char MSG_SORT_TIME[] PROGMEM_I1 = ISTR("Time"); //// const char MSG_SORT_ALPHA[] PROGMEM_I1 = ISTR("Alphabet"); //// const char MSG_RPI_PORT[] PROGMEM_I1 = ISTR("RPi port"); //// +const char MSG_SOUND[] PROGMEM_I1 = ISTR("Sound"); //// +const char MSG_SOUND_LOUD[] PROGMEM_I1 = ISTR("Loud"); //// +const char MSG_SOUND_ONCE[] PROGMEM_I1 = ISTR("Once"); //// +const char MSG_SOUND_BLIND[] PROGMEM_I1 = ISTR("Assist"); //// //not internationalized messages const char MSG_SD_WORKDIR_FAIL[] PROGMEM_N1 = "workDir open failed"; //// diff --git a/Firmware/messages.h b/Firmware/messages.h index 3bcfc288..96d13816 100644 --- a/Firmware/messages.h +++ b/Firmware/messages.h @@ -121,6 +121,10 @@ extern const char MSG_SORT[]; extern const char MSG_SORT_TIME[]; extern const char MSG_SORT_ALPHA[]; extern const char MSG_RPI_PORT[]; +extern const char MSG_SOUND[]; +extern const char MSG_SOUND_LOUD[]; +extern const char MSG_SOUND_ONCE[]; +extern const char MSG_SOUND_BLIND[]; //not internationalized messages extern const char MSG_BROWNOUT_RESET[]; diff --git a/Firmware/sound.h b/Firmware/sound.h index 90f3e723..a80d0155 100644 --- a/Firmware/sound.h +++ b/Firmware/sound.h @@ -3,12 +3,6 @@ #define SOUND_H -#define MSG_SOUND_MODE_LOUD "Sound [loud]" -#define MSG_SOUND_MODE_ONCE "Sound [once]" -#define MSG_SOUND_MODE_SILENT "Sound [silent]" -#define MSG_SOUND_MODE_BLIND "Sound [assist]" - - #define e_SOUND_MODE_NULL 0xFF typedef enum {e_SOUND_MODE_LOUD,e_SOUND_MODE_ONCE,e_SOUND_MODE_SILENT,e_SOUND_MODE_BLIND} eSOUND_MODE; diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index a6732c4f..6a82f277 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -5282,22 +5282,22 @@ while (0) do\ {\ switch(eSoundMode)\ - {\ - case e_SOUND_MODE_LOUD:\ - MENU_ITEM_FUNCTION_P(_i(MSG_SOUND_MODE_LOUD),lcd_sound_state_set);\ - break;\ - case e_SOUND_MODE_ONCE:\ - MENU_ITEM_FUNCTION_P(_i(MSG_SOUND_MODE_ONCE),lcd_sound_state_set);\ - break;\ - case e_SOUND_MODE_SILENT:\ - MENU_ITEM_FUNCTION_P(_i(MSG_SOUND_MODE_SILENT),lcd_sound_state_set);\ - break;\ - case e_SOUND_MODE_BLIND:\ - MENU_ITEM_FUNCTION_P(_i(MSG_SOUND_MODE_BLIND),lcd_sound_state_set);\ - break;\ - default:\ - MENU_ITEM_FUNCTION_P(_i(MSG_SOUND_MODE_LOUD),lcd_sound_state_set);\ - }\ + {\ + case e_SOUND_MODE_LOUD:\ + MENU_ITEM_TOGGLE_P(_T(MSG_SOUND), _T(MSG_SOUND_LOUD), lcd_sound_state_set);\ + break;\ + case e_SOUND_MODE_ONCE:\ + MENU_ITEM_TOGGLE_P(_T(MSG_SOUND), _T(MSG_SOUND_ONCE), lcd_sound_state_set);\ + break;\ + case e_SOUND_MODE_SILENT:\ + MENU_ITEM_TOGGLE_P(_T(MSG_SOUND), _T(MSG_SILENT), lcd_sound_state_set);\ + break;\ + case e_SOUND_MODE_BLIND:\ + MENU_ITEM_TOGGLE_P(_T(MSG_SOUND), _T(MSG_SOUND_BLIND), lcd_sound_state_set);\ + break;\ + default:\ + MENU_ITEM_TOGGLE_P(_T(MSG_SOUND), _T(MSG_SOUND_LOUD), lcd_sound_state_set);\ + }\ }\ while (0) @@ -6875,25 +6875,8 @@ static void lcd_tune_menu() } } #endif //TMC2130 - SETTINGS_MMU_MODE; - switch(eSoundMode) - { - case e_SOUND_MODE_LOUD: - MENU_ITEM_FUNCTION_P(_i(MSG_SOUND_MODE_LOUD),lcd_sound_state_set); - break; - case e_SOUND_MODE_ONCE: - MENU_ITEM_FUNCTION_P(_i(MSG_SOUND_MODE_ONCE),lcd_sound_state_set); - break; - case e_SOUND_MODE_SILENT: - MENU_ITEM_FUNCTION_P(_i(MSG_SOUND_MODE_SILENT),lcd_sound_state_set); - break; - case e_SOUND_MODE_BLIND: - MENU_ITEM_FUNCTION_P(_i(MSG_SOUND_MODE_BLIND),lcd_sound_state_set); - break; - default: - MENU_ITEM_FUNCTION_P(_i(MSG_SOUND_MODE_LOUD),lcd_sound_state_set); - } - + SETTINGS_MMU_MODE; + SETTINGS_SOUND; MENU_END(); } diff --git a/lang/lang_en.txt b/lang/lang_en.txt index 1e17b869..e2add805 100755 --- a/lang/lang_en.txt +++ b/lang/lang_en.txt @@ -718,23 +718,20 @@ #MSG_SORTING c=20 r=1 "Sorting files" -#MSG_SOUND_LOUD c=17 r=1 -"Sound [loud]" +#MSG_SOUND_LOUD +"Loud" # "Slight skew" -#MSG_SOUND_MUTE c=17 r=1 -"Sound [mute]" +#MSG_SOUND +"Sound" # "Some problem encountered, Z-leveling enforced ..." -#MSG_SOUND_ONCE c=17 r=1 -"Sound [once]" - -#MSG_SOUND_SILENT c=17 r=1 -"Sound [silent]" +#MSG_SOUND_ONCE +"Once" #MSG_SPEED "Speed" diff --git a/lang/lang_en_cz.txt b/lang/lang_en_cz.txt index 1966166e..6bb5293f 100755 --- a/lang/lang_en_cz.txt +++ b/lang/lang_en_cz.txt @@ -958,29 +958,25 @@ "Sorting files" "Trideni souboru" -#MSG_SOUND_LOUD c=17 r=1 -"Sound [loud]" -"Zvuk [hlasity]" +#MSG_SOUND_LOUD +"Loud" +"Hlasity" # "Slight skew" "Lehke zkoseni" -#MSG_SOUND_MUTE c=17 r=1 -"Sound [mute]" -"Zvuk [vypnuto]" +#MSG_SOUND +"Sound" +"Zvuk" # "Some problem encountered, Z-leveling enforced ..." "Vyskytl se problem, srovnavam osu Z ..." -#MSG_SOUND_ONCE c=17 r=1 -"Sound [once]" -"Zvuk [jednou]" - -#MSG_SOUND_SILENT c=17 r=1 -"Sound [silent]" -"Zvuk [tichy]" +#MSG_SOUND_ONCE +"Once" +"Jednou" #MSG_SPEED "Speed" diff --git a/lang/lang_en_de.txt b/lang/lang_en_de.txt index e53195ec..044156c1 100755 --- a/lang/lang_en_de.txt +++ b/lang/lang_en_de.txt @@ -958,29 +958,25 @@ "Sorting files" "Sortiere Dateien" -#MSG_SOUND_LOUD c=17 r=1 -"Sound [loud]" -"Sound [laut]" +#MSG_SOUND_LOUD +"Loud" +"Laut" # "Slight skew" "Leichter Schraeglauf" -#MSG_SOUND_MUTE c=17 r=1 -"Sound [mute]" -"Sound [stumm]" +#MSG_SOUND +"Sound" +"\x00" # "Some problem encountered, Z-leveling enforced ..." "Fehler aufgetreten, Z-Kalibrierung erforderlich..." -#MSG_SOUND_ONCE c=17 r=1 -"Sound [once]" -"Sound [einmal]" - -#MSG_SOUND_SILENT c=17 r=1 -"Sound [silent]" -"Sound [leise]" +#MSG_SOUND_ONCE +"Once" +"Einmal" #MSG_SPEED "Speed" diff --git a/lang/lang_en_es.txt b/lang/lang_en_es.txt index 35b7e5df..40b7af19 100755 --- a/lang/lang_en_es.txt +++ b/lang/lang_en_es.txt @@ -958,29 +958,25 @@ "Sorting files" "Ordenando archivos" -#MSG_SOUND_LOUD c=17 r=1 -"Sound [loud]" -"Sonido [alto]" +#MSG_SOUND_LOUD +"Loud" +"Alto" # "Slight skew" "Ligeramente inclinado" -#MSG_SOUND_MUTE c=17 r=1 -"Sound [mute]" -"Sonido[silenciad]" +#MSG_SOUND +"Sound" +"Sonido" # "Some problem encountered, Z-leveling enforced ..." "Problema encontrado, nivelacion Z forzosa ..." -#MSG_SOUND_ONCE c=17 r=1 -"Sound [once]" -"Sonido [una vez]" - -#MSG_SOUND_SILENT c=17 r=1 -"Sound [silent]" -"Sonido[silencios]" +#MSG_SOUND_ONCE +"Once" +"Una vez" #MSG_SPEED "Speed" diff --git a/lang/lang_en_fr.txt b/lang/lang_en_fr.txt index 619456ef..973f4c14 100755 --- a/lang/lang_en_fr.txt +++ b/lang/lang_en_fr.txt @@ -958,29 +958,25 @@ "Sorting files" "Tri des fichiers" -#MSG_SOUND_LOUD c=17 r=1 -"Sound [loud]" -"Son [fort]" +#MSG_SOUND_LOUD +"Loud" +"Fort" # "Slight skew" "Deviation legere" -#MSG_SOUND_MUTE c=17 r=1 -"Sound [mute]" -"Son [muet]" +#MSG_SOUND +"Sound" +"Son" # "Some problem encountered, Z-leveling enforced ..." "Problemes rencontres, nivellement de l'axe Z applique..." -#MSG_SOUND_ONCE c=17 r=1 -"Sound [once]" -"Son [une fois]" - -#MSG_SOUND_SILENT c=17 r=1 -"Sound [silent]" -"Son [silencieux]" +#MSG_SOUND_ONCE +"Once" +"Une fois" #MSG_SPEED "Speed" diff --git a/lang/lang_en_it.txt b/lang/lang_en_it.txt index 20dba996..8bf6038d 100755 --- a/lang/lang_en_it.txt +++ b/lang/lang_en_it.txt @@ -958,29 +958,25 @@ "Sorting files" "Ordinando i file" -#MSG_SOUND_LOUD c=17 r=1 -"Sound [loud]" -"Suono [forte]" +#MSG_SOUND_LOUD +"Loud" +"Forte" # "Slight skew" "Disassamento lieve" -#MSG_SOUND_MUTE c=17 r=1 -"Sound [mute]" -"Suono [mute]" +#MSG_SOUND +"Sound" +"Suono" # "Some problem encountered, Z-leveling enforced ..." "Sono stati rilevati problemi, avviato livellamento Z ..." -#MSG_SOUND_ONCE c=17 r=1 -"Sound [once]" -"Suono [singolo]" - -#MSG_SOUND_SILENT c=17 r=1 -"Sound [silent]" -"Suono[silenzioso]" +#MSG_SOUND_ONCE +"Once" +"Singolo" #MSG_SPEED "Speed" diff --git a/lang/lang_en_pl.txt b/lang/lang_en_pl.txt index 9906f8f9..54c48248 100755 --- a/lang/lang_en_pl.txt +++ b/lang/lang_en_pl.txt @@ -958,29 +958,25 @@ "Sorting files" "Sortowanie plikow" -#MSG_SOUND_LOUD c=17 r=1 -"Sound [loud]" -"Dzwiek [Glosny]" +#MSG_SOUND_LOUD +"Loud" +"Glosny" # "Slight skew" "Lekki skos" -#MSG_SOUND_MUTE c=17 r=1 -"Sound [mute]" -"Dzwiek[Wylaczony]" +#MSG_SOUND +"Sound" +"Dzwiek" # "Some problem encountered, Z-leveling enforced ..." "Wykryto problem, wymuszono poziomowanie osi Z ..." -#MSG_SOUND_ONCE c=17 r=1 -"Sound [once]" -"Dzwiek [1-raz]" - -#MSG_SOUND_SILENT c=17 r=1 -"Sound [silent]" -"Dzwiek [Cichy]" +#MSG_SOUND_ONCE +"Once" +"1-raz" #MSG_SPEED "Speed"