From 46c8775542c0ba474c7b2bca7d03beef21b9d4ef Mon Sep 17 00:00:00 2001 From: Victor Oliveira Date: Wed, 30 Sep 2020 22:14:19 -0300 Subject: [PATCH] Fix Buzzer (pin) init for uninitialized FastIO (#19559) --- Marlin/src/MarlinCore.cpp | 5 +++++ Marlin/src/libs/buzzer.h | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Marlin/src/MarlinCore.cpp b/Marlin/src/MarlinCore.cpp index 8a425510c..672858d05 100644 --- a/Marlin/src/MarlinCore.cpp +++ b/Marlin/src/MarlinCore.cpp @@ -1048,6 +1048,11 @@ void setup() { SERIAL_ECHO_MSG("Compiled: " __DATE__); SERIAL_ECHO_MSG(STR_FREE_MEMORY, freeMemory(), STR_PLANNER_BUFFER_BYTES, (int)sizeof(block_t) * (BLOCK_BUFFER_SIZE)); + // Init buzzer pin(s) + #if USE_BEEPER + SETUP_RUN(buzzer.init()); + #endif + // Set up LEDs early #if HAS_COLOR_LEDS SETUP_RUN(leds.setup()); diff --git a/Marlin/src/libs/buzzer.h b/Marlin/src/libs/buzzer.h index 022d94dea..e901660c8 100644 --- a/Marlin/src/libs/buzzer.h +++ b/Marlin/src/libs/buzzer.h @@ -84,9 +84,9 @@ public: /** - * @brief Class constructor + * @brief Init Buzzer */ - Buzzer() { + static inline void init() { SET_OUTPUT(BEEPER_PIN); reset(); }