Add optional endstop beeps
Enable ENDSTOP_BEEP in Configuration.h to enable a 2KHz beep when endstops are hit. Disabled by default.
This commit is contained in:
parent
3f19385e03
commit
6deb88102b
|
@ -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.
|
||||
|
|
|
@ -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<last_status) {
|
||||
static millis_t endstop_ms = millis() + 300UL;
|
||||
if (ELAPSED(millis(), endstop_ms)) {
|
||||
buzzer.tone(60, 2000);
|
||||
}
|
||||
last_status=now_status;
|
||||
} else if(now_status!=last_status) {
|
||||
last_status=now_status;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Manage several activities:
|
||||
* - Check for Filament Runout
|
||||
|
@ -15041,6 +15060,10 @@ void idle(
|
|||
AnycubicTFT.CommandScan();
|
||||
#endif
|
||||
|
||||
#ifdef ENDSTOP_BEEP
|
||||
EndstopBeep();
|
||||
#endif
|
||||
|
||||
lcd_update();
|
||||
|
||||
host_keepalive();
|
||||
|
|
Loading…
Reference in New Issue