Expose: Homing Validation and Endstop Noise Threshold (#11912)
This commit is contained in:
@ -45,7 +45,7 @@ volatile uint8_t Endstops::hit_state;
|
||||
|
||||
Endstops::esbits_t Endstops::live_state = 0;
|
||||
|
||||
#if ENABLED(ENDSTOP_NOISE_FILTER)
|
||||
#if ENDSTOP_NOISE_THRESHOLD
|
||||
Endstops::esbits_t Endstops::validated_live_state;
|
||||
uint8_t Endstops::endstop_poll_count;
|
||||
#endif
|
||||
@ -479,7 +479,7 @@ void _O2 Endstops::M119() {
|
||||
// Check endstops - Could be called from Temperature ISR!
|
||||
void Endstops::update() {
|
||||
|
||||
#if DISABLED(ENDSTOP_NOISE_FILTER)
|
||||
#if !ENDSTOP_NOISE_THRESHOLD
|
||||
if (!abort_enabled()) return;
|
||||
#endif
|
||||
|
||||
@ -622,7 +622,8 @@ void Endstops::update() {
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if ENABLED(ENDSTOP_NOISE_FILTER)
|
||||
#if ENDSTOP_NOISE_THRESHOLD
|
||||
|
||||
/**
|
||||
* Filtering out noise on endstops requires a delayed decision. Let's assume, due to noise,
|
||||
* that 50% of endstop signal samples are good and 50% are bad (assuming normal distribution
|
||||
@ -635,7 +636,7 @@ void Endstops::update() {
|
||||
*/
|
||||
static esbits_t old_live_state;
|
||||
if (old_live_state != live_state) {
|
||||
endstop_poll_count = 7;
|
||||
endstop_poll_count = ENDSTOP_NOISE_THRESHOLD;
|
||||
old_live_state = live_state;
|
||||
}
|
||||
else if (endstop_poll_count && !--endstop_poll_count)
|
||||
|
@ -30,8 +30,6 @@
|
||||
#include "../inc/MarlinConfig.h"
|
||||
#include <stdint.h>
|
||||
|
||||
#define VALIDATE_HOMING_ENDSTOPS
|
||||
|
||||
enum EndstopEnum : char {
|
||||
X_MIN,
|
||||
Y_MIN,
|
||||
@ -77,7 +75,7 @@ class Endstops {
|
||||
static esbits_t live_state;
|
||||
static volatile uint8_t hit_state; // Use X_MIN, Y_MIN, Z_MIN and Z_MIN_PROBE as BIT index
|
||||
|
||||
#if ENABLED(ENDSTOP_NOISE_FILTER)
|
||||
#if ENDSTOP_NOISE_THRESHOLD
|
||||
static esbits_t validated_live_state;
|
||||
static uint8_t endstop_poll_count; // Countdown from threshold for polling
|
||||
#endif
|
||||
@ -123,7 +121,7 @@ class Endstops {
|
||||
*/
|
||||
FORCE_INLINE static esbits_t state() {
|
||||
return
|
||||
#if ENABLED(ENDSTOP_NOISE_FILTER)
|
||||
#if ENDSTOP_NOISE_THRESHOLD
|
||||
validated_live_state
|
||||
#else
|
||||
live_state
|
||||
|
Reference in New Issue
Block a user