From 8910bb7c97688263338b72a57486b69cdff31303 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Tue, 4 Oct 2016 21:31:50 -0500 Subject: [PATCH] Fix buzzer conditional compile --- Marlin/Marlin.h | 2 +- Marlin/Marlin_main.cpp | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/Marlin/Marlin.h b/Marlin/Marlin.h index b890b6a27..49aab9cf9 100644 --- a/Marlin/Marlin.h +++ b/Marlin/Marlin.h @@ -395,7 +395,7 @@ extern uint8_t active_extruder; void calculate_volumetric_multipliers(); // Buzzer -#if HAS_BUZZER && PIN_EXISTS(BEEPER) +#if HAS_BUZZER && DISABLED(LCD_USE_I2C_BUZZER) #include "buzzer.h" #endif diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 038f69c90..83013c4b6 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -387,7 +387,7 @@ static millis_t stepper_inactive_time = (DEFAULT_STEPPER_DEACTIVE_TIME) * 1000UL // Buzzer - I2C on the LCD or a BEEPER_PIN #if ENABLED(LCD_USE_I2C_BUZZER) #define BUZZ(d,f) lcd_buzz(d, f) -#elif HAS_BUZZER +#elif PIN_EXISTS(BEEPER) Buzzer buzzer; #define BUZZ(d,f) buzzer.tone(d, f) #else @@ -6717,7 +6717,7 @@ inline void gcode_M503() { delay(100); #if HAS_BUZZER - millis_t next_tick = 0; + millis_t next_buzz = 0; #endif // Wait for filament insert by user and press button @@ -6726,9 +6726,9 @@ inline void gcode_M503() { while (!lcd_clicked()) { #if HAS_BUZZER millis_t ms = millis(); - if (ms >= next_tick) { + if (ms >= next_buzz) { BUZZ(300, 2000); - next_tick = ms + 2500; // Beep every 2.5s while waiting + next_buzz = ms + 2500; // Beep every 2.5s while waiting } #endif idle(true); @@ -8858,6 +8858,7 @@ void prepare_move_to_destination() { float mm_of_travel = HYPOT(angular_travel * radius, fabs(linear_travel)); if (mm_of_travel < 0.001) return; + uint16_t segments = floor(mm_of_travel / (MM_PER_ARC_SEGMENT)); if (segments == 0) segments = 1; @@ -9428,7 +9429,7 @@ void idle( print_job_timer.tick(); #endif - #if HAS_BUZZER && PIN_EXISTS(BEEPER) + #if HAS_BUZZER && DISABLED(LCD_USE_I2C_BUZZER) buzzer.tick(); #endif }