diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 97452236a..08df94088 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -2325,9 +2325,9 @@ void refresh_cmd_timeout(void) void trace() { //if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) - tone(BEEPER, 440); + _tone(BEEPER, 440); _delay(25); - noTone(BEEPER); + _noTone(BEEPER); _delay(20); } /* @@ -3124,9 +3124,9 @@ 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); + if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) _tone(BEEPER, 500); delay_keep_alive(50); - noTone(BEEPER); + _noTone(BEEPER); if (!farm_mode && loading_flag) { lcd_load_filament_color_check(); @@ -3189,9 +3189,9 @@ static void gcode_PRUSA_SN() putchar('\n'); #if 0 for (int b = 0; b < 3; b++) { - tone(BEEPER, 110); + _tone(BEEPER, 110); _delay(50); - noTone(BEEPER); + _noTone(BEEPER); _delay(50); } #endif @@ -6268,9 +6268,9 @@ Sigma_Exit: { #if BEEPER > 0 if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) - tone(BEEPER, beepS); + _tone(BEEPER, beepS); _delay(beepP); - noTone(BEEPER); + _noTone(BEEPER); #endif } else @@ -7494,9 +7494,9 @@ void manage_inactivity(bool ignore_stepper_queue/*=false*/) //default argument s if (degHotend0() > EXTRUDE_MINTEMP) { if ((eSoundMode == e_SOUND_MODE_LOUD) || (eSoundMode == e_SOUND_MODE_ONCE)) - tone(BEEPER, 1000); + _tone(BEEPER, 1000); delay_keep_alive(50); - noTone(BEEPER); + _noTone(BEEPER); loading_flag = true; enquecommand_front_P((PSTR("M701"))); } @@ -9233,9 +9233,9 @@ void M600_load_filament() { if (fsensor_check_autoload()) { if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) - tone(BEEPER, 1000); + _tone(BEEPER, 1000); delay_keep_alive(50); - noTone(BEEPER); + _noTone(BEEPER); break; } #endif //FILAMENT_SENSOR @@ -9252,9 +9252,9 @@ 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); + _tone(BEEPER, 500); delay_keep_alive(50); - noTone(BEEPER); + _noTone(BEEPER); #ifdef FSENSOR_QUALITY fsensor_oq_meassure_stop(); diff --git a/Firmware/system_timer.h b/Firmware/system_timer.h index 045ce728d..98647660d 100644 --- a/Firmware/system_timer.h +++ b/Firmware/system_timer.h @@ -11,10 +11,14 @@ #define _millis millis2 #define _micros micros2 #define _delay delay2 +#define _tone tone2 +#define _noTone noTone2 #else //SYSTEM_TIMER_2 #define _millis millis #define _micros micros #define _delay delay +#define _tone tone +#define _noTone noTone #define timer02_set_pwm0(pwm0) #endif //SYSTEM_TIMER_2 diff --git a/Firmware/timer02.c b/Firmware/timer02.c index 162b4e845..827299be1 100644 --- a/Firmware/timer02.c +++ b/Firmware/timer02.c @@ -4,8 +4,10 @@ // original OVF handler is disabled #include #include -#include +#include "Arduino.h" +#include "io_atmega2560.h" +#define BEEPER 84 uint8_t timer02_pwm0 = 0; @@ -154,3 +156,13 @@ void delay2(unsigned long ms) } } } + +void tone2(uint8_t _pin, unsigned int frequency/*, unsigned long duration*/) +{ + PIN_SET(BEEPER); +} + +void noTone2(uint8_t _pin) +{ + PIN_CLR(BEEPER); +} diff --git a/Firmware/timer02.h b/Firmware/timer02.h index 3bbaa9ce3..103360b9c 100644 --- a/Firmware/timer02.h +++ b/Firmware/timer02.h @@ -24,6 +24,10 @@ extern unsigned long micros2(void); extern void delay2(unsigned long ms); +extern void tone2(uint8_t _pin, unsigned int frequency/*, unsigned long duration*/); + +extern void noTone2(uint8_t _pin); + #if defined(__cplusplus) } diff --git a/Firmware/util.cpp b/Firmware/util.cpp index 15f3f4c5f..2499b513f 100644 --- a/Firmware/util.cpp +++ b/Firmware/util.cpp @@ -296,14 +296,14 @@ bool show_upgrade_dialog_if_version_newer(const char *version_string) 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); + _tone(BEEPER, 1000); delay_keep_alive(50); - noTone(BEEPER); + _noTone(BEEPER); delay_keep_alive(500); if((eSoundMode==e_SOUND_MODE_LOUD)||(eSoundMode==e_SOUND_MODE_ONCE)) - tone(BEEPER, 1000); + _tone(BEEPER, 1000); delay_keep_alive(50); - noTone(BEEPER); + _noTone(BEEPER); lcd_wait_for_click(); lcd_update_enable(true); lcd_clear();