Skip to content

Commit

Permalink
marlin cannot do any pin write in the global variable constructors, b…
Browse files Browse the repository at this point in the history
…ecause global var init runs before the FastIO setup function call!
  • Loading branch information
rhapsodyv committed Sep 30, 2020
1 parent 88d7f4d commit 25443e4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions Marlin/src/MarlinCore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1048,6 +1048,9 @@ 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 pins
TERN_(USE_BEEPER, buzzer.init());

// Set up LEDs early
#if HAS_COLOR_LEDS
SETUP_RUN(leds.setup());
Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/libs/buzzer.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,9 @@

public:
/**
* @brief Class constructor
* @brief Init Buzzer
*/
Buzzer() {
static inline void init() {
SET_OUTPUT(BEEPER_PIN);
reset();
}
Expand Down

0 comments on commit 25443e4

Please sign in to comment.