From 6deb88102bbc52f7c8bbbff456b0cad3f0e2c2f2 Mon Sep 17 00:00:00 2001 From: David Ramiro Date: Mon, 25 Mar 2019 19:15:28 +0100 Subject: [PATCH] Add optional endstop beeps Enable ENDSTOP_BEEP in Configuration.h to enable a 2KHz beep when endstops are hit. Disabled by default. --- Marlin/Configuration.h | 7 +++++++ Marlin/Marlin_main.cpp | 23 +++++++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index 8c488f6..7a5b278 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -1526,6 +1526,13 @@ // //#define STARTUP_CHIME +// +// ENDSTOP BEEP +// +// Short 2KHz beep when endstops are hit +// +//#define ENDSTOP_BEEP + // // The duration and frequency for the UI feedback sound. // Set these to 0 to disable audio feedback in the LCD menus. diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 6611bc9..1192126 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -14815,6 +14815,25 @@ void disable_all_steppers() { disable_e_steppers(); } +#ifdef ENDSTOP_BEEP + void EndstopBeep() { + static char last_status=((READ(X_MIN_PIN)<<2)|(READ(Y_MIN_PIN)<<1)|READ(X_MAX_PIN)); + static unsigned char now_status; + + now_status=((READ(X_MIN_PIN)<<2)|(READ(Y_MIN_PIN)<<1)|READ(X_MAX_PIN))&0xff; + + if(now_status