Prechádzať zdrojové kódy

Merge pull request #984 from MRprusa3d/MK3

Sound
PavelSindler 5 rokov pred
rodič
commit
9195167541

+ 13 - 0
Firmware/Marlin_main.cpp

@@ -799,6 +799,7 @@ void factory_reset(char level, bool quiet)
                    
         // 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);
@@ -807,6 +808,7 @@ void factory_reset(char level, bool quiet)
          
 		//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);
@@ -854,6 +856,7 @@ void factory_reset(char level, bool quiet)
             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);
@@ -866,6 +869,7 @@ void factory_reset(char level, bool quiet)
 			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);
@@ -938,6 +942,7 @@ void factory_reset()
 
 
 			SET_OUTPUT(BEEPER);
+if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
 			WRITE(BEEPER, HIGH);
 
 			while (!READ(BTN_ENC));
@@ -2461,6 +2466,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);
@@ -3095,6 +3101,7 @@ void gcode_M701()
 	plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 100 / 60, active_extruder); //slow sequence
 	st_synchronize();
 
+if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
 	tone(BEEPER, 500);
 	delay_keep_alive(50);
 	noTone(BEEPER);
@@ -3495,6 +3502,7 @@ void process_commands()
                             
                             SET_OUTPUT(BEEPER);
                             if (counterBeep== 0){
+if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
                               WRITE(BEEPER,HIGH);
                             }
                             
@@ -6052,6 +6060,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);
@@ -6493,6 +6502,7 @@ Sigma_Exit:
 
 			 
 			
+if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
 			WRITE(BEEPER, HIGH);
 			counterBeep = 0;
 			while(!lcd_clicked() && (counterBeep < 50)) {
@@ -7505,6 +7515,7 @@ void manage_inactivity(bool ignore_stepper_queue/*=false*/) //default argument s
 				fsensor_autoload_check_stop();
 				if (degHotend0() > EXTRUDE_MINTEMP)
 				{
+if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
 					tone(BEEPER, 1000);
 					delay_keep_alive(50);
 					noTone(BEEPER);
@@ -9159,6 +9170,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);
@@ -9177,6 +9189,7 @@ void M600_load_filament()
 
 	M600_load_filament_movements();
 
+if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
 	tone(BEEPER, 500);
 	delay_keep_alive(50);
 	noTone(BEEPER);

+ 5 - 0
Firmware/temperature.cpp

@@ -31,6 +31,7 @@
 
 #include "Marlin.h"
 #include "ultralcd.h"
+#include "sound.h"
 #include "temperature.h"
 #include "cardreader.h"
 
@@ -523,6 +524,7 @@ 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);
@@ -533,6 +535,7 @@ void fanSpeedError(unsigned char _fan) {
 	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);
@@ -1343,6 +1346,7 @@ 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);
@@ -1427,6 +1431,7 @@ 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;

+ 1 - 1
Firmware/ultralcd.cpp

@@ -31,7 +31,6 @@
 #include "tmc2130.h"
 #endif //TMC2130
 
-//-//
 #include "sound.h"
 
 #ifdef SNMM_V2
@@ -6065,6 +6064,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);

+ 3 - 0
Firmware/util.cpp

@@ -1,6 +1,7 @@
 #include "Configuration.h"
 
 #include "ultralcd.h"
+#include "sound.h"
 #include "language.h"
 #include "util.h"
 
@@ -294,10 +295,12 @@ 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 r=0
+if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
         tone(BEEPER, 1000);
         delay_keep_alive(50);
         noTone(BEEPER);
         delay_keep_alive(500);
+if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE))
         tone(BEEPER, 1000);
         delay_keep_alive(50);
         noTone(BEEPER);