From 2a9869ce2d77917796e20271d0c2e815323b2da1 Mon Sep 17 00:00:00 2001 From: Yuri D'Elia Date: Mon, 11 Jul 2022 14:55:19 +0200 Subject: [PATCH 1/2] M300: do not set a default frequency if S is not set Fallback to use the default HIGH value if a frequency has not been specified. This makes the tone of "M300" and "M300 P" identical as a result. Supersedes #3339 --- Firmware/Marlin_main.cpp | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index f4611b87..29e757e4 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -7595,18 +7595,11 @@ Sigma_Exit: */ case 300: // M300 { - uint16_t beepS = code_seen('S') ? code_value() : 110; + uint16_t beepS = code_seen('S') ? code_value() : 0; uint16_t beepP = code_seen('P') ? code_value() : 1000; - if (beepS > 0) - { - #if BEEPER > 0 - Sound_MakeCustom(beepP,beepS,false); - #endif - } - else - { - _delay(beepP); - } + #if BEEPER > 0 + Sound_MakeCustom(beepP,beepS,false); + #endif } break; #endif // M300 From 3ed3f87db61fe7393eca1b038930265405324787 Mon Sep 17 00:00:00 2001 From: Alex Voinea Date: Tue, 12 Jul 2022 09:57:56 +0300 Subject: [PATCH 2/2] Prevent beeps when P is 0 --- Firmware/Marlin_main.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 29e757e4..e2069d20 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -7598,6 +7598,7 @@ Sigma_Exit: uint16_t beepS = code_seen('S') ? code_value() : 0; uint16_t beepP = code_seen('P') ? code_value() : 1000; #if BEEPER > 0 + if (beepP > 0) Sound_MakeCustom(beepP,beepS,false); #endif }