Skip to content

Commit

Permalink
✨ STARTUP_TUNE option
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead committed Apr 15, 2023
1 parent 756fd1b commit d77e921
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
5 changes: 5 additions & 0 deletions Marlin/src/MarlinCore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1660,6 +1660,11 @@ void setup() {

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.");

TERN_(MARLIN_TEST_BUILD, runStartupTests());
Expand Down
7 changes: 5 additions & 2 deletions Marlin/src/gcode/lcd/M300.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,13 @@
#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() {
uint16_t const frequency = parser.ushortval('S', 260);
const uint16_t frequency = parser.ushortval('S', 260);
uint16_t duration = parser.ushortval('P', 1000);

// Limits the tone duration to 0-5 seconds.
Expand Down

1 comment on commit d77e921

@landodragon141
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be better to name this STARTUP_TONE so it doesn't get confused as a calibration feature?

Please sign in to comment.