mirror of
https://github.com/MarlinFirmware/Marlin.git
synced 2025-03-01 04:17:02 +00:00
✨ STARTUP_TUNE option
This commit is contained in:
parent
756fd1b9ac
commit
d77e921a15
2 changed files with 10 additions and 2 deletions
Marlin/src
|
@ -1660,6 +1660,11 @@ void setup() {
|
||||||
|
|
||||||
marlin_state = MF_RUNNING;
|
marlin_state = MF_RUNNING;
|
||||||
|
|
||||||
|
#if ENABLED(SPEAKER) && defined(STARTUP_TUNE)
|
||||||
|
constexpr uint16_t tune[] = STARTUP_TUNE;
|
||||||
|
for (uint8_t i = 0; i < COUNT(tune); i += 2) BUZZ(tune[i + 1], tune[i]);
|
||||||
|
#endif
|
||||||
|
|
||||||
SETUP_LOG("setup() completed.");
|
SETUP_LOG("setup() completed.");
|
||||||
|
|
||||||
TERN_(MARLIN_TEST_BUILD, runStartupTests());
|
TERN_(MARLIN_TEST_BUILD, runStartupTests());
|
||||||
|
|
|
@ -30,10 +30,13 @@
|
||||||
#include "../../libs/buzzer.h" // Buzzer, if possible
|
#include "../../libs/buzzer.h" // Buzzer, if possible
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* M300: Play beep sound S<frequency Hz> P<duration ms>
|
* M300: Play a Tone / Add a tone to the queue
|
||||||
|
*
|
||||||
|
* S<frequency> - (Hz) The frequency of the tone. 0 for silence.
|
||||||
|
* P<duration> - (ms) The duration of the tone.
|
||||||
*/
|
*/
|
||||||
void GcodeSuite::M300() {
|
void GcodeSuite::M300() {
|
||||||
uint16_t const frequency = parser.ushortval('S', 260);
|
const uint16_t frequency = parser.ushortval('S', 260);
|
||||||
uint16_t duration = parser.ushortval('P', 1000);
|
uint16_t duration = parser.ushortval('P', 1000);
|
||||||
|
|
||||||
// Limits the tone duration to 0-5 seconds.
|
// Limits the tone duration to 0-5 seconds.
|
||||||
|
|
Loading…
Reference in a new issue