diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index a1740b240..1887c5535 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -659,19 +659,13 @@ static void factory_reset(char level) // Level 0: Language reset case 0: -if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) - WRITE(BEEPER, HIGH); - _delay_ms(100); - WRITE(BEEPER, LOW); + Sound_MakeCustom(100,0,false); lang_reset(); break; //Level 1: Reset statistics case 1: -if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) - WRITE(BEEPER, HIGH); - _delay_ms(100); - WRITE(BEEPER, LOW); + Sound_MakeCustom(100,0,false); eeprom_update_dword((uint32_t *)EEPROM_TOTALTIME, 0); eeprom_update_dword((uint32_t *)EEPROM_FILAMENTUSED, 0); @@ -726,11 +720,7 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) fsensor_enable(); fsensor_autoload_set(true); #endif //FILAMENT_SENSOR - -if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) - WRITE(BEEPER, HIGH); - _delay_ms(100); - WRITE(BEEPER, LOW); + Sound_MakeCustom(100,0,false); //_delay_ms(2000); break; @@ -740,11 +730,7 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) lcd_puts_P(PSTR("Factory RESET")); lcd_puts_at_P(1, 2, PSTR("ERASING all data")); -if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) - WRITE(BEEPER, HIGH); - _delay_ms(100); - WRITE(BEEPER, LOW); - + Sound_MakeCustom(100,0,false); er_progress = 0; lcd_puts_at_P(3, 3, PSTR(" ")); lcd_set_cursor(3, 3); @@ -814,7 +800,7 @@ void factory_reset() SET_OUTPUT(BEEPER); -if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) + if(eSoundMode!=e_SOUND_MODE_SILENT) WRITE(BEEPER, HIGH); while (!READ(BTN_ENC)); @@ -2356,11 +2342,7 @@ void refresh_cmd_timeout(void) #endif //FWRETRACT void trace() { -//if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) - _tone(BEEPER, 440); - _delay(25); - _noTone(BEEPER); - _delay(20); + Sound_MakeCustom(25,440,true); } /* void ramming() { @@ -3173,9 +3155,7 @@ void gcode_M701() load_filament_final_feed(); //slow sequence st_synchronize(); - if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) _tone(BEEPER, 500); - delay_keep_alive(50); - _noTone(BEEPER); + Sound_MakeCustom(50,500,false); if (!farm_mode && loading_flag) { lcd_load_filament_color_check(); @@ -3706,7 +3686,7 @@ void process_commands() SET_OUTPUT(BEEPER); if (counterBeep== 0){ -if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) +if(eSoundMode!=e_SOUND_MODE_SILENT) WRITE(BEEPER,HIGH); } @@ -6372,10 +6352,7 @@ Sigma_Exit: if (beepS > 0) { #if BEEPER > 0 -if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) - _tone(BEEPER, beepS); - _delay(beepP); - _noTone(BEEPER); + Sound_MakeCustom(beepP,beepS,false); #endif } else @@ -7674,10 +7651,7 @@ bool bInhibitFlag; //-// if (degHotend0() > EXTRUDE_MINTEMP) if(0) { - if ((eSoundMode == e_SOUND_MODE_LOUD) || (eSoundMode == e_SOUND_MODE_ONCE)) - _tone(BEEPER, 1000); - delay_keep_alive(50); - _noTone(BEEPER); + Sound_MakeCustom(50,1000,false); loading_flag = true; enquecommand_front_P((PSTR("M701"))); } @@ -9509,7 +9483,7 @@ void M600_wait_for_user(float HotendTempBckp) { } SET_OUTPUT(BEEPER); if (counterBeep == 0) { - if((eSoundMode==e_SOUND_MODE_LOUD)||((eSoundMode==e_SOUND_MODE_ONCE)&&bFirst)) + if((eSoundMode==e_SOUND_MODE_BLIND)|| (eSoundMode==e_SOUND_MODE_LOUD)||((eSoundMode==e_SOUND_MODE_ONCE)&&bFirst)) { bFirst=false; WRITE(BEEPER, HIGH); @@ -9612,10 +9586,7 @@ void M600_load_filament() { #ifdef FILAMENT_SENSOR if (fsensor_check_autoload()) { -if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) - _tone(BEEPER, 1000); - delay_keep_alive(50); - _noTone(BEEPER); + Sound_MakeCustom(50,1000,false); break; } #endif //FILAMENT_SENSOR @@ -9631,10 +9602,7 @@ if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) M600_load_filament_movements(); -if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) - _tone(BEEPER, 500); - delay_keep_alive(50); - _noTone(BEEPER); + Sound_MakeCustom(50,1000,false); #ifdef FSENSOR_QUALITY fsensor_oq_meassure_stop(); diff --git a/Firmware/lcd.cpp b/Firmware/lcd.cpp index e5d020c0b..5bd7cad67 100644 --- a/Firmware/lcd.cpp +++ b/Firmware/lcd.cpp @@ -704,15 +704,12 @@ uint8_t lcd_clicked(void) void lcd_beeper_quick_feedback(void) { - SET_OUTPUT(BEEPER); //-// Sound_MakeSound(e_SOUND_TYPE_ButtonEcho); /* for(int8_t i = 0; i < 10; i++) { - WRITE(BEEPER,HIGH); - delayMicroseconds(100); - WRITE(BEEPER,LOW); + Sound_MakeCustom(100,0,false); delayMicroseconds(100); } */ diff --git a/Firmware/menu.cpp b/Firmware/menu.cpp index 847e63c80..347f34a96 100755 --- a/Firmware/menu.cpp +++ b/Firmware/menu.cpp @@ -11,8 +11,7 @@ #include "ultralcd.h" #include "language.h" #include "static_assert.h" - - +#include "sound.h" extern int32_t lcd_encoder; @@ -65,7 +64,11 @@ void menu_goto(menu_func_t menu, const uint32_t encoder, const bool feedback, bo void menu_start(void) { if (lcd_encoder > 0x8000) lcd_encoder = 0; - if (lcd_encoder < 0) lcd_encoder = 0; + if (lcd_encoder < 0) + { + lcd_encoder = 0; + Sound_MakeSound(e_SOUND_TYPE_BlindAlert); + } if (lcd_encoder < menu_top) menu_top = lcd_encoder; menu_line = menu_top; @@ -75,7 +78,10 @@ void menu_start(void) void menu_end(void) { if (lcd_encoder >= menu_item) + { lcd_encoder = menu_item - 1; + Sound_MakeSound(e_SOUND_TYPE_BlindAlert); + } if (((uint8_t)lcd_encoder) >= menu_top + LCD_HEIGHT) { menu_top = lcd_encoder - LCD_HEIGHT + 1; diff --git a/Firmware/mmu.cpp b/Firmware/mmu.cpp index 916b3d0fd..adf5da4c5 100644 --- a/Firmware/mmu.cpp +++ b/Firmware/mmu.cpp @@ -831,7 +831,7 @@ void mmu_M600_wait_and_beep() { } SET_OUTPUT(BEEPER); if (counterBeep == 0) { - if((eSoundMode==e_SOUND_MODE_LOUD)||((eSoundMode==e_SOUND_MODE_ONCE)&&bFirst)) + if((eSoundMode==e_SOUND_MODE_BLIND)|| (eSoundMode==e_SOUND_MODE_LOUD)||((eSoundMode==e_SOUND_MODE_ONCE)&&bFirst)) { bFirst=false; WRITE(BEEPER, HIGH); diff --git a/Firmware/sound.cpp b/Firmware/sound.cpp index ba6ea726a..b84c6e60b 100644 --- a/Firmware/sound.cpp +++ b/Firmware/sound.cpp @@ -17,7 +17,8 @@ static void Sound_SaveMode(void); static void Sound_DoSound_Echo(void); static void Sound_DoSound_Prompt(void); static void Sound_DoSound_Alert(bool bOnce); - +static void Sound_DoSound_Encoder_Move(void); +static void Sound_DoSound_Blind_Alert(void); void Sound_Init(void) { @@ -49,9 +50,9 @@ switch(eSoundMode) eSoundMode=e_SOUND_MODE_SILENT; break; case e_SOUND_MODE_SILENT: - eSoundMode=e_SOUND_MODE_MUTE; + eSoundMode=e_SOUND_MODE_BLIND; break; - case e_SOUND_MODE_MUTE: + case e_SOUND_MODE_BLIND: eSoundMode=e_SOUND_MODE_LOUD; break; default: @@ -60,6 +61,36 @@ switch(eSoundMode) Sound_SaveMode(); } +void Sound_MakeCustom(uint16_t ms,uint16_t tone_,bool critical){ + if (!critical){ + if (eSoundMode != e_SOUND_MODE_SILENT){ + if(!tone_){ + WRITE(BEEPER, HIGH); + delayMicroseconds(ms); + WRITE(BEEPER, LOW); + } + else{ + _tone(BEEPER, tone_); + delay_keep_alive(ms); + _noTone(BEEPER); + } + } + } + else{ + if(!tone_){ + WRITE(BEEPER, HIGH); + delayMicroseconds(ms); + WRITE(BEEPER, LOW); + delayMicroseconds(100); + } + else{ + _tone(BEEPER, tone_); + delay_keep_alive(ms); + _noTone(BEEPER); + } + } +} + void Sound_MakeSound(eSOUND_TYPE eSoundType) { switch(eSoundMode) @@ -84,13 +115,43 @@ switch(eSoundMode) if(eSoundType==e_SOUND_TYPE_StandardAlert) Sound_DoSound_Alert(true); break; - case e_SOUND_MODE_MUTE: - break; + case e_SOUND_MODE_BLIND: + if(eSoundType==e_SOUND_TYPE_ButtonEcho) + Sound_DoSound_Echo(); + if(eSoundType==e_SOUND_TYPE_StandardPrompt) + Sound_DoSound_Prompt(); + if(eSoundType==e_SOUND_TYPE_StandardAlert) + Sound_DoSound_Alert(false); + if(eSoundType==e_SOUND_TYPE_EncoderMove) + Sound_DoSound_Encoder_Move(); + if(eSoundType==e_SOUND_TYPE_BlindAlert) + Sound_DoSound_Blind_Alert(); + break; default: - ; + break; } } +static void Sound_DoSound_Blind_Alert(void) +{ + _tone(BEEPER,100); + delay_keep_alive(50); + _noTone(BEEPER); + delay_keep_alive(200); +} + + static void Sound_DoSound_Encoder_Move(void) +{ +uint8_t nI; + + for(nI=0;nI<5;nI++) + { + WRITE(BEEPER,HIGH); + delayMicroseconds(75); + WRITE(BEEPER,LOW); + delayMicroseconds(75); + } +} static void Sound_DoSound_Echo(void) { diff --git a/Firmware/sound.h b/Firmware/sound.h index 479f113e9..2c14dfee6 100644 --- a/Firmware/sound.h +++ b/Firmware/sound.h @@ -1,3 +1,4 @@ +#include #ifndef SOUND_H #define SOUND_H @@ -5,16 +6,16 @@ #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_MUTE "Sound [mute]" +#define MSG_SOUND_MODE_BLIND "Sound [blind]" #define e_SOUND_MODE_NULL 0xFF typedef enum - {e_SOUND_MODE_LOUD,e_SOUND_MODE_ONCE,e_SOUND_MODE_SILENT,e_SOUND_MODE_MUTE} eSOUND_MODE; + {e_SOUND_MODE_LOUD,e_SOUND_MODE_ONCE,e_SOUND_MODE_SILENT,e_SOUND_MODE_BLIND} eSOUND_MODE; #define e_SOUND_MODE_DEFAULT e_SOUND_MODE_LOUD typedef enum - {e_SOUND_TYPE_ButtonEcho,e_SOUND_TYPE_EncoderEcho,e_SOUND_TYPE_StandardPrompt,e_SOUND_TYPE_StandardConfirm,e_SOUND_TYPE_StandardWarning,e_SOUND_TYPE_StandardAlert} eSOUND_TYPE; + {e_SOUND_TYPE_ButtonEcho,e_SOUND_TYPE_EncoderEcho,e_SOUND_TYPE_StandardPrompt,e_SOUND_TYPE_StandardConfirm,e_SOUND_TYPE_StandardWarning,e_SOUND_TYPE_StandardAlert,e_SOUND_TYPE_EncoderMove,e_SOUND_TYPE_BlindAlert} eSOUND_TYPE; typedef enum {e_SOUND_CLASS_Echo,e_SOUND_CLASS_Prompt,e_SOUND_CLASS_Confirm,e_SOUND_CLASS_Warning,e_SOUND_CLASS_Alert} eSOUND_CLASS; @@ -27,6 +28,7 @@ extern void Sound_Default(void); extern void Sound_Save(void); extern void Sound_CycleState(void); extern void Sound_MakeSound(eSOUND_TYPE eSoundType); +extern void Sound_MakeCustom(uint16_t ms,uint16_t tone_ ,bool critical); //static void Sound_DoSound_Echo(void); //static void Sound_DoSound_Prompt(void); diff --git a/Firmware/temperature.cpp b/Firmware/temperature.cpp index 668b857fd..6796f8d23 100755 --- a/Firmware/temperature.cpp +++ b/Firmware/temperature.cpp @@ -541,22 +541,14 @@ void fanSpeedError(unsigned char _fan) { case 0: SERIAL_ECHOLNPGM("Extruder fan speed is lower then expected"); if (get_message_level() == 0) { -if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)||(eSoundMode==e_SOUND_MODE_SILENT)) - WRITE(BEEPER, HIGH); - delayMicroseconds(200); - WRITE(BEEPER, LOW); - delayMicroseconds(100); + Sound_MakeCustom(200,0,true); LCD_ALERTMESSAGEPGM("Err: EXTR. FAN ERROR"); } break; case 1: SERIAL_ECHOLNPGM("Print fan speed is lower then expected"); if (get_message_level() == 0) { -if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)||(eSoundMode==e_SOUND_MODE_SILENT)) - WRITE(BEEPER, HIGH); - delayMicroseconds(200); - WRITE(BEEPER, LOW); - delayMicroseconds(100); + Sound_MakeCustom(200,0,true); LCD_ALERTMESSAGEPGM("Err: PRINT FAN ERROR"); } break; @@ -1398,13 +1390,9 @@ void temp_runaway_stop(bool isPreheat, bool isBed) disable_e2(); manage_heater(); lcd_update(0); -if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)||(eSoundMode==e_SOUND_MODE_SILENT)) - WRITE(BEEPER, HIGH); - delayMicroseconds(500); - WRITE(BEEPER, LOW); - delayMicroseconds(100); - - if (isPreheat) + Sound_MakeCustom(200,0,true); + + if (isPreheat) { Stop(); isBed ? LCD_ALERTMESSAGEPGM("BED PREHEAT ERROR") : LCD_ALERTMESSAGEPGM("PREHEAT ERROR"); @@ -1489,7 +1477,6 @@ void max_temp_error(uint8_t e) { SET_OUTPUT(BEEPER); WRITE(FAN_PIN, 1); WRITE(EXTRUDER_0_AUTO_FAN_PIN, 1); -if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)||(eSoundMode==e_SOUND_MODE_SILENT)) WRITE(BEEPER, 1); // fanSpeed will consumed by the check_axes_activity() routine. fanSpeed=255; diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 97304adb2..a9957c259 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -2867,10 +2867,12 @@ void lcd_alright() { if (cursor_pos > 3) { cursor_pos = 3; + Sound_MakeSound(e_SOUND_TYPE_BlindAlert); } if (cursor_pos < 1) { cursor_pos = 1; + Sound_MakeSound(e_SOUND_TYPE_BlindAlert); } lcd_set_cursor(0, 1); lcd_print(" "); @@ -2881,6 +2883,7 @@ void lcd_alright() { lcd_set_cursor(0, cursor_pos); lcd_print(">"); enc_dif = lcd_encoder_diff; + Sound_MakeSound(e_SOUND_TYPE_EncoderMove); _delay(100); } @@ -2888,7 +2891,7 @@ void lcd_alright() { if (lcd_clicked()) { - + Sound_MakeSound(e_SOUND_TYPE_ButtonEcho); lcd_change_fil_state = cursor_pos; _delay(500); @@ -3845,20 +3848,24 @@ int8_t lcd_show_multiscreen_message_two_choices_and_wait_P(const char *msg, bool lcd_set_cursor(7, 3); lcd_puts_P((PSTR(">"))); yes = false; + Sound_MakeSound(e_SOUND_TYPE_EncoderMove); } else if (enc_dif > lcd_encoder_diff && !yes) { lcd_puts_P((PSTR(">"))); lcd_set_cursor(7, 3); lcd_puts_P((PSTR(" "))); yes = true; + Sound_MakeSound(e_SOUND_TYPE_EncoderMove); } enc_dif = lcd_encoder_diff; } else { + Sound_MakeSound(e_SOUND_TYPE_BlindAlert); break; //turning knob skips waiting loop } } if (lcd_clicked()) { + Sound_MakeSound(e_SOUND_TYPE_ButtonEcho); if (msg_next == NULL) { //KEEPALIVE_STATE(IN_HANDLER); lcd_set_custom_characters(); @@ -3931,16 +3938,20 @@ int8_t lcd_show_fullscreen_message_yes_no_and_wait_P(const char *msg, bool allow lcd_set_cursor(0, 3); lcd_puts_P((PSTR(">"))); yes = false; + Sound_MakeSound(e_SOUND_TYPE_EncoderMove); + } else if (enc_dif > lcd_encoder_diff && !yes) { lcd_puts_P((PSTR(">"))); lcd_set_cursor(0, 3); lcd_puts_P((PSTR(" "))); yes = true; + Sound_MakeSound(e_SOUND_TYPE_EncoderMove); } enc_dif = lcd_encoder_diff; } if (lcd_clicked()) { + Sound_MakeSound(e_SOUND_TYPE_ButtonEcho); KEEPALIVE_STATE(IN_HANDLER); return yes; } @@ -5441,8 +5452,8 @@ do\ case e_SOUND_MODE_SILENT:\ MENU_ITEM_FUNCTION_P(_i(MSG_SOUND_MODE_SILENT),lcd_sound_state_set);\ break;\ - case e_SOUND_MODE_MUTE:\ - MENU_ITEM_FUNCTION_P(_i(MSG_SOUND_MODE_MUTE),lcd_sound_state_set);\ + 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);\ @@ -5620,10 +5631,12 @@ void bowden_menu() { if (cursor_pos > 3) { cursor_pos = 3; + Sound_MakeSound(e_SOUND_TYPE_BlindAlert); } if (cursor_pos < 0) { cursor_pos = 0; + Sound_MakeSound(e_SOUND_TYPE_BlindAlert); } lcd_set_cursor(0, 0); @@ -5636,13 +5649,13 @@ void bowden_menu() { lcd_print(" "); lcd_set_cursor(0, cursor_pos); lcd_print(">"); - + Sound_MakeSound(e_SOUND_TYPE_EncoderMove); enc_dif = lcd_encoder_diff; _delay(100); } if (lcd_clicked()) { - + Sound_MakeSound(e_SOUND_TYPE_ButtonEcho); lcd_clear(); while (1) { @@ -5673,6 +5686,7 @@ void bowden_menu() { } _delay(100); if (lcd_clicked()) { + Sound_MakeSound(e_SOUND_TYPE_ButtonEcho); EEPROM_save_B(EEPROM_BOWDEN_LENGTH + cursor_pos * 2, &bowden_length[cursor_pos]); if (lcd_show_fullscreen_message_yes_no_and_wait_P(PSTR("Continue with another bowden?"))) { lcd_update_enable(true); @@ -5718,8 +5732,14 @@ static char snmm_stop_print_menu() { //menu for choosing which filaments will be if ((abs(enc_dif - lcd_encoder_diff)) > 1) { if (enc_dif > lcd_encoder_diff) cursor_pos--; if (enc_dif < lcd_encoder_diff) cursor_pos++; - if (cursor_pos > 3) cursor_pos = 3; - if (cursor_pos < 1) cursor_pos = 1; + if (cursor_pos > 3) { + cursor_pos = 3; + Sound_MakeSound(e_SOUND_TYPE_BlindAlert); + } + if (cursor_pos < 1){ + cursor_pos = 1; + Sound_MakeSound(e_SOUND_TYPE_BlindAlert); + } lcd_set_cursor(0, 1); lcd_print(" "); @@ -5730,10 +5750,12 @@ static char snmm_stop_print_menu() { //menu for choosing which filaments will be lcd_set_cursor(0, cursor_pos); lcd_print(">"); enc_dif = lcd_encoder_diff; + Sound_MakeSound(e_SOUND_TYPE_EncoderMove); _delay(100); } } if (lcd_clicked()) { + Sound_MakeSound(e_SOUND_TYPE_ButtonEcho); KEEPALIVE_STATE(IN_HANDLER); return(cursor_pos - 1); } @@ -5785,7 +5807,8 @@ uint8_t choose_menu_P(const char *header, const char *item, const char *last_ite } if (cursor_pos > 3) - { + { + Sound_MakeSound(e_SOUND_TYPE_BlindAlert); cursor_pos = 3; if (first < items_no - 3) { @@ -5796,6 +5819,7 @@ uint8_t choose_menu_P(const char *header, const char *item, const char *last_ite if (cursor_pos < 1) { + Sound_MakeSound(e_SOUND_TYPE_BlindAlert); cursor_pos = 1; if (first > 0) { @@ -5830,11 +5854,12 @@ uint8_t choose_menu_P(const char *header, const char *item, const char *last_ite lcd_print(" "); lcd_set_cursor(0, cursor_pos); lcd_print(">"); - + Sound_MakeSound(e_SOUND_TYPE_EncoderMove); _delay(100); if (lcd_clicked()) { + Sound_MakeSound(e_SOUND_TYPE_ButtonEcho); KEEPALIVE_STATE(IN_HANDLER); lcd_encoder_diff = 0; return(cursor_pos + first - 1); @@ -5889,6 +5914,7 @@ char reset_menu() { if (cursor_pos > 3) { cursor_pos = 3; + Sound_MakeSound(e_SOUND_TYPE_BlindAlert); if (first < items_no - 4) { first++; lcd_clear(); @@ -5897,6 +5923,7 @@ char reset_menu() { if (cursor_pos < 0) { cursor_pos = 0; + Sound_MakeSound(e_SOUND_TYPE_BlindAlert); if (first > 0) { first--; lcd_clear(); @@ -5912,6 +5939,7 @@ char reset_menu() { lcd_print(" "); lcd_set_cursor(0, cursor_pos); lcd_print(">"); + Sound_MakeSound(e_SOUND_TYPE_EncoderMove); enc_dif = lcd_encoder_diff; _delay(100); } @@ -5919,6 +5947,7 @@ char reset_menu() { } if (lcd_clicked()) { + Sound_MakeSound(e_SOUND_TYPE_ButtonEcho); return(cursor_pos + first); } @@ -6227,6 +6256,7 @@ unsigned char lcd_choose_color() { if (cursor_pos > active_rows) { cursor_pos = active_rows; + Sound_MakeSound(e_SOUND_TYPE_BlindAlert); if (first < items_no - active_rows) { first++; lcd_clear(); @@ -6235,6 +6265,7 @@ unsigned char lcd_choose_color() { if (cursor_pos < 1) { cursor_pos = 1; + Sound_MakeSound(e_SOUND_TYPE_BlindAlert); if (first > 0) { first--; lcd_clear(); @@ -6248,12 +6279,14 @@ unsigned char lcd_choose_color() { lcd_print(" "); lcd_set_cursor(0, cursor_pos); lcd_print(">"); + Sound_MakeSound(e_SOUND_TYPE_EncoderMove); enc_dif = lcd_encoder_diff; _delay(100); } if (lcd_clicked()) { + Sound_MakeSound(e_SOUND_TYPE_ButtonEcho); switch(cursor_pos + first - 1) { case 0: return 1; break; case 1: return 0; break; @@ -6565,11 +6598,7 @@ static void lcd_main_menu() } void stack_error() { - SET_OUTPUT(BEEPER); -if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)||(eSoundMode==e_SOUND_MODE_SILENT)) - WRITE(BEEPER, HIGH); - _delay(1000); - WRITE(BEEPER, LOW); + Sound_MakeCustom(1000,0,true); lcd_display_message_fullscreen_P(_i("Error - static memory has been overwritten"));////MSG_STACK_ERROR c=20 r=4 //err_triggered = 1; while (1) delay_keep_alive(1000); @@ -6696,8 +6725,8 @@ static void lcd_tune_menu() case e_SOUND_MODE_SILENT: MENU_ITEM_FUNCTION_P(_i(MSG_SOUND_MODE_SILENT),lcd_sound_state_set); break; - case e_SOUND_MODE_MUTE: - MENU_ITEM_FUNCTION_P(_i(MSG_SOUND_MODE_MUTE),lcd_sound_state_set); + 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); @@ -6856,6 +6885,7 @@ void lcd_sdcard_stop() if (lcd_clicked()) { + Sound_MakeSound(e_SOUND_TYPE_ButtonEcho); if ((int32_t)lcd_encoder == 1) { lcd_return_to_status(); @@ -8366,6 +8396,7 @@ void menu_lcd_lcdupdate_func(void) if (lcd_draw_update == 0) lcd_draw_update = 1; lcd_encoder += lcd_encoder_diff / ENCODER_PULSES_PER_STEP; + Sound_MakeSound(e_SOUND_TYPE_EncoderMove); lcd_encoder_diff = 0; lcd_timeoutToStatus.start(); } diff --git a/Firmware/util.cpp b/Firmware/util.cpp index 18df92f62..80a55acc2 100644 --- a/Firmware/util.cpp +++ b/Firmware/util.cpp @@ -295,15 +295,9 @@ bool show_upgrade_dialog_if_version_newer(const char *version_string) for (const char *c = version_string; ! is_whitespace_or_nl_or_eol(*c); ++ c) lcd_putc(*c); lcd_puts_at_P(0, 3, _i("Please upgrade."));////MSG_NEW_FIRMWARE_PLEASE_UPGRADE c=20 -if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) - _tone(BEEPER, 1000); - delay_keep_alive(50); - _noTone(BEEPER); + Sound_MakeCustom(50,1000,false); delay_keep_alive(500); -if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) - _tone(BEEPER, 1000); - delay_keep_alive(50); - _noTone(BEEPER); + Sound_MakeCustom(50,1000,false); lcd_wait_for_click(); lcd_update_enable(true); lcd_clear();