Skip to content

Commit 42c62ff

Browse files
committed
✨ STARTUP_TUNE configuration
1 parent cc3a355 commit 42c62ff

File tree

4 files changed

+26
-3
lines changed

4 files changed

+26
-3
lines changed

Marlin/Configuration.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2681,6 +2681,18 @@
26812681
//#define LCD_FEEDBACK_FREQUENCY_DURATION_MS 2
26822682
//#define LCD_FEEDBACK_FREQUENCY_HZ 5000
26832683

2684+
//
2685+
// Tone queue size, used to keep beeps from blocking execution.
2686+
// Default is 4, or override here. Costs 4 bytes of SRAM per entry.
2687+
//
2688+
//#define TONE_QUEUE_LENGTH 4
2689+
2690+
//
2691+
// A sequence of tones to play at startup, in pairs of tone (Hz), duration (ms).
2692+
// Silence in-between tones.
2693+
//
2694+
//#define STARTUP_TUNE { 698, 300, 0, 50, 523, 50, 0, 25, 494, 50, 0, 25, 523, 100, 0, 50, 554, 300, 0, 100, 523, 300 }
2695+
26842696
//=============================================================================
26852697
//======================== LCD / Controller Selection =========================
26862698
//======================== (Character-based LCDs) =========================

Marlin/src/MarlinCore.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1660,9 +1660,10 @@ void setup() {
16601660

16611661
marlin_state = MF_RUNNING;
16621662

1663-
#if ENABLED(SPEAKER) && defined(STARTUP_TUNE)
1663+
#ifdef STARTUP_TUNE
1664+
// Play a short startup tune before continuing.
16641665
constexpr uint16_t tune[] = STARTUP_TUNE;
1665-
for (uint8_t i = 0; i < COUNT(tune); i += 2) BUZZ(tune[i + 1], tune[i]);
1666+
for (uint8_t i = 0; i < COUNT(tune) - 1; i += 2) BUZZ(tune[i + 1], tune[i]);
16661667
#endif
16671668

16681669
SETUP_LOG("setup() completed.");

Marlin/src/inc/SanityCheck.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3324,6 +3324,16 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE, "Movement bounds (X_MIN_POS, X_MAX_POS
33243324
#endif
33253325
#endif
33263326

3327+
// Startup Tune requirements
3328+
#ifdef STARTUP_TUNE
3329+
#if EITHER(ANYCUBIC_LCD_CHIRON, ANYCUBIC_LCD_VYPER)
3330+
#error "STARTUP_TUNE should be disabled with ANYCUBIC_LCD_CHIRON or ANYCUBIC_LCD_VYPER."
3331+
#elif !(BOTH(HAS_BEEPER, SPEAKER) || USE_MARLINUI_BUZZER)
3332+
#error "STARTUP_TUNE requires a BEEPER_PIN with SPEAKER or USE_MARLINUI_BUZZER."
3333+
#undef STARTUP_TUNE
3334+
#endif
3335+
#endif
3336+
33273337
/**
33283338
* Display Sleep is not supported by these common displays
33293339
*/

buildroot/tests/NUCLEO_F767ZI

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ set -e
1111
#
1212
restore_configs
1313
opt_set MOTHERBOARD BOARD_NUCLEO_F767ZI SERIAL_PORT -1 X_DRIVER_TYPE TMC2209 Y_DRIVER_TYPE TMC2208
14-
opt_enable BLTOUCH Z_SAFE_HOMING SPEAKER SOFTWARE_DRIVER_ENABLE
14+
opt_enable BLTOUCH Z_SAFE_HOMING REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER SPEAKER STARTUP_TUNE SOFTWARE_DRIVER_ENABLE
1515
exec_test $1 $2 "Mixed timer usage" "$3"
1616

1717
# clean up

0 commit comments

Comments
 (0)