diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index e508b38dba..6b1d9af16c 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -554,6 +554,23 @@ // This will remove the need to poll the interrupt pins, saving many CPU cycles. //#define ENDSTOP_INTERRUPTS_FEATURE +/** + * Endstop Noise Filter + * + * Enable this option if endstops falsely trigger due to noise. + * NOTE: Enabling this feature means adds an error of +/-0.2mm, so homing + * will end up at a slightly different position on each G28. This will also + * reduce accuracy of some bed probes. + * For mechanical switches, the better approach to reduce noise is to install + * a 100 nanofarads ceramic capacitor in parallel with the switch, making it + * essentially noise-proof without sacrificing accuracy. + * This option also increases MCU load when endstops or the probe are enabled. + * So this is not recommended. USE AT YOUR OWN RISK. + * (This feature is not required for common micro-switches mounted on PCBs + * based on the Makerbot design, since they already include the 100nF capacitor.) + */ +//#define ENDSTOP_NOISE_FILTER + //============================================================================= //============================== Movement Settings ============================ //============================================================================= diff --git a/Marlin/src/config/default/Configuration.h b/Marlin/src/config/default/Configuration.h index e508b38dba..6b1d9af16c 100644 --- a/Marlin/src/config/default/Configuration.h +++ b/Marlin/src/config/default/Configuration.h @@ -554,6 +554,23 @@ // This will remove the need to poll the interrupt pins, saving many CPU cycles. //#define ENDSTOP_INTERRUPTS_FEATURE +/** + * Endstop Noise Filter + * + * Enable this option if endstops falsely trigger due to noise. + * NOTE: Enabling this feature means adds an error of +/-0.2mm, so homing + * will end up at a slightly different position on each G28. This will also + * reduce accuracy of some bed probes. + * For mechanical switches, the better approach to reduce noise is to install + * a 100 nanofarads ceramic capacitor in parallel with the switch, making it + * essentially noise-proof without sacrificing accuracy. + * This option also increases MCU load when endstops or the probe are enabled. + * So this is not recommended. USE AT YOUR OWN RISK. + * (This feature is not required for common micro-switches mounted on PCBs + * based on the Makerbot design, since they already include the 100nF capacitor.) + */ +//#define ENDSTOP_NOISE_FILTER + //============================================================================= //============================== Movement Settings ============================ //============================================================================= diff --git a/Marlin/src/config/examples/AlephObjects/TAZ4/Configuration.h b/Marlin/src/config/examples/AlephObjects/TAZ4/Configuration.h index c52b65eda1..a8e4b3358e 100644 --- a/Marlin/src/config/examples/AlephObjects/TAZ4/Configuration.h +++ b/Marlin/src/config/examples/AlephObjects/TAZ4/Configuration.h @@ -573,6 +573,23 @@ // This will remove the need to poll the interrupt pins, saving many CPU cycles. //#define ENDSTOP_INTERRUPTS_FEATURE +/** + * Endstop Noise Filter + * + * Enable this option if endstops falsely trigger due to noise. + * NOTE: Enabling this feature means adds an error of +/-0.2mm, so homing + * will end up at a slightly different position on each G28. This will also + * reduce accuracy of some bed probes. + * For mechanical switches, the better approach to reduce noise is to install + * a 100 nanofarads ceramic capacitor in parallel with the switch, making it + * essentially noise-proof without sacrificing accuracy. + * This option also increases MCU load when endstops or the probe are enabled. + * So this is not recommended. USE AT YOUR OWN RISK. + * (This feature is not required for common micro-switches mounted on PCBs + * based on the Makerbot design, since they already include the 100nF capacitor.) + */ +//#define ENDSTOP_NOISE_FILTER + //============================================================================= //============================== Movement Settings ============================ //============================================================================= diff --git a/Marlin/src/config/examples/AliExpress/CL-260/Configuration.h b/Marlin/src/config/examples/AliExpress/CL-260/Configuration.h index fb94ca04d6..fb66dc559b 100644 --- a/Marlin/src/config/examples/AliExpress/CL-260/Configuration.h +++ b/Marlin/src/config/examples/AliExpress/CL-260/Configuration.h @@ -553,6 +553,23 @@ // This will remove the need to poll the interrupt pins, saving many CPU cycles. //#define ENDSTOP_INTERRUPTS_FEATURE +/** + * Endstop Noise Filter + * + * Enable this option if endstops falsely trigger due to noise. + * NOTE: Enabling this feature means adds an error of +/-0.2mm, so homing + * will end up at a slightly different position on each G28. This will also + * reduce accuracy of some bed probes. + * For mechanical switches, the better approach to reduce noise is to install + * a 100 nanofarads ceramic capacitor in parallel with the switch, making it + * essentially noise-proof without sacrificing accuracy. + * This option also increases MCU load when endstops or the probe are enabled. + * So this is not recommended. USE AT YOUR OWN RISK. + * (This feature is not required for common micro-switches mounted on PCBs + * based on the Makerbot design, since they already include the 100nF capacitor.) + */ +//#define ENDSTOP_NOISE_FILTER + //============================================================================= //============================== Movement Settings ============================ //============================================================================= diff --git a/Marlin/src/config/examples/Anet/A6/Configuration.h b/Marlin/src/config/examples/Anet/A6/Configuration.h index 2f45bc625e..9bdab4f1eb 100644 --- a/Marlin/src/config/examples/Anet/A6/Configuration.h +++ b/Marlin/src/config/examples/Anet/A6/Configuration.h @@ -573,6 +573,23 @@ // This will remove the need to poll the interrupt pins, saving many CPU cycles. #define ENDSTOP_INTERRUPTS_FEATURE +/** + * Endstop Noise Filter + * + * Enable this option if endstops falsely trigger due to noise. + * NOTE: Enabling this feature means adds an error of +/-0.2mm, so homing + * will end up at a slightly different position on each G28. This will also + * reduce accuracy of some bed probes. + * For mechanical switches, the better approach to reduce noise is to install + * a 100 nanofarads ceramic capacitor in parallel with the switch, making it + * essentially noise-proof without sacrificing accuracy. + * This option also increases MCU load when endstops or the probe are enabled. + * So this is not recommended. USE AT YOUR OWN RISK. + * (This feature is not required for common micro-switches mounted on PCBs + * based on the Makerbot design, since they already include the 100nF capacitor.) + */ +//#define ENDSTOP_NOISE_FILTER + //============================================================================= //============================== Movement Settings ============================ //============================================================================= diff --git a/Marlin/src/config/examples/Anet/A8/Configuration.h b/Marlin/src/config/examples/Anet/A8/Configuration.h index 98a7b69fc4..19b0ee6eb1 100644 --- a/Marlin/src/config/examples/Anet/A8/Configuration.h +++ b/Marlin/src/config/examples/Anet/A8/Configuration.h @@ -560,6 +560,23 @@ // This will remove the need to poll the interrupt pins, saving many CPU cycles. #define ENDSTOP_INTERRUPTS_FEATURE +/** + * Endstop Noise Filter + * + * Enable this option if endstops falsely trigger due to noise. + * NOTE: Enabling this feature means adds an error of +/-0.2mm, so homing + * will end up at a slightly different position on each G28. This will also + * reduce accuracy of some bed probes. + * For mechanical switches, the better approach to reduce noise is to install + * a 100 nanofarads ceramic capacitor in parallel with the switch, making it + * essentially noise-proof without sacrificing accuracy. + * This option also increases MCU load when endstops or the probe are enabled. + * So this is not recommended. USE AT YOUR OWN RISK. + * (This feature is not required for common micro-switches mounted on PCBs + * based on the Makerbot design, since they already include the 100nF capacitor.) + */ +//#define ENDSTOP_NOISE_FILTER + //============================================================================= //============================== Movement Settings ============================ //============================================================================= diff --git a/Marlin/src/config/examples/Azteeg/X5GT/Configuration.h b/Marlin/src/config/examples/Azteeg/X5GT/Configuration.h index d8f6182807..4f57560b0d 100644 --- a/Marlin/src/config/examples/Azteeg/X5GT/Configuration.h +++ b/Marlin/src/config/examples/Azteeg/X5GT/Configuration.h @@ -553,6 +553,23 @@ // This will remove the need to poll the interrupt pins, saving many CPU cycles. //#define ENDSTOP_INTERRUPTS_FEATURE +/** + * Endstop Noise Filter + * + * Enable this option if endstops falsely trigger due to noise. + * NOTE: Enabling this feature means adds an error of +/-0.2mm, so homing + * will end up at a slightly different position on each G28. This will also + * reduce accuracy of some bed probes. + * For mechanical switches, the better approach to reduce noise is to install + * a 100 nanofarads ceramic capacitor in parallel with the switch, making it + * essentially noise-proof without sacrificing accuracy. + * This option also increases MCU load when endstops or the probe are enabled. + * So this is not recommended. USE AT YOUR OWN RISK. + * (This feature is not required for common micro-switches mounted on PCBs + * based on the Makerbot design, since they already include the 100nF capacitor.) + */ +//#define ENDSTOP_NOISE_FILTER + //============================================================================= //============================== Movement Settings ============================ //============================================================================= diff --git a/Marlin/src/config/examples/BIBO/TouchX/cyclops/Configuration.h b/Marlin/src/config/examples/BIBO/TouchX/cyclops/Configuration.h index abdaad362d..f9052c0420 100644 --- a/Marlin/src/config/examples/BIBO/TouchX/cyclops/Configuration.h +++ b/Marlin/src/config/examples/BIBO/TouchX/cyclops/Configuration.h @@ -553,6 +553,23 @@ // This will remove the need to poll the interrupt pins, saving many CPU cycles. //#define ENDSTOP_INTERRUPTS_FEATURE +/** + * Endstop Noise Filter + * + * Enable this option if endstops falsely trigger due to noise. + * NOTE: Enabling this feature means adds an error of +/-0.2mm, so homing + * will end up at a slightly different position on each G28. This will also + * reduce accuracy of some bed probes. + * For mechanical switches, the better approach to reduce noise is to install + * a 100 nanofarads ceramic capacitor in parallel with the switch, making it + * essentially noise-proof without sacrificing accuracy. + * This option also increases MCU load when endstops or the probe are enabled. + * So this is not recommended. USE AT YOUR OWN RISK. + * (This feature is not required for common micro-switches mounted on PCBs + * based on the Makerbot design, since they already include the 100nF capacitor.) + */ +//#define ENDSTOP_NOISE_FILTER + //============================================================================= //============================== Movement Settings ============================ //============================================================================= diff --git a/Marlin/src/config/examples/BIBO/TouchX/default/Configuration.h b/Marlin/src/config/examples/BIBO/TouchX/default/Configuration.h index 3425d6a144..09af2c566d 100644 --- a/Marlin/src/config/examples/BIBO/TouchX/default/Configuration.h +++ b/Marlin/src/config/examples/BIBO/TouchX/default/Configuration.h @@ -553,6 +553,23 @@ // This will remove the need to poll the interrupt pins, saving many CPU cycles. //#define ENDSTOP_INTERRUPTS_FEATURE +/** + * Endstop Noise Filter + * + * Enable this option if endstops falsely trigger due to noise. + * NOTE: Enabling this feature means adds an error of +/-0.2mm, so homing + * will end up at a slightly different position on each G28. This will also + * reduce accuracy of some bed probes. + * For mechanical switches, the better approach to reduce noise is to install + * a 100 nanofarads ceramic capacitor in parallel with the switch, making it + * essentially noise-proof without sacrificing accuracy. + * This option also increases MCU load when endstops or the probe are enabled. + * So this is not recommended. USE AT YOUR OWN RISK. + * (This feature is not required for common micro-switches mounted on PCBs + * based on the Makerbot design, since they already include the 100nF capacitor.) + */ +//#define ENDSTOP_NOISE_FILTER + //============================================================================= //============================== Movement Settings ============================ //============================================================================= diff --git a/Marlin/src/config/examples/BQ/Hephestos/Configuration.h b/Marlin/src/config/examples/BQ/Hephestos/Configuration.h index a6be3cf5b3..81969b0c8b 100644 --- a/Marlin/src/config/examples/BQ/Hephestos/Configuration.h +++ b/Marlin/src/config/examples/BQ/Hephestos/Configuration.h @@ -541,6 +541,23 @@ // This will remove the need to poll the interrupt pins, saving many CPU cycles. //#define ENDSTOP_INTERRUPTS_FEATURE +/** + * Endstop Noise Filter + * + * Enable this option if endstops falsely trigger due to noise. + * NOTE: Enabling this feature means adds an error of +/-0.2mm, so homing + * will end up at a slightly different position on each G28. This will also + * reduce accuracy of some bed probes. + * For mechanical switches, the better approach to reduce noise is to install + * a 100 nanofarads ceramic capacitor in parallel with the switch, making it + * essentially noise-proof without sacrificing accuracy. + * This option also increases MCU load when endstops or the probe are enabled. + * So this is not recommended. USE AT YOUR OWN RISK. + * (This feature is not required for common micro-switches mounted on PCBs + * based on the Makerbot design, since they already include the 100nF capacitor.) + */ +//#define ENDSTOP_NOISE_FILTER + //============================================================================= //============================== Movement Settings ============================ //============================================================================= diff --git a/Marlin/src/config/examples/BQ/Hephestos_2/Configuration.h b/Marlin/src/config/examples/BQ/Hephestos_2/Configuration.h index 427c32ee86..5a71a968bc 100644 --- a/Marlin/src/config/examples/BQ/Hephestos_2/Configuration.h +++ b/Marlin/src/config/examples/BQ/Hephestos_2/Configuration.h @@ -554,6 +554,23 @@ // This will remove the need to poll the interrupt pins, saving many CPU cycles. #define ENDSTOP_INTERRUPTS_FEATURE +/** + * Endstop Noise Filter + * + * Enable this option if endstops falsely trigger due to noise. + * NOTE: Enabling this feature means adds an error of +/-0.2mm, so homing + * will end up at a slightly different position on each G28. This will also + * reduce accuracy of some bed probes. + * For mechanical switches, the better approach to reduce noise is to install + * a 100 nanofarads ceramic capacitor in parallel with the switch, making it + * essentially noise-proof without sacrificing accuracy. + * This option also increases MCU load when endstops or the probe are enabled. + * So this is not recommended. USE AT YOUR OWN RISK. + * (This feature is not required for common micro-switches mounted on PCBs + * based on the Makerbot design, since they already include the 100nF capacitor.) + */ +//#define ENDSTOP_NOISE_FILTER + //============================================================================= //============================== Movement Settings ============================ //============================================================================= diff --git a/Marlin/src/config/examples/BQ/WITBOX/Configuration.h b/Marlin/src/config/examples/BQ/WITBOX/Configuration.h index e3b3b87217..8e94ff5054 100644 --- a/Marlin/src/config/examples/BQ/WITBOX/Configuration.h +++ b/Marlin/src/config/examples/BQ/WITBOX/Configuration.h @@ -541,6 +541,23 @@ // This will remove the need to poll the interrupt pins, saving many CPU cycles. //#define ENDSTOP_INTERRUPTS_FEATURE +/** + * Endstop Noise Filter + * + * Enable this option if endstops falsely trigger due to noise. + * NOTE: Enabling this feature means adds an error of +/-0.2mm, so homing + * will end up at a slightly different position on each G28. This will also + * reduce accuracy of some bed probes. + * For mechanical switches, the better approach to reduce noise is to install + * a 100 nanofarads ceramic capacitor in parallel with the switch, making it + * essentially noise-proof without sacrificing accuracy. + * This option also increases MCU load when endstops or the probe are enabled. + * So this is not recommended. USE AT YOUR OWN RISK. + * (This feature is not required for common micro-switches mounted on PCBs + * based on the Makerbot design, since they already include the 100nF capacitor.) + */ +//#define ENDSTOP_NOISE_FILTER + //============================================================================= //============================== Movement Settings ============================ //============================================================================= diff --git a/Marlin/src/config/examples/Cartesio/Configuration.h b/Marlin/src/config/examples/Cartesio/Configuration.h index 7a346e80b3..4451a05365 100644 --- a/Marlin/src/config/examples/Cartesio/Configuration.h +++ b/Marlin/src/config/examples/Cartesio/Configuration.h @@ -552,6 +552,23 @@ // This will remove the need to poll the interrupt pins, saving many CPU cycles. //#define ENDSTOP_INTERRUPTS_FEATURE +/** + * Endstop Noise Filter + * + * Enable this option if endstops falsely trigger due to noise. + * NOTE: Enabling this feature means adds an error of +/-0.2mm, so homing + * will end up at a slightly different position on each G28. This will also + * reduce accuracy of some bed probes. + * For mechanical switches, the better approach to reduce noise is to install + * a 100 nanofarads ceramic capacitor in parallel with the switch, making it + * essentially noise-proof without sacrificing accuracy. + * This option also increases MCU load when endstops or the probe are enabled. + * So this is not recommended. USE AT YOUR OWN RISK. + * (This feature is not required for common micro-switches mounted on PCBs + * based on the Makerbot design, since they already include the 100nF capacitor.) + */ +//#define ENDSTOP_NOISE_FILTER + //============================================================================= //============================== Movement Settings ============================ //============================================================================= diff --git a/Marlin/src/config/examples/Creality/CR-10/Configuration.h b/Marlin/src/config/examples/Creality/CR-10/Configuration.h index 78416f875a..d5914b7a72 100755 --- a/Marlin/src/config/examples/Creality/CR-10/Configuration.h +++ b/Marlin/src/config/examples/Creality/CR-10/Configuration.h @@ -563,6 +563,23 @@ // This will remove the need to poll the interrupt pins, saving many CPU cycles. //#define ENDSTOP_INTERRUPTS_FEATURE +/** + * Endstop Noise Filter + * + * Enable this option if endstops falsely trigger due to noise. + * NOTE: Enabling this feature means adds an error of +/-0.2mm, so homing + * will end up at a slightly different position on each G28. This will also + * reduce accuracy of some bed probes. + * For mechanical switches, the better approach to reduce noise is to install + * a 100 nanofarads ceramic capacitor in parallel with the switch, making it + * essentially noise-proof without sacrificing accuracy. + * This option also increases MCU load when endstops or the probe are enabled. + * So this is not recommended. USE AT YOUR OWN RISK. + * (This feature is not required for common micro-switches mounted on PCBs + * based on the Makerbot design, since they already include the 100nF capacitor.) + */ +//#define ENDSTOP_NOISE_FILTER + //============================================================================= //============================== Movement Settings ============================ //============================================================================= diff --git a/Marlin/src/config/examples/Creality/CR-10S/Configuration.h b/Marlin/src/config/examples/Creality/CR-10S/Configuration.h index 46d60f0874..f2b8579558 100644 --- a/Marlin/src/config/examples/Creality/CR-10S/Configuration.h +++ b/Marlin/src/config/examples/Creality/CR-10S/Configuration.h @@ -553,6 +553,23 @@ // This will remove the need to poll the interrupt pins, saving many CPU cycles. //#define ENDSTOP_INTERRUPTS_FEATURE +/** + * Endstop Noise Filter + * + * Enable this option if endstops falsely trigger due to noise. + * NOTE: Enabling this feature means adds an error of +/-0.2mm, so homing + * will end up at a slightly different position on each G28. This will also + * reduce accuracy of some bed probes. + * For mechanical switches, the better approach to reduce noise is to install + * a 100 nanofarads ceramic capacitor in parallel with the switch, making it + * essentially noise-proof without sacrificing accuracy. + * This option also increases MCU load when endstops or the probe are enabled. + * So this is not recommended. USE AT YOUR OWN RISK. + * (This feature is not required for common micro-switches mounted on PCBs + * based on the Makerbot design, since they already include the 100nF capacitor.) + */ +//#define ENDSTOP_NOISE_FILTER + //============================================================================= //============================== Movement Settings ============================ //============================================================================= diff --git a/Marlin/src/config/examples/Creality/CR-10mini/Configuration.h b/Marlin/src/config/examples/Creality/CR-10mini/Configuration.h index f3ebda60d0..37f59c95b9 100644 --- a/Marlin/src/config/examples/Creality/CR-10mini/Configuration.h +++ b/Marlin/src/config/examples/Creality/CR-10mini/Configuration.h @@ -572,6 +572,23 @@ // This will remove the need to poll the interrupt pins, saving many CPU cycles. //#define ENDSTOP_INTERRUPTS_FEATURE +/** + * Endstop Noise Filter + * + * Enable this option if endstops falsely trigger due to noise. + * NOTE: Enabling this feature means adds an error of +/-0.2mm, so homing + * will end up at a slightly different position on each G28. This will also + * reduce accuracy of some bed probes. + * For mechanical switches, the better approach to reduce noise is to install + * a 100 nanofarads ceramic capacitor in parallel with the switch, making it + * essentially noise-proof without sacrificing accuracy. + * This option also increases MCU load when endstops or the probe are enabled. + * So this is not recommended. USE AT YOUR OWN RISK. + * (This feature is not required for common micro-switches mounted on PCBs + * based on the Makerbot design, since they already include the 100nF capacitor.) + */ +//#define ENDSTOP_NOISE_FILTER + //============================================================================= //============================== Movement Settings ============================ //============================================================================= diff --git a/Marlin/src/config/examples/Creality/CR-8/Configuration.h b/Marlin/src/config/examples/Creality/CR-8/Configuration.h index ed51a23df6..5a76ea9366 100644 --- a/Marlin/src/config/examples/Creality/CR-8/Configuration.h +++ b/Marlin/src/config/examples/Creality/CR-8/Configuration.h @@ -563,6 +563,23 @@ // This will remove the need to poll the interrupt pins, saving many CPU cycles. //#define ENDSTOP_INTERRUPTS_FEATURE +/** + * Endstop Noise Filter + * + * Enable this option if endstops falsely trigger due to noise. + * NOTE: Enabling this feature means adds an error of +/-0.2mm, so homing + * will end up at a slightly different position on each G28. This will also + * reduce accuracy of some bed probes. + * For mechanical switches, the better approach to reduce noise is to install + * a 100 nanofarads ceramic capacitor in parallel with the switch, making it + * essentially noise-proof without sacrificing accuracy. + * This option also increases MCU load when endstops or the probe are enabled. + * So this is not recommended. USE AT YOUR OWN RISK. + * (This feature is not required for common micro-switches mounted on PCBs + * based on the Makerbot design, since they already include the 100nF capacitor.) + */ +//#define ENDSTOP_NOISE_FILTER + //============================================================================= //============================== Movement Settings ============================ //============================================================================= diff --git a/Marlin/src/config/examples/Creality/Ender-2/Configuration.h b/Marlin/src/config/examples/Creality/Ender-2/Configuration.h index c7db725e7d..1084e5a567 100644 --- a/Marlin/src/config/examples/Creality/Ender-2/Configuration.h +++ b/Marlin/src/config/examples/Creality/Ender-2/Configuration.h @@ -557,6 +557,23 @@ // This will remove the need to poll the interrupt pins, saving many CPU cycles. //#define ENDSTOP_INTERRUPTS_FEATURE +/** + * Endstop Noise Filter + * + * Enable this option if endstops falsely trigger due to noise. + * NOTE: Enabling this feature means adds an error of +/-0.2mm, so homing + * will end up at a slightly different position on each G28. This will also + * reduce accuracy of some bed probes. + * For mechanical switches, the better approach to reduce noise is to install + * a 100 nanofarads ceramic capacitor in parallel with the switch, making it + * essentially noise-proof without sacrificing accuracy. + * This option also increases MCU load when endstops or the probe are enabled. + * So this is not recommended. USE AT YOUR OWN RISK. + * (This feature is not required for common micro-switches mounted on PCBs + * based on the Makerbot design, since they already include the 100nF capacitor.) + */ +//#define ENDSTOP_NOISE_FILTER + //============================================================================= //============================== Movement Settings ============================ //============================================================================= diff --git a/Marlin/src/config/examples/Creality/Ender-3/Configuration.h b/Marlin/src/config/examples/Creality/Ender-3/Configuration.h index 2f7ef7bd57..e5fc7f569c 100644 --- a/Marlin/src/config/examples/Creality/Ender-3/Configuration.h +++ b/Marlin/src/config/examples/Creality/Ender-3/Configuration.h @@ -557,6 +557,23 @@ // This will remove the need to poll the interrupt pins, saving many CPU cycles. //#define ENDSTOP_INTERRUPTS_FEATURE +/** + * Endstop Noise Filter + * + * Enable this option if endstops falsely trigger due to noise. + * NOTE: Enabling this feature means adds an error of +/-0.2mm, so homing + * will end up at a slightly different position on each G28. This will also + * reduce accuracy of some bed probes. + * For mechanical switches, the better approach to reduce noise is to install + * a 100 nanofarads ceramic capacitor in parallel with the switch, making it + * essentially noise-proof without sacrificing accuracy. + * This option also increases MCU load when endstops or the probe are enabled. + * So this is not recommended. USE AT YOUR OWN RISK. + * (This feature is not required for common micro-switches mounted on PCBs + * based on the Makerbot design, since they already include the 100nF capacitor.) + */ +//#define ENDSTOP_NOISE_FILTER + //============================================================================= //============================== Movement Settings ============================ //============================================================================= diff --git a/Marlin/src/config/examples/Creality/Ender-4/Configuration.h b/Marlin/src/config/examples/Creality/Ender-4/Configuration.h index 1800f019bf..88b333503c 100644 --- a/Marlin/src/config/examples/Creality/Ender-4/Configuration.h +++ b/Marlin/src/config/examples/Creality/Ender-4/Configuration.h @@ -563,6 +563,23 @@ // This will remove the need to poll the interrupt pins, saving many CPU cycles. //#define ENDSTOP_INTERRUPTS_FEATURE +/** + * Endstop Noise Filter + * + * Enable this option if endstops falsely trigger due to noise. + * NOTE: Enabling this feature means adds an error of +/-0.2mm, so homing + * will end up at a slightly different position on each G28. This will also + * reduce accuracy of some bed probes. + * For mechanical switches, the better approach to reduce noise is to install + * a 100 nanofarads ceramic capacitor in parallel with the switch, making it + * essentially noise-proof without sacrificing accuracy. + * This option also increases MCU load when endstops or the probe are enabled. + * So this is not recommended. USE AT YOUR OWN RISK. + * (This feature is not required for common micro-switches mounted on PCBs + * based on the Makerbot design, since they already include the 100nF capacitor.) + */ +//#define ENDSTOP_NOISE_FILTER + //============================================================================= //============================== Movement Settings ============================ //============================================================================= diff --git a/Marlin/src/config/examples/Felix/Configuration.h b/Marlin/src/config/examples/Felix/Configuration.h index 3d910eedf7..3cc412842b 100644 --- a/Marlin/src/config/examples/Felix/Configuration.h +++ b/Marlin/src/config/examples/Felix/Configuration.h @@ -534,6 +534,23 @@ // This will remove the need to poll the interrupt pins, saving many CPU cycles. //#define ENDSTOP_INTERRUPTS_FEATURE +/** + * Endstop Noise Filter + * + * Enable this option if endstops falsely trigger due to noise. + * NOTE: Enabling this feature means adds an error of +/-0.2mm, so homing + * will end up at a slightly different position on each G28. This will also + * reduce accuracy of some bed probes. + * For mechanical switches, the better approach to reduce noise is to install + * a 100 nanofarads ceramic capacitor in parallel with the switch, making it + * essentially noise-proof without sacrificing accuracy. + * This option also increases MCU load when endstops or the probe are enabled. + * So this is not recommended. USE AT YOUR OWN RISK. + * (This feature is not required for common micro-switches mounted on PCBs + * based on the Makerbot design, since they already include the 100nF capacitor.) + */ +//#define ENDSTOP_NOISE_FILTER + //============================================================================= //============================== Movement Settings ============================ //============================================================================= diff --git a/Marlin/src/config/examples/Felix/DUAL/Configuration.h b/Marlin/src/config/examples/Felix/DUAL/Configuration.h index cc102356dd..3fafecf531 100644 --- a/Marlin/src/config/examples/Felix/DUAL/Configuration.h +++ b/Marlin/src/config/examples/Felix/DUAL/Configuration.h @@ -534,6 +534,23 @@ // This will remove the need to poll the interrupt pins, saving many CPU cycles. //#define ENDSTOP_INTERRUPTS_FEATURE +/** + * Endstop Noise Filter + * + * Enable this option if endstops falsely trigger due to noise. + * NOTE: Enabling this feature means adds an error of +/-0.2mm, so homing + * will end up at a slightly different position on each G28. This will also + * reduce accuracy of some bed probes. + * For mechanical switches, the better approach to reduce noise is to install + * a 100 nanofarads ceramic capacitor in parallel with the switch, making it + * essentially noise-proof without sacrificing accuracy. + * This option also increases MCU load when endstops or the probe are enabled. + * So this is not recommended. USE AT YOUR OWN RISK. + * (This feature is not required for common micro-switches mounted on PCBs + * based on the Makerbot design, since they already include the 100nF capacitor.) + */ +//#define ENDSTOP_NOISE_FILTER + //============================================================================= //============================== Movement Settings ============================ //============================================================================= diff --git a/Marlin/src/config/examples/FolgerTech/i3-2020/Configuration.h b/Marlin/src/config/examples/FolgerTech/i3-2020/Configuration.h index 64b334576e..c7e3a278d7 100644 --- a/Marlin/src/config/examples/FolgerTech/i3-2020/Configuration.h +++ b/Marlin/src/config/examples/FolgerTech/i3-2020/Configuration.h @@ -558,6 +558,23 @@ // This will remove the need to poll the interrupt pins, saving many CPU cycles. //#define ENDSTOP_INTERRUPTS_FEATURE +/** + * Endstop Noise Filter + * + * Enable this option if endstops falsely trigger due to noise. + * NOTE: Enabling this feature means adds an error of +/-0.2mm, so homing + * will end up at a slightly different position on each G28. This will also + * reduce accuracy of some bed probes. + * For mechanical switches, the better approach to reduce noise is to install + * a 100 nanofarads ceramic capacitor in parallel with the switch, making it + * essentially noise-proof without sacrificing accuracy. + * This option also increases MCU load when endstops or the probe are enabled. + * So this is not recommended. USE AT YOUR OWN RISK. + * (This feature is not required for common micro-switches mounted on PCBs + * based on the Makerbot design, since they already include the 100nF capacitor.) + */ +//#define ENDSTOP_NOISE_FILTER + //============================================================================= //============================== Movement Settings ============================ //============================================================================= diff --git a/Marlin/src/config/examples/Geeetech/GT2560/Configuration.h b/Marlin/src/config/examples/Geeetech/GT2560/Configuration.h index 683d311f1f..da7d0630a3 100644 --- a/Marlin/src/config/examples/Geeetech/GT2560/Configuration.h +++ b/Marlin/src/config/examples/Geeetech/GT2560/Configuration.h @@ -568,6 +568,23 @@ // This will remove the need to poll the interrupt pins, saving many CPU cycles. //#define ENDSTOP_INTERRUPTS_FEATURE +/** + * Endstop Noise Filter + * + * Enable this option if endstops falsely trigger due to noise. + * NOTE: Enabling this feature means adds an error of +/-0.2mm, so homing + * will end up at a slightly different position on each G28. This will also + * reduce accuracy of some bed probes. + * For mechanical switches, the better approach to reduce noise is to install + * a 100 nanofarads ceramic capacitor in parallel with the switch, making it + * essentially noise-proof without sacrificing accuracy. + * This option also increases MCU load when endstops or the probe are enabled. + * So this is not recommended. USE AT YOUR OWN RISK. + * (This feature is not required for common micro-switches mounted on PCBs + * based on the Makerbot design, since they already include the 100nF capacitor.) + */ +//#define ENDSTOP_NOISE_FILTER + //============================================================================= //============================== Movement Settings ============================ //============================================================================= diff --git a/Marlin/src/config/examples/Geeetech/I3_Pro_X-GT2560/Configuration.h b/Marlin/src/config/examples/Geeetech/I3_Pro_X-GT2560/Configuration.h index c570164ad2..cbcd0bd81a 100644 --- a/Marlin/src/config/examples/Geeetech/I3_Pro_X-GT2560/Configuration.h +++ b/Marlin/src/config/examples/Geeetech/I3_Pro_X-GT2560/Configuration.h @@ -553,6 +553,23 @@ // This will remove the need to poll the interrupt pins, saving many CPU cycles. //#define ENDSTOP_INTERRUPTS_FEATURE +/** + * Endstop Noise Filter + * + * Enable this option if endstops falsely trigger due to noise. + * NOTE: Enabling this feature means adds an error of +/-0.2mm, so homing + * will end up at a slightly different position on each G28. This will also + * reduce accuracy of some bed probes. + * For mechanical switches, the better approach to reduce noise is to install + * a 100 nanofarads ceramic capacitor in parallel with the switch, making it + * essentially noise-proof without sacrificing accuracy. + * This option also increases MCU load when endstops or the probe are enabled. + * So this is not recommended. USE AT YOUR OWN RISK. + * (This feature is not required for common micro-switches mounted on PCBs + * based on the Makerbot design, since they already include the 100nF capacitor.) + */ +//#define ENDSTOP_NOISE_FILTER + //============================================================================= //============================== Movement Settings ============================ //============================================================================= diff --git a/Marlin/src/config/examples/Geeetech/Prusa i3 Pro B/bltouch/Configuration.h b/Marlin/src/config/examples/Geeetech/Prusa i3 Pro B/bltouch/Configuration.h index 7098664ef5..2888626bc5 100644 --- a/Marlin/src/config/examples/Geeetech/Prusa i3 Pro B/bltouch/Configuration.h +++ b/Marlin/src/config/examples/Geeetech/Prusa i3 Pro B/bltouch/Configuration.h @@ -568,6 +568,23 @@ // This will remove the need to poll the interrupt pins, saving many CPU cycles. //#define ENDSTOP_INTERRUPTS_FEATURE +/** + * Endstop Noise Filter + * + * Enable this option if endstops falsely trigger due to noise. + * NOTE: Enabling this feature means adds an error of +/-0.2mm, so homing + * will end up at a slightly different position on each G28. This will also + * reduce accuracy of some bed probes. + * For mechanical switches, the better approach to reduce noise is to install + * a 100 nanofarads ceramic capacitor in parallel with the switch, making it + * essentially noise-proof without sacrificing accuracy. + * This option also increases MCU load when endstops or the probe are enabled. + * So this is not recommended. USE AT YOUR OWN RISK. + * (This feature is not required for common micro-switches mounted on PCBs + * based on the Makerbot design, since they already include the 100nF capacitor.) + */ +//#define ENDSTOP_NOISE_FILTER + //============================================================================= //============================== Movement Settings ============================ //============================================================================= diff --git a/Marlin/src/config/examples/Geeetech/Prusa i3 Pro B/noprobe/Configuration.h b/Marlin/src/config/examples/Geeetech/Prusa i3 Pro B/noprobe/Configuration.h index 212f3b6b56..bee4a97ace 100644 --- a/Marlin/src/config/examples/Geeetech/Prusa i3 Pro B/noprobe/Configuration.h +++ b/Marlin/src/config/examples/Geeetech/Prusa i3 Pro B/noprobe/Configuration.h @@ -568,6 +568,23 @@ // This will remove the need to poll the interrupt pins, saving many CPU cycles. //#define ENDSTOP_INTERRUPTS_FEATURE +/** + * Endstop Noise Filter + * + * Enable this option if endstops falsely trigger due to noise. + * NOTE: Enabling this feature means adds an error of +/-0.2mm, so homing + * will end up at a slightly different position on each G28. This will also + * reduce accuracy of some bed probes. + * For mechanical switches, the better approach to reduce noise is to install + * a 100 nanofarads ceramic capacitor in parallel with the switch, making it + * essentially noise-proof without sacrificing accuracy. + * This option also increases MCU load when endstops or the probe are enabled. + * So this is not recommended. USE AT YOUR OWN RISK. + * (This feature is not required for common micro-switches mounted on PCBs + * based on the Makerbot design, since they already include the 100nF capacitor.) + */ +//#define ENDSTOP_NOISE_FILTER + //============================================================================= //============================== Movement Settings ============================ //============================================================================= diff --git a/Marlin/src/config/examples/Geeetech/Prusa i3 Pro C/Configuration.h b/Marlin/src/config/examples/Geeetech/Prusa i3 Pro C/Configuration.h index 1536eca21a..b5afd1fd3e 100644 --- a/Marlin/src/config/examples/Geeetech/Prusa i3 Pro C/Configuration.h +++ b/Marlin/src/config/examples/Geeetech/Prusa i3 Pro C/Configuration.h @@ -553,6 +553,23 @@ // This will remove the need to poll the interrupt pins, saving many CPU cycles. //#define ENDSTOP_INTERRUPTS_FEATURE +/** + * Endstop Noise Filter + * + * Enable this option if endstops falsely trigger due to noise. + * NOTE: Enabling this feature means adds an error of +/-0.2mm, so homing + * will end up at a slightly different position on each G28. This will also + * reduce accuracy of some bed probes. + * For mechanical switches, the better approach to reduce noise is to install + * a 100 nanofarads ceramic capacitor in parallel with the switch, making it + * essentially noise-proof without sacrificing accuracy. + * This option also increases MCU load when endstops or the probe are enabled. + * So this is not recommended. USE AT YOUR OWN RISK. + * (This feature is not required for common micro-switches mounted on PCBs + * based on the Makerbot design, since they already include the 100nF capacitor.) + */ +//#define ENDSTOP_NOISE_FILTER + //============================================================================= //============================== Movement Settings ============================ //============================================================================= diff --git a/Marlin/src/config/examples/Geeetech/Prusa i3 Pro W/Configuration.h b/Marlin/src/config/examples/Geeetech/Prusa i3 Pro W/Configuration.h index 2b85772f16..12c32b3191 100644 --- a/Marlin/src/config/examples/Geeetech/Prusa i3 Pro W/Configuration.h +++ b/Marlin/src/config/examples/Geeetech/Prusa i3 Pro W/Configuration.h @@ -553,6 +553,23 @@ // This will remove the need to poll the interrupt pins, saving many CPU cycles. //#define ENDSTOP_INTERRUPTS_FEATURE +/** + * Endstop Noise Filter + * + * Enable this option if endstops falsely trigger due to noise. + * NOTE: Enabling this feature means adds an error of +/-0.2mm, so homing + * will end up at a slightly different position on each G28. This will also + * reduce accuracy of some bed probes. + * For mechanical switches, the better approach to reduce noise is to install + * a 100 nanofarads ceramic capacitor in parallel with the switch, making it + * essentially noise-proof without sacrificing accuracy. + * This option also increases MCU load when endstops or the probe are enabled. + * So this is not recommended. USE AT YOUR OWN RISK. + * (This feature is not required for common micro-switches mounted on PCBs + * based on the Makerbot design, since they already include the 100nF capacitor.) + */ +//#define ENDSTOP_NOISE_FILTER + //============================================================================= //============================== Movement Settings ============================ //============================================================================= diff --git a/Marlin/src/config/examples/Infitary/i3-M508/Configuration.h b/Marlin/src/config/examples/Infitary/i3-M508/Configuration.h index 165b5b9807..92e83fd304 100644 --- a/Marlin/src/config/examples/Infitary/i3-M508/Configuration.h +++ b/Marlin/src/config/examples/Infitary/i3-M508/Configuration.h @@ -557,6 +557,23 @@ // This will remove the need to poll the interrupt pins, saving many CPU cycles. //#define ENDSTOP_INTERRUPTS_FEATURE +/** + * Endstop Noise Filter + * + * Enable this option if endstops falsely trigger due to noise. + * NOTE: Enabling this feature means adds an error of +/-0.2mm, so homing + * will end up at a slightly different position on each G28. This will also + * reduce accuracy of some bed probes. + * For mechanical switches, the better approach to reduce noise is to install + * a 100 nanofarads ceramic capacitor in parallel with the switch, making it + * essentially noise-proof without sacrificing accuracy. + * This option also increases MCU load when endstops or the probe are enabled. + * So this is not recommended. USE AT YOUR OWN RISK. + * (This feature is not required for common micro-switches mounted on PCBs + * based on the Makerbot design, since they already include the 100nF capacitor.) + */ +//#define ENDSTOP_NOISE_FILTER + //============================================================================= //============================== Movement Settings ============================ //============================================================================= diff --git a/Marlin/src/config/examples/JGAurora/A5/Configuration.h b/Marlin/src/config/examples/JGAurora/A5/Configuration.h index ab9cd5a27d..62dbe98df3 100644 --- a/Marlin/src/config/examples/JGAurora/A5/Configuration.h +++ b/Marlin/src/config/examples/JGAurora/A5/Configuration.h @@ -565,6 +565,23 @@ // This will remove the need to poll the interrupt pins, saving many CPU cycles. //#define ENDSTOP_INTERRUPTS_FEATURE +/** + * Endstop Noise Filter + * + * Enable this option if endstops falsely trigger due to noise. + * NOTE: Enabling this feature means adds an error of +/-0.2mm, so homing + * will end up at a slightly different position on each G28. This will also + * reduce accuracy of some bed probes. + * For mechanical switches, the better approach to reduce noise is to install + * a 100 nanofarads ceramic capacitor in parallel with the switch, making it + * essentially noise-proof without sacrificing accuracy. + * This option also increases MCU load when endstops or the probe are enabled. + * So this is not recommended. USE AT YOUR OWN RISK. + * (This feature is not required for common micro-switches mounted on PCBs + * based on the Makerbot design, since they already include the 100nF capacitor.) + */ +//#define ENDSTOP_NOISE_FILTER + //============================================================================= //============================== Movement Settings ============================ //============================================================================= diff --git a/Marlin/src/config/examples/MakerParts/Configuration.h b/Marlin/src/config/examples/MakerParts/Configuration.h index baf32ac795..7664d6fabb 100644 --- a/Marlin/src/config/examples/MakerParts/Configuration.h +++ b/Marlin/src/config/examples/MakerParts/Configuration.h @@ -573,6 +573,23 @@ // This will remove the need to poll the interrupt pins, saving many CPU cycles. //#define ENDSTOP_INTERRUPTS_FEATURE +/** + * Endstop Noise Filter + * + * Enable this option if endstops falsely trigger due to noise. + * NOTE: Enabling this feature means adds an error of +/-0.2mm, so homing + * will end up at a slightly different position on each G28. This will also + * reduce accuracy of some bed probes. + * For mechanical switches, the better approach to reduce noise is to install + * a 100 nanofarads ceramic capacitor in parallel with the switch, making it + * essentially noise-proof without sacrificing accuracy. + * This option also increases MCU load when endstops or the probe are enabled. + * So this is not recommended. USE AT YOUR OWN RISK. + * (This feature is not required for common micro-switches mounted on PCBs + * based on the Makerbot design, since they already include the 100nF capacitor.) + */ +//#define ENDSTOP_NOISE_FILTER + //============================================================================= //============================== Movement Settings ============================ //============================================================================= diff --git a/Marlin/src/config/examples/Malyan/M150/Configuration.h b/Marlin/src/config/examples/Malyan/M150/Configuration.h index bb72b8aa18..035352a33b 100644 --- a/Marlin/src/config/examples/Malyan/M150/Configuration.h +++ b/Marlin/src/config/examples/Malyan/M150/Configuration.h @@ -562,6 +562,23 @@ // This will remove the need to poll the interrupt pins, saving many CPU cycles. //#define ENDSTOP_INTERRUPTS_FEATURE +/** + * Endstop Noise Filter + * + * Enable this option if endstops falsely trigger due to noise. + * NOTE: Enabling this feature means adds an error of +/-0.2mm, so homing + * will end up at a slightly different position on each G28. This will also + * reduce accuracy of some bed probes. + * For mechanical switches, the better approach to reduce noise is to install + * a 100 nanofarads ceramic capacitor in parallel with the switch, making it + * essentially noise-proof without sacrificing accuracy. + * This option also increases MCU load when endstops or the probe are enabled. + * So this is not recommended. USE AT YOUR OWN RISK. + * (This feature is not required for common micro-switches mounted on PCBs + * based on the Makerbot design, since they already include the 100nF capacitor.) + */ +//#define ENDSTOP_NOISE_FILTER + //============================================================================= //============================== Movement Settings ============================ //============================================================================= diff --git a/Marlin/src/config/examples/Malyan/M200/Configuration.h b/Marlin/src/config/examples/Malyan/M200/Configuration.h index 4c5fc4a7e1..0976c02976 100644 --- a/Marlin/src/config/examples/Malyan/M200/Configuration.h +++ b/Marlin/src/config/examples/Malyan/M200/Configuration.h @@ -552,6 +552,23 @@ // This will remove the need to poll the interrupt pins, saving many CPU cycles. //#define ENDSTOP_INTERRUPTS_FEATURE +/** + * Endstop Noise Filter + * + * Enable this option if endstops falsely trigger due to noise. + * NOTE: Enabling this feature means adds an error of +/-0.2mm, so homing + * will end up at a slightly different position on each G28. This will also + * reduce accuracy of some bed probes. + * For mechanical switches, the better approach to reduce noise is to install + * a 100 nanofarads ceramic capacitor in parallel with the switch, making it + * essentially noise-proof without sacrificing accuracy. + * This option also increases MCU load when endstops or the probe are enabled. + * So this is not recommended. USE AT YOUR OWN RISK. + * (This feature is not required for common micro-switches mounted on PCBs + * based on the Makerbot design, since they already include the 100nF capacitor.) + */ +//#define ENDSTOP_NOISE_FILTER + //============================================================================= //============================== Movement Settings ============================ //============================================================================= diff --git a/Marlin/src/config/examples/Micromake/C1/basic/Configuration.h b/Marlin/src/config/examples/Micromake/C1/basic/Configuration.h index 6b07e60fd2..d90e98eebd 100644 --- a/Marlin/src/config/examples/Micromake/C1/basic/Configuration.h +++ b/Marlin/src/config/examples/Micromake/C1/basic/Configuration.h @@ -553,6 +553,23 @@ // This will remove the need to poll the interrupt pins, saving many CPU cycles. //#define ENDSTOP_INTERRUPTS_FEATURE +/** + * Endstop Noise Filter + * + * Enable this option if endstops falsely trigger due to noise. + * NOTE: Enabling this feature means adds an error of +/-0.2mm, so homing + * will end up at a slightly different position on each G28. This will also + * reduce accuracy of some bed probes. + * For mechanical switches, the better approach to reduce noise is to install + * a 100 nanofarads ceramic capacitor in parallel with the switch, making it + * essentially noise-proof without sacrificing accuracy. + * This option also increases MCU load when endstops or the probe are enabled. + * So this is not recommended. USE AT YOUR OWN RISK. + * (This feature is not required for common micro-switches mounted on PCBs + * based on the Makerbot design, since they already include the 100nF capacitor.) + */ +//#define ENDSTOP_NOISE_FILTER + //============================================================================= //============================== Movement Settings ============================ //============================================================================= diff --git a/Marlin/src/config/examples/Micromake/C1/enhanced/Configuration.h b/Marlin/src/config/examples/Micromake/C1/enhanced/Configuration.h index 3b5fc8d015..d49c4ee337 100644 --- a/Marlin/src/config/examples/Micromake/C1/enhanced/Configuration.h +++ b/Marlin/src/config/examples/Micromake/C1/enhanced/Configuration.h @@ -553,6 +553,23 @@ // This will remove the need to poll the interrupt pins, saving many CPU cycles. //#define ENDSTOP_INTERRUPTS_FEATURE +/** + * Endstop Noise Filter + * + * Enable this option if endstops falsely trigger due to noise. + * NOTE: Enabling this feature means adds an error of +/-0.2mm, so homing + * will end up at a slightly different position on each G28. This will also + * reduce accuracy of some bed probes. + * For mechanical switches, the better approach to reduce noise is to install + * a 100 nanofarads ceramic capacitor in parallel with the switch, making it + * essentially noise-proof without sacrificing accuracy. + * This option also increases MCU load when endstops or the probe are enabled. + * So this is not recommended. USE AT YOUR OWN RISK. + * (This feature is not required for common micro-switches mounted on PCBs + * based on the Makerbot design, since they already include the 100nF capacitor.) + */ +//#define ENDSTOP_NOISE_FILTER + //============================================================================= //============================== Movement Settings ============================ //============================================================================= diff --git a/Marlin/src/config/examples/Mks/Sbase/Configuration.h b/Marlin/src/config/examples/Mks/Sbase/Configuration.h index 74c86f3d3c..96eeb75816 100644 --- a/Marlin/src/config/examples/Mks/Sbase/Configuration.h +++ b/Marlin/src/config/examples/Mks/Sbase/Configuration.h @@ -553,6 +553,23 @@ // This will remove the need to poll the interrupt pins, saving many CPU cycles. //#define ENDSTOP_INTERRUPTS_FEATURE +/** + * Endstop Noise Filter + * + * Enable this option if endstops falsely trigger due to noise. + * NOTE: Enabling this feature means adds an error of +/-0.2mm, so homing + * will end up at a slightly different position on each G28. This will also + * reduce accuracy of some bed probes. + * For mechanical switches, the better approach to reduce noise is to install + * a 100 nanofarads ceramic capacitor in parallel with the switch, making it + * essentially noise-proof without sacrificing accuracy. + * This option also increases MCU load when endstops or the probe are enabled. + * So this is not recommended. USE AT YOUR OWN RISK. + * (This feature is not required for common micro-switches mounted on PCBs + * based on the Makerbot design, since they already include the 100nF capacitor.) + */ +//#define ENDSTOP_NOISE_FILTER + //============================================================================= //============================== Movement Settings ============================ //============================================================================= diff --git a/Marlin/src/config/examples/RepRapPro/Huxley/Configuration.h b/Marlin/src/config/examples/RepRapPro/Huxley/Configuration.h index 2628e0ebab..083aab24e5 100644 --- a/Marlin/src/config/examples/RepRapPro/Huxley/Configuration.h +++ b/Marlin/src/config/examples/RepRapPro/Huxley/Configuration.h @@ -553,6 +553,23 @@ // This will remove the need to poll the interrupt pins, saving many CPU cycles. //#define ENDSTOP_INTERRUPTS_FEATURE +/** + * Endstop Noise Filter + * + * Enable this option if endstops falsely trigger due to noise. + * NOTE: Enabling this feature means adds an error of +/-0.2mm, so homing + * will end up at a slightly different position on each G28. This will also + * reduce accuracy of some bed probes. + * For mechanical switches, the better approach to reduce noise is to install + * a 100 nanofarads ceramic capacitor in parallel with the switch, making it + * essentially noise-proof without sacrificing accuracy. + * This option also increases MCU load when endstops or the probe are enabled. + * So this is not recommended. USE AT YOUR OWN RISK. + * (This feature is not required for common micro-switches mounted on PCBs + * based on the Makerbot design, since they already include the 100nF capacitor.) + */ +//#define ENDSTOP_NOISE_FILTER + //============================================================================= //============================== Movement Settings ============================ //============================================================================= diff --git a/Marlin/src/config/examples/RepRapWorld/Megatronics/Configuration.h b/Marlin/src/config/examples/RepRapWorld/Megatronics/Configuration.h index 6f54bea041..6d8ba9f6f9 100644 --- a/Marlin/src/config/examples/RepRapWorld/Megatronics/Configuration.h +++ b/Marlin/src/config/examples/RepRapWorld/Megatronics/Configuration.h @@ -553,6 +553,23 @@ // This will remove the need to poll the interrupt pins, saving many CPU cycles. //#define ENDSTOP_INTERRUPTS_FEATURE +/** + * Endstop Noise Filter + * + * Enable this option if endstops falsely trigger due to noise. + * NOTE: Enabling this feature means adds an error of +/-0.2mm, so homing + * will end up at a slightly different position on each G28. This will also + * reduce accuracy of some bed probes. + * For mechanical switches, the better approach to reduce noise is to install + * a 100 nanofarads ceramic capacitor in parallel with the switch, making it + * essentially noise-proof without sacrificing accuracy. + * This option also increases MCU load when endstops or the probe are enabled. + * So this is not recommended. USE AT YOUR OWN RISK. + * (This feature is not required for common micro-switches mounted on PCBs + * based on the Makerbot design, since they already include the 100nF capacitor.) + */ +//#define ENDSTOP_NOISE_FILTER + //============================================================================= //============================== Movement Settings ============================ //============================================================================= diff --git a/Marlin/src/config/examples/RigidBot/Configuration.h b/Marlin/src/config/examples/RigidBot/Configuration.h index 7bdfe1b2b5..1f98d9502f 100644 --- a/Marlin/src/config/examples/RigidBot/Configuration.h +++ b/Marlin/src/config/examples/RigidBot/Configuration.h @@ -549,6 +549,23 @@ // This will remove the need to poll the interrupt pins, saving many CPU cycles. //#define ENDSTOP_INTERRUPTS_FEATURE +/** + * Endstop Noise Filter + * + * Enable this option if endstops falsely trigger due to noise. + * NOTE: Enabling this feature means adds an error of +/-0.2mm, so homing + * will end up at a slightly different position on each G28. This will also + * reduce accuracy of some bed probes. + * For mechanical switches, the better approach to reduce noise is to install + * a 100 nanofarads ceramic capacitor in parallel with the switch, making it + * essentially noise-proof without sacrificing accuracy. + * This option also increases MCU load when endstops or the probe are enabled. + * So this is not recommended. USE AT YOUR OWN RISK. + * (This feature is not required for common micro-switches mounted on PCBs + * based on the Makerbot design, since they already include the 100nF capacitor.) + */ +//#define ENDSTOP_NOISE_FILTER + //============================================================================= //============================== Movement Settings ============================ //============================================================================= diff --git a/Marlin/src/config/examples/SCARA/Configuration.h b/Marlin/src/config/examples/SCARA/Configuration.h index 066d1bf90b..09558a46fb 100644 --- a/Marlin/src/config/examples/SCARA/Configuration.h +++ b/Marlin/src/config/examples/SCARA/Configuration.h @@ -566,6 +566,23 @@ // This will remove the need to poll the interrupt pins, saving many CPU cycles. //#define ENDSTOP_INTERRUPTS_FEATURE +/** + * Endstop Noise Filter + * + * Enable this option if endstops falsely trigger due to noise. + * NOTE: Enabling this feature means adds an error of +/-0.2mm, so homing + * will end up at a slightly different position on each G28. This will also + * reduce accuracy of some bed probes. + * For mechanical switches, the better approach to reduce noise is to install + * a 100 nanofarads ceramic capacitor in parallel with the switch, making it + * essentially noise-proof without sacrificing accuracy. + * This option also increases MCU load when endstops or the probe are enabled. + * So this is not recommended. USE AT YOUR OWN RISK. + * (This feature is not required for common micro-switches mounted on PCBs + * based on the Makerbot design, since they already include the 100nF capacitor.) + */ +//#define ENDSTOP_NOISE_FILTER + //============================================================================= //============================== Movement Settings ============================ //============================================================================= diff --git a/Marlin/src/config/examples/STM32F10/Configuration.h b/Marlin/src/config/examples/STM32F10/Configuration.h index 9ec2439707..7d5dc0da4c 100644 --- a/Marlin/src/config/examples/STM32F10/Configuration.h +++ b/Marlin/src/config/examples/STM32F10/Configuration.h @@ -555,6 +555,23 @@ // This will remove the need to poll the interrupt pins, saving many CPU cycles. //#define ENDSTOP_INTERRUPTS_FEATURE +/** + * Endstop Noise Filter + * + * Enable this option if endstops falsely trigger due to noise. + * NOTE: Enabling this feature means adds an error of +/-0.2mm, so homing + * will end up at a slightly different position on each G28. This will also + * reduce accuracy of some bed probes. + * For mechanical switches, the better approach to reduce noise is to install + * a 100 nanofarads ceramic capacitor in parallel with the switch, making it + * essentially noise-proof without sacrificing accuracy. + * This option also increases MCU load when endstops or the probe are enabled. + * So this is not recommended. USE AT YOUR OWN RISK. + * (This feature is not required for common micro-switches mounted on PCBs + * based on the Makerbot design, since they already include the 100nF capacitor.) + */ +//#define ENDSTOP_NOISE_FILTER + //============================================================================= //============================== Movement Settings ============================ //============================================================================= diff --git a/Marlin/src/config/examples/STM32F4/Configuration.h b/Marlin/src/config/examples/STM32F4/Configuration.h index 7a9c4708ef..ee912830d1 100644 --- a/Marlin/src/config/examples/STM32F4/Configuration.h +++ b/Marlin/src/config/examples/STM32F4/Configuration.h @@ -553,6 +553,23 @@ // This will remove the need to poll the interrupt pins, saving many CPU cycles. //#define ENDSTOP_INTERRUPTS_FEATURE +/** + * Endstop Noise Filter + * + * Enable this option if endstops falsely trigger due to noise. + * NOTE: Enabling this feature means adds an error of +/-0.2mm, so homing + * will end up at a slightly different position on each G28. This will also + * reduce accuracy of some bed probes. + * For mechanical switches, the better approach to reduce noise is to install + * a 100 nanofarads ceramic capacitor in parallel with the switch, making it + * essentially noise-proof without sacrificing accuracy. + * This option also increases MCU load when endstops or the probe are enabled. + * So this is not recommended. USE AT YOUR OWN RISK. + * (This feature is not required for common micro-switches mounted on PCBs + * based on the Makerbot design, since they already include the 100nF capacitor.) + */ +//#define ENDSTOP_NOISE_FILTER + //============================================================================= //============================== Movement Settings ============================ //============================================================================= diff --git a/Marlin/src/config/examples/Sanguinololu/Configuration.h b/Marlin/src/config/examples/Sanguinololu/Configuration.h index c725acd12e..a8f7049c0a 100644 --- a/Marlin/src/config/examples/Sanguinololu/Configuration.h +++ b/Marlin/src/config/examples/Sanguinololu/Configuration.h @@ -553,6 +553,23 @@ // This will remove the need to poll the interrupt pins, saving many CPU cycles. //#define ENDSTOP_INTERRUPTS_FEATURE +/** + * Endstop Noise Filter + * + * Enable this option if endstops falsely trigger due to noise. + * NOTE: Enabling this feature means adds an error of +/-0.2mm, so homing + * will end up at a slightly different position on each G28. This will also + * reduce accuracy of some bed probes. + * For mechanical switches, the better approach to reduce noise is to install + * a 100 nanofarads ceramic capacitor in parallel with the switch, making it + * essentially noise-proof without sacrificing accuracy. + * This option also increases MCU load when endstops or the probe are enabled. + * So this is not recommended. USE AT YOUR OWN RISK. + * (This feature is not required for common micro-switches mounted on PCBs + * based on the Makerbot design, since they already include the 100nF capacitor.) + */ +//#define ENDSTOP_NOISE_FILTER + //============================================================================= //============================== Movement Settings ============================ //============================================================================= diff --git a/Marlin/src/config/examples/TheBorg/Configuration.h b/Marlin/src/config/examples/TheBorg/Configuration.h index 7358b2044f..75781a9f5c 100644 --- a/Marlin/src/config/examples/TheBorg/Configuration.h +++ b/Marlin/src/config/examples/TheBorg/Configuration.h @@ -553,6 +553,23 @@ // This will remove the need to poll the interrupt pins, saving many CPU cycles. //#define ENDSTOP_INTERRUPTS_FEATURE +/** + * Endstop Noise Filter + * + * Enable this option if endstops falsely trigger due to noise. + * NOTE: Enabling this feature means adds an error of +/-0.2mm, so homing + * will end up at a slightly different position on each G28. This will also + * reduce accuracy of some bed probes. + * For mechanical switches, the better approach to reduce noise is to install + * a 100 nanofarads ceramic capacitor in parallel with the switch, making it + * essentially noise-proof without sacrificing accuracy. + * This option also increases MCU load when endstops or the probe are enabled. + * So this is not recommended. USE AT YOUR OWN RISK. + * (This feature is not required for common micro-switches mounted on PCBs + * based on the Makerbot design, since they already include the 100nF capacitor.) + */ +//#define ENDSTOP_NOISE_FILTER + //============================================================================= //============================== Movement Settings ============================ //============================================================================= diff --git a/Marlin/src/config/examples/TinyBoy2/Configuration.h b/Marlin/src/config/examples/TinyBoy2/Configuration.h index 27bc4cf681..b2a08480a7 100644 --- a/Marlin/src/config/examples/TinyBoy2/Configuration.h +++ b/Marlin/src/config/examples/TinyBoy2/Configuration.h @@ -604,6 +604,23 @@ // This will remove the need to poll the interrupt pins, saving many CPU cycles. #define ENDSTOP_INTERRUPTS_FEATURE +/** + * Endstop Noise Filter + * + * Enable this option if endstops falsely trigger due to noise. + * NOTE: Enabling this feature means adds an error of +/-0.2mm, so homing + * will end up at a slightly different position on each G28. This will also + * reduce accuracy of some bed probes. + * For mechanical switches, the better approach to reduce noise is to install + * a 100 nanofarads ceramic capacitor in parallel with the switch, making it + * essentially noise-proof without sacrificing accuracy. + * This option also increases MCU load when endstops or the probe are enabled. + * So this is not recommended. USE AT YOUR OWN RISK. + * (This feature is not required for common micro-switches mounted on PCBs + * based on the Makerbot design, since they already include the 100nF capacitor.) + */ +//#define ENDSTOP_NOISE_FILTER + //============================================================================= //============================== Movement Settings ============================ //============================================================================= diff --git a/Marlin/src/config/examples/Tronxy/X1/Configuration.h b/Marlin/src/config/examples/Tronxy/X1/Configuration.h index 8c8fb0ce6a..124851c2e2 100644 --- a/Marlin/src/config/examples/Tronxy/X1/Configuration.h +++ b/Marlin/src/config/examples/Tronxy/X1/Configuration.h @@ -553,6 +553,23 @@ // This will remove the need to poll the interrupt pins, saving many CPU cycles. //#define ENDSTOP_INTERRUPTS_FEATURE +/** + * Endstop Noise Filter + * + * Enable this option if endstops falsely trigger due to noise. + * NOTE: Enabling this feature means adds an error of +/-0.2mm, so homing + * will end up at a slightly different position on each G28. This will also + * reduce accuracy of some bed probes. + * For mechanical switches, the better approach to reduce noise is to install + * a 100 nanofarads ceramic capacitor in parallel with the switch, making it + * essentially noise-proof without sacrificing accuracy. + * This option also increases MCU load when endstops or the probe are enabled. + * So this is not recommended. USE AT YOUR OWN RISK. + * (This feature is not required for common micro-switches mounted on PCBs + * based on the Makerbot design, since they already include the 100nF capacitor.) + */ +//#define ENDSTOP_NOISE_FILTER + //============================================================================= //============================== Movement Settings ============================ //============================================================================= diff --git a/Marlin/src/config/examples/Tronxy/X5S/Configuration.h b/Marlin/src/config/examples/Tronxy/X5S/Configuration.h index 59ade4e74f..c1b22dfa01 100644 --- a/Marlin/src/config/examples/Tronxy/X5S/Configuration.h +++ b/Marlin/src/config/examples/Tronxy/X5S/Configuration.h @@ -553,6 +553,23 @@ // This will remove the need to poll the interrupt pins, saving many CPU cycles. //#define ENDSTOP_INTERRUPTS_FEATURE +/** + * Endstop Noise Filter + * + * Enable this option if endstops falsely trigger due to noise. + * NOTE: Enabling this feature means adds an error of +/-0.2mm, so homing + * will end up at a slightly different position on each G28. This will also + * reduce accuracy of some bed probes. + * For mechanical switches, the better approach to reduce noise is to install + * a 100 nanofarads ceramic capacitor in parallel with the switch, making it + * essentially noise-proof without sacrificing accuracy. + * This option also increases MCU load when endstops or the probe are enabled. + * So this is not recommended. USE AT YOUR OWN RISK. + * (This feature is not required for common micro-switches mounted on PCBs + * based on the Makerbot design, since they already include the 100nF capacitor.) + */ +//#define ENDSTOP_NOISE_FILTER + //============================================================================= //============================== Movement Settings ============================ //============================================================================= diff --git a/Marlin/src/config/examples/Tronxy/XY100/Configuration.h b/Marlin/src/config/examples/Tronxy/XY100/Configuration.h index 6956b15f98..0e447e0df9 100644 --- a/Marlin/src/config/examples/Tronxy/XY100/Configuration.h +++ b/Marlin/src/config/examples/Tronxy/XY100/Configuration.h @@ -564,6 +564,23 @@ // This will remove the need to poll the interrupt pins, saving many CPU cycles. //#define ENDSTOP_INTERRUPTS_FEATURE +/** + * Endstop Noise Filter + * + * Enable this option if endstops falsely trigger due to noise. + * NOTE: Enabling this feature means adds an error of +/-0.2mm, so homing + * will end up at a slightly different position on each G28. This will also + * reduce accuracy of some bed probes. + * For mechanical switches, the better approach to reduce noise is to install + * a 100 nanofarads ceramic capacitor in parallel with the switch, making it + * essentially noise-proof without sacrificing accuracy. + * This option also increases MCU load when endstops or the probe are enabled. + * So this is not recommended. USE AT YOUR OWN RISK. + * (This feature is not required for common micro-switches mounted on PCBs + * based on the Makerbot design, since they already include the 100nF capacitor.) + */ +//#define ENDSTOP_NOISE_FILTER + //============================================================================= //============================== Movement Settings ============================ //============================================================================= diff --git a/Marlin/src/config/examples/UltiMachine/Archim2/Configuration.h b/Marlin/src/config/examples/UltiMachine/Archim2/Configuration.h index 479b71eca7..66c95d115a 100644 --- a/Marlin/src/config/examples/UltiMachine/Archim2/Configuration.h +++ b/Marlin/src/config/examples/UltiMachine/Archim2/Configuration.h @@ -553,6 +553,23 @@ // This will remove the need to poll the interrupt pins, saving many CPU cycles. //#define ENDSTOP_INTERRUPTS_FEATURE +/** + * Endstop Noise Filter + * + * Enable this option if endstops falsely trigger due to noise. + * NOTE: Enabling this feature means adds an error of +/-0.2mm, so homing + * will end up at a slightly different position on each G28. This will also + * reduce accuracy of some bed probes. + * For mechanical switches, the better approach to reduce noise is to install + * a 100 nanofarads ceramic capacitor in parallel with the switch, making it + * essentially noise-proof without sacrificing accuracy. + * This option also increases MCU load when endstops or the probe are enabled. + * So this is not recommended. USE AT YOUR OWN RISK. + * (This feature is not required for common micro-switches mounted on PCBs + * based on the Makerbot design, since they already include the 100nF capacitor.) + */ +//#define ENDSTOP_NOISE_FILTER + //============================================================================= //============================== Movement Settings ============================ //============================================================================= diff --git a/Marlin/src/config/examples/Velleman/K8200/Configuration.h b/Marlin/src/config/examples/Velleman/K8200/Configuration.h index c9c9dde6e0..b0b4c3efbf 100644 --- a/Marlin/src/config/examples/Velleman/K8200/Configuration.h +++ b/Marlin/src/config/examples/Velleman/K8200/Configuration.h @@ -583,6 +583,23 @@ // This will remove the need to poll the interrupt pins, saving many CPU cycles. //#define ENDSTOP_INTERRUPTS_FEATURE +/** + * Endstop Noise Filter + * + * Enable this option if endstops falsely trigger due to noise. + * NOTE: Enabling this feature means adds an error of +/-0.2mm, so homing + * will end up at a slightly different position on each G28. This will also + * reduce accuracy of some bed probes. + * For mechanical switches, the better approach to reduce noise is to install + * a 100 nanofarads ceramic capacitor in parallel with the switch, making it + * essentially noise-proof without sacrificing accuracy. + * This option also increases MCU load when endstops or the probe are enabled. + * So this is not recommended. USE AT YOUR OWN RISK. + * (This feature is not required for common micro-switches mounted on PCBs + * based on the Makerbot design, since they already include the 100nF capacitor.) + */ +//#define ENDSTOP_NOISE_FILTER + //============================================================================= //============================== Movement Settings ============================ //============================================================================= diff --git a/Marlin/src/config/examples/Velleman/K8400/Configuration.h b/Marlin/src/config/examples/Velleman/K8400/Configuration.h index 4bd6c3168c..11f745d97a 100644 --- a/Marlin/src/config/examples/Velleman/K8400/Configuration.h +++ b/Marlin/src/config/examples/Velleman/K8400/Configuration.h @@ -553,6 +553,23 @@ // This will remove the need to poll the interrupt pins, saving many CPU cycles. //#define ENDSTOP_INTERRUPTS_FEATURE +/** + * Endstop Noise Filter + * + * Enable this option if endstops falsely trigger due to noise. + * NOTE: Enabling this feature means adds an error of +/-0.2mm, so homing + * will end up at a slightly different position on each G28. This will also + * reduce accuracy of some bed probes. + * For mechanical switches, the better approach to reduce noise is to install + * a 100 nanofarads ceramic capacitor in parallel with the switch, making it + * essentially noise-proof without sacrificing accuracy. + * This option also increases MCU load when endstops or the probe are enabled. + * So this is not recommended. USE AT YOUR OWN RISK. + * (This feature is not required for common micro-switches mounted on PCBs + * based on the Makerbot design, since they already include the 100nF capacitor.) + */ +//#define ENDSTOP_NOISE_FILTER + //============================================================================= //============================== Movement Settings ============================ //============================================================================= diff --git a/Marlin/src/config/examples/Velleman/K8400/Dual-head/Configuration.h b/Marlin/src/config/examples/Velleman/K8400/Dual-head/Configuration.h index 85ab7bfdf7..f0d1381639 100644 --- a/Marlin/src/config/examples/Velleman/K8400/Dual-head/Configuration.h +++ b/Marlin/src/config/examples/Velleman/K8400/Dual-head/Configuration.h @@ -553,6 +553,23 @@ // This will remove the need to poll the interrupt pins, saving many CPU cycles. //#define ENDSTOP_INTERRUPTS_FEATURE +/** + * Endstop Noise Filter + * + * Enable this option if endstops falsely trigger due to noise. + * NOTE: Enabling this feature means adds an error of +/-0.2mm, so homing + * will end up at a slightly different position on each G28. This will also + * reduce accuracy of some bed probes. + * For mechanical switches, the better approach to reduce noise is to install + * a 100 nanofarads ceramic capacitor in parallel with the switch, making it + * essentially noise-proof without sacrificing accuracy. + * This option also increases MCU load when endstops or the probe are enabled. + * So this is not recommended. USE AT YOUR OWN RISK. + * (This feature is not required for common micro-switches mounted on PCBs + * based on the Makerbot design, since they already include the 100nF capacitor.) + */ +//#define ENDSTOP_NOISE_FILTER + //============================================================================= //============================== Movement Settings ============================ //============================================================================= diff --git a/Marlin/src/config/examples/Wanhao/Duplicator 6/Configuration.h b/Marlin/src/config/examples/Wanhao/Duplicator 6/Configuration.h index 05509de61f..7c94669a13 100644 --- a/Marlin/src/config/examples/Wanhao/Duplicator 6/Configuration.h +++ b/Marlin/src/config/examples/Wanhao/Duplicator 6/Configuration.h @@ -563,6 +563,23 @@ // This will remove the need to poll the interrupt pins, saving many CPU cycles. //#define ENDSTOP_INTERRUPTS_FEATURE +/** + * Endstop Noise Filter + * + * Enable this option if endstops falsely trigger due to noise. + * NOTE: Enabling this feature means adds an error of +/-0.2mm, so homing + * will end up at a slightly different position on each G28. This will also + * reduce accuracy of some bed probes. + * For mechanical switches, the better approach to reduce noise is to install + * a 100 nanofarads ceramic capacitor in parallel with the switch, making it + * essentially noise-proof without sacrificing accuracy. + * This option also increases MCU load when endstops or the probe are enabled. + * So this is not recommended. USE AT YOUR OWN RISK. + * (This feature is not required for common micro-switches mounted on PCBs + * based on the Makerbot design, since they already include the 100nF capacitor.) + */ +//#define ENDSTOP_NOISE_FILTER + //============================================================================= //============================== Movement Settings ============================ //============================================================================= diff --git a/Marlin/src/config/examples/adafruit/ST7565/Configuration.h b/Marlin/src/config/examples/adafruit/ST7565/Configuration.h index e4d6746a59..7b2a2815f1 100644 --- a/Marlin/src/config/examples/adafruit/ST7565/Configuration.h +++ b/Marlin/src/config/examples/adafruit/ST7565/Configuration.h @@ -553,6 +553,23 @@ // This will remove the need to poll the interrupt pins, saving many CPU cycles. //#define ENDSTOP_INTERRUPTS_FEATURE +/** + * Endstop Noise Filter + * + * Enable this option if endstops falsely trigger due to noise. + * NOTE: Enabling this feature means adds an error of +/-0.2mm, so homing + * will end up at a slightly different position on each G28. This will also + * reduce accuracy of some bed probes. + * For mechanical switches, the better approach to reduce noise is to install + * a 100 nanofarads ceramic capacitor in parallel with the switch, making it + * essentially noise-proof without sacrificing accuracy. + * This option also increases MCU load when endstops or the probe are enabled. + * So this is not recommended. USE AT YOUR OWN RISK. + * (This feature is not required for common micro-switches mounted on PCBs + * based on the Makerbot design, since they already include the 100nF capacitor.) + */ +//#define ENDSTOP_NOISE_FILTER + //============================================================================= //============================== Movement Settings ============================ //============================================================================= diff --git a/Marlin/src/config/examples/delta/FLSUN/auto_calibrate/Configuration.h b/Marlin/src/config/examples/delta/FLSUN/auto_calibrate/Configuration.h index ecc8e71b09..b69e07f4eb 100644 --- a/Marlin/src/config/examples/delta/FLSUN/auto_calibrate/Configuration.h +++ b/Marlin/src/config/examples/delta/FLSUN/auto_calibrate/Configuration.h @@ -626,6 +626,23 @@ // This will remove the need to poll the interrupt pins, saving many CPU cycles. //#define ENDSTOP_INTERRUPTS_FEATURE +/** + * Endstop Noise Filter + * + * Enable this option if endstops falsely trigger due to noise. + * NOTE: Enabling this feature means adds an error of +/-0.2mm, so homing + * will end up at a slightly different position on each G28. This will also + * reduce accuracy of some bed probes. + * For mechanical switches, the better approach to reduce noise is to install + * a 100 nanofarads ceramic capacitor in parallel with the switch, making it + * essentially noise-proof without sacrificing accuracy. + * This option also increases MCU load when endstops or the probe are enabled. + * So this is not recommended. USE AT YOUR OWN RISK. + * (This feature is not required for common micro-switches mounted on PCBs + * based on the Makerbot design, since they already include the 100nF capacitor.) + */ +//#define ENDSTOP_NOISE_FILTER + //============================================================================= //============================== Movement Settings ============================ //============================================================================= diff --git a/Marlin/src/config/examples/delta/FLSUN/kossel/Configuration.h b/Marlin/src/config/examples/delta/FLSUN/kossel/Configuration.h index bf81af9591..91337ba8ce 100644 --- a/Marlin/src/config/examples/delta/FLSUN/kossel/Configuration.h +++ b/Marlin/src/config/examples/delta/FLSUN/kossel/Configuration.h @@ -626,6 +626,23 @@ // This will remove the need to poll the interrupt pins, saving many CPU cycles. //#define ENDSTOP_INTERRUPTS_FEATURE +/** + * Endstop Noise Filter + * + * Enable this option if endstops falsely trigger due to noise. + * NOTE: Enabling this feature means adds an error of +/-0.2mm, so homing + * will end up at a slightly different position on each G28. This will also + * reduce accuracy of some bed probes. + * For mechanical switches, the better approach to reduce noise is to install + * a 100 nanofarads ceramic capacitor in parallel with the switch, making it + * essentially noise-proof without sacrificing accuracy. + * This option also increases MCU load when endstops or the probe are enabled. + * So this is not recommended. USE AT YOUR OWN RISK. + * (This feature is not required for common micro-switches mounted on PCBs + * based on the Makerbot design, since they already include the 100nF capacitor.) + */ +//#define ENDSTOP_NOISE_FILTER + //============================================================================= //============================== Movement Settings ============================ //============================================================================= diff --git a/Marlin/src/config/examples/delta/FLSUN/kossel_mini/Configuration.h b/Marlin/src/config/examples/delta/FLSUN/kossel_mini/Configuration.h index 73f0fedb40..144911f32a 100644 --- a/Marlin/src/config/examples/delta/FLSUN/kossel_mini/Configuration.h +++ b/Marlin/src/config/examples/delta/FLSUN/kossel_mini/Configuration.h @@ -626,6 +626,23 @@ // This will remove the need to poll the interrupt pins, saving many CPU cycles. //#define ENDSTOP_INTERRUPTS_FEATURE +/** + * Endstop Noise Filter + * + * Enable this option if endstops falsely trigger due to noise. + * NOTE: Enabling this feature means adds an error of +/-0.2mm, so homing + * will end up at a slightly different position on each G28. This will also + * reduce accuracy of some bed probes. + * For mechanical switches, the better approach to reduce noise is to install + * a 100 nanofarads ceramic capacitor in parallel with the switch, making it + * essentially noise-proof without sacrificing accuracy. + * This option also increases MCU load when endstops or the probe are enabled. + * So this is not recommended. USE AT YOUR OWN RISK. + * (This feature is not required for common micro-switches mounted on PCBs + * based on the Makerbot design, since they already include the 100nF capacitor.) + */ +//#define ENDSTOP_NOISE_FILTER + //============================================================================= //============================== Movement Settings ============================ //============================================================================= diff --git a/Marlin/src/config/examples/delta/Hatchbox_Alpha/Configuration.h b/Marlin/src/config/examples/delta/Hatchbox_Alpha/Configuration.h index 65fd6ebbad..32e390573c 100644 --- a/Marlin/src/config/examples/delta/Hatchbox_Alpha/Configuration.h +++ b/Marlin/src/config/examples/delta/Hatchbox_Alpha/Configuration.h @@ -631,6 +631,23 @@ // This will remove the need to poll the interrupt pins, saving many CPU cycles. //#define ENDSTOP_INTERRUPTS_FEATURE +/** + * Endstop Noise Filter + * + * Enable this option if endstops falsely trigger due to noise. + * NOTE: Enabling this feature means adds an error of +/-0.2mm, so homing + * will end up at a slightly different position on each G28. This will also + * reduce accuracy of some bed probes. + * For mechanical switches, the better approach to reduce noise is to install + * a 100 nanofarads ceramic capacitor in parallel with the switch, making it + * essentially noise-proof without sacrificing accuracy. + * This option also increases MCU load when endstops or the probe are enabled. + * So this is not recommended. USE AT YOUR OWN RISK. + * (This feature is not required for common micro-switches mounted on PCBs + * based on the Makerbot design, since they already include the 100nF capacitor.) + */ +//#define ENDSTOP_NOISE_FILTER + //============================================================================= //============================== Movement Settings ============================ //============================================================================= diff --git a/Marlin/src/config/examples/delta/generic/Configuration.h b/Marlin/src/config/examples/delta/generic/Configuration.h index c88f6c1b47..52a112bbe1 100644 --- a/Marlin/src/config/examples/delta/generic/Configuration.h +++ b/Marlin/src/config/examples/delta/generic/Configuration.h @@ -616,6 +616,23 @@ // This will remove the need to poll the interrupt pins, saving many CPU cycles. //#define ENDSTOP_INTERRUPTS_FEATURE +/** + * Endstop Noise Filter + * + * Enable this option if endstops falsely trigger due to noise. + * NOTE: Enabling this feature means adds an error of +/-0.2mm, so homing + * will end up at a slightly different position on each G28. This will also + * reduce accuracy of some bed probes. + * For mechanical switches, the better approach to reduce noise is to install + * a 100 nanofarads ceramic capacitor in parallel with the switch, making it + * essentially noise-proof without sacrificing accuracy. + * This option also increases MCU load when endstops or the probe are enabled. + * So this is not recommended. USE AT YOUR OWN RISK. + * (This feature is not required for common micro-switches mounted on PCBs + * based on the Makerbot design, since they already include the 100nF capacitor.) + */ +//#define ENDSTOP_NOISE_FILTER + //============================================================================= //============================== Movement Settings ============================ //============================================================================= diff --git a/Marlin/src/config/examples/delta/kossel_mini/Configuration.h b/Marlin/src/config/examples/delta/kossel_mini/Configuration.h index 1945d9f711..4ec0233c5c 100644 --- a/Marlin/src/config/examples/delta/kossel_mini/Configuration.h +++ b/Marlin/src/config/examples/delta/kossel_mini/Configuration.h @@ -616,6 +616,23 @@ // This will remove the need to poll the interrupt pins, saving many CPU cycles. //#define ENDSTOP_INTERRUPTS_FEATURE +/** + * Endstop Noise Filter + * + * Enable this option if endstops falsely trigger due to noise. + * NOTE: Enabling this feature means adds an error of +/-0.2mm, so homing + * will end up at a slightly different position on each G28. This will also + * reduce accuracy of some bed probes. + * For mechanical switches, the better approach to reduce noise is to install + * a 100 nanofarads ceramic capacitor in parallel with the switch, making it + * essentially noise-proof without sacrificing accuracy. + * This option also increases MCU load when endstops or the probe are enabled. + * So this is not recommended. USE AT YOUR OWN RISK. + * (This feature is not required for common micro-switches mounted on PCBs + * based on the Makerbot design, since they already include the 100nF capacitor.) + */ +//#define ENDSTOP_NOISE_FILTER + //============================================================================= //============================== Movement Settings ============================ //============================================================================= diff --git a/Marlin/src/config/examples/delta/kossel_pro/Configuration.h b/Marlin/src/config/examples/delta/kossel_pro/Configuration.h index fc12c86844..11f0ec7c8c 100644 --- a/Marlin/src/config/examples/delta/kossel_pro/Configuration.h +++ b/Marlin/src/config/examples/delta/kossel_pro/Configuration.h @@ -602,6 +602,23 @@ // This will remove the need to poll the interrupt pins, saving many CPU cycles. //#define ENDSTOP_INTERRUPTS_FEATURE +/** + * Endstop Noise Filter + * + * Enable this option if endstops falsely trigger due to noise. + * NOTE: Enabling this feature means adds an error of +/-0.2mm, so homing + * will end up at a slightly different position on each G28. This will also + * reduce accuracy of some bed probes. + * For mechanical switches, the better approach to reduce noise is to install + * a 100 nanofarads ceramic capacitor in parallel with the switch, making it + * essentially noise-proof without sacrificing accuracy. + * This option also increases MCU load when endstops or the probe are enabled. + * So this is not recommended. USE AT YOUR OWN RISK. + * (This feature is not required for common micro-switches mounted on PCBs + * based on the Makerbot design, since they already include the 100nF capacitor.) + */ +//#define ENDSTOP_NOISE_FILTER + //============================================================================= //============================== Movement Settings ============================ //============================================================================= diff --git a/Marlin/src/config/examples/delta/kossel_xl/Configuration.h b/Marlin/src/config/examples/delta/kossel_xl/Configuration.h index 6a6adf22aa..4258458fe0 100644 --- a/Marlin/src/config/examples/delta/kossel_xl/Configuration.h +++ b/Marlin/src/config/examples/delta/kossel_xl/Configuration.h @@ -620,6 +620,23 @@ // This will remove the need to poll the interrupt pins, saving many CPU cycles. //#define ENDSTOP_INTERRUPTS_FEATURE +/** + * Endstop Noise Filter + * + * Enable this option if endstops falsely trigger due to noise. + * NOTE: Enabling this feature means adds an error of +/-0.2mm, so homing + * will end up at a slightly different position on each G28. This will also + * reduce accuracy of some bed probes. + * For mechanical switches, the better approach to reduce noise is to install + * a 100 nanofarads ceramic capacitor in parallel with the switch, making it + * essentially noise-proof without sacrificing accuracy. + * This option also increases MCU load when endstops or the probe are enabled. + * So this is not recommended. USE AT YOUR OWN RISK. + * (This feature is not required for common micro-switches mounted on PCBs + * based on the Makerbot design, since they already include the 100nF capacitor.) + */ +//#define ENDSTOP_NOISE_FILTER + //============================================================================= //============================== Movement Settings ============================ //============================================================================= diff --git a/Marlin/src/config/examples/gCreate/gMax1.5+/Configuration.h b/Marlin/src/config/examples/gCreate/gMax1.5+/Configuration.h index 6aa8956931..df33c69298 100644 --- a/Marlin/src/config/examples/gCreate/gMax1.5+/Configuration.h +++ b/Marlin/src/config/examples/gCreate/gMax1.5+/Configuration.h @@ -566,6 +566,23 @@ // This will remove the need to poll the interrupt pins, saving many CPU cycles. #define ENDSTOP_INTERRUPTS_FEATURE +/** + * Endstop Noise Filter + * + * Enable this option if endstops falsely trigger due to noise. + * NOTE: Enabling this feature means adds an error of +/-0.2mm, so homing + * will end up at a slightly different position on each G28. This will also + * reduce accuracy of some bed probes. + * For mechanical switches, the better approach to reduce noise is to install + * a 100 nanofarads ceramic capacitor in parallel with the switch, making it + * essentially noise-proof without sacrificing accuracy. + * This option also increases MCU load when endstops or the probe are enabled. + * So this is not recommended. USE AT YOUR OWN RISK. + * (This feature is not required for common micro-switches mounted on PCBs + * based on the Makerbot design, since they already include the 100nF capacitor.) + */ +//#define ENDSTOP_NOISE_FILTER + //============================================================================= //============================== Movement Settings ============================ //============================================================================= diff --git a/Marlin/src/config/examples/makibox/Configuration.h b/Marlin/src/config/examples/makibox/Configuration.h index bed037af80..df58f166e5 100644 --- a/Marlin/src/config/examples/makibox/Configuration.h +++ b/Marlin/src/config/examples/makibox/Configuration.h @@ -556,6 +556,23 @@ // This will remove the need to poll the interrupt pins, saving many CPU cycles. //#define ENDSTOP_INTERRUPTS_FEATURE +/** + * Endstop Noise Filter + * + * Enable this option if endstops falsely trigger due to noise. + * NOTE: Enabling this feature means adds an error of +/-0.2mm, so homing + * will end up at a slightly different position on each G28. This will also + * reduce accuracy of some bed probes. + * For mechanical switches, the better approach to reduce noise is to install + * a 100 nanofarads ceramic capacitor in parallel with the switch, making it + * essentially noise-proof without sacrificing accuracy. + * This option also increases MCU load when endstops or the probe are enabled. + * So this is not recommended. USE AT YOUR OWN RISK. + * (This feature is not required for common micro-switches mounted on PCBs + * based on the Makerbot design, since they already include the 100nF capacitor.) + */ +//#define ENDSTOP_NOISE_FILTER + //============================================================================= //============================== Movement Settings ============================ //============================================================================= diff --git a/Marlin/src/config/examples/stm32f103ret6/Configuration.h b/Marlin/src/config/examples/stm32f103ret6/Configuration.h index c723f8f893..52750a9aa0 100644 --- a/Marlin/src/config/examples/stm32f103ret6/Configuration.h +++ b/Marlin/src/config/examples/stm32f103ret6/Configuration.h @@ -555,6 +555,23 @@ // This will remove the need to poll the interrupt pins, saving many CPU cycles. //#define ENDSTOP_INTERRUPTS_FEATURE +/** + * Endstop Noise Filter + * + * Enable this option if endstops falsely trigger due to noise. + * NOTE: Enabling this feature means adds an error of +/-0.2mm, so homing + * will end up at a slightly different position on each G28. This will also + * reduce accuracy of some bed probes. + * For mechanical switches, the better approach to reduce noise is to install + * a 100 nanofarads ceramic capacitor in parallel with the switch, making it + * essentially noise-proof without sacrificing accuracy. + * This option also increases MCU load when endstops or the probe are enabled. + * So this is not recommended. USE AT YOUR OWN RISK. + * (This feature is not required for common micro-switches mounted on PCBs + * based on the Makerbot design, since they already include the 100nF capacitor.) + */ +//#define ENDSTOP_NOISE_FILTER + //============================================================================= //============================== Movement Settings ============================ //============================================================================= diff --git a/Marlin/src/config/examples/tvrrug/Round2/Configuration.h b/Marlin/src/config/examples/tvrrug/Round2/Configuration.h index 3e19d3777f..1fc85c168f 100644 --- a/Marlin/src/config/examples/tvrrug/Round2/Configuration.h +++ b/Marlin/src/config/examples/tvrrug/Round2/Configuration.h @@ -542,6 +542,23 @@ // This will remove the need to poll the interrupt pins, saving many CPU cycles. //#define ENDSTOP_INTERRUPTS_FEATURE +/** + * Endstop Noise Filter + * + * Enable this option if endstops falsely trigger due to noise. + * NOTE: Enabling this feature means adds an error of +/-0.2mm, so homing + * will end up at a slightly different position on each G28. This will also + * reduce accuracy of some bed probes. + * For mechanical switches, the better approach to reduce noise is to install + * a 100 nanofarads ceramic capacitor in parallel with the switch, making it + * essentially noise-proof without sacrificing accuracy. + * This option also increases MCU load when endstops or the probe are enabled. + * So this is not recommended. USE AT YOUR OWN RISK. + * (This feature is not required for common micro-switches mounted on PCBs + * based on the Makerbot design, since they already include the 100nF capacitor.) + */ +//#define ENDSTOP_NOISE_FILTER + //============================================================================= //============================== Movement Settings ============================ //============================================================================= diff --git a/Marlin/src/config/examples/wt150/Configuration.h b/Marlin/src/config/examples/wt150/Configuration.h index 5e3d910cde..4e233b469b 100644 --- a/Marlin/src/config/examples/wt150/Configuration.h +++ b/Marlin/src/config/examples/wt150/Configuration.h @@ -558,6 +558,23 @@ // This will remove the need to poll the interrupt pins, saving many CPU cycles. //#define ENDSTOP_INTERRUPTS_FEATURE +/** + * Endstop Noise Filter + * + * Enable this option if endstops falsely trigger due to noise. + * NOTE: Enabling this feature means adds an error of +/-0.2mm, so homing + * will end up at a slightly different position on each G28. This will also + * reduce accuracy of some bed probes. + * For mechanical switches, the better approach to reduce noise is to install + * a 100 nanofarads ceramic capacitor in parallel with the switch, making it + * essentially noise-proof without sacrificing accuracy. + * This option also increases MCU load when endstops or the probe are enabled. + * So this is not recommended. USE AT YOUR OWN RISK. + * (This feature is not required for common micro-switches mounted on PCBs + * based on the Makerbot design, since they already include the 100nF capacitor.) + */ +//#define ENDSTOP_NOISE_FILTER + //============================================================================= //============================== Movement Settings ============================ //============================================================================= diff --git a/Marlin/src/module/delta.cpp b/Marlin/src/module/delta.cpp index 352610bbf8..ca8109ba2f 100644 --- a/Marlin/src/module/delta.cpp +++ b/Marlin/src/module/delta.cpp @@ -267,7 +267,7 @@ bool home_delta() { // If an endstop was not hit, then damage can occur if homing is continued. // This can occur if the delta height not set correctly. - if (!(Endstops::endstop_hit_bits & (_BV(X_MAX) | _BV(Y_MAX) | _BV(Z_MAX)))) { + if (!(endstops.trigger_state() & (_BV(X_MAX) | _BV(Y_MAX) | _BV(Z_MAX)))) { LCD_MESSAGEPGM(MSG_ERR_HOMING_FAILED); SERIAL_ERROR_START(); SERIAL_ERRORLNPGM(MSG_ERR_HOMING_FAILED); diff --git a/Marlin/src/module/endstops.cpp b/Marlin/src/module/endstops.cpp index d354774afe..fec473e2bf 100644 --- a/Marlin/src/module/endstops.cpp +++ b/Marlin/src/module/endstops.cpp @@ -36,9 +36,6 @@ #include HAL_PATH(../HAL, endstop_interrupts.h) #endif -// TEST_ENDSTOP: test the current status of an endstop -#define TEST_ENDSTOP(ENDSTOP) (TEST(current_endstop_bits, ENDSTOP)) - #if HAS_BED_PROBE #define ENDSTOPS_ENABLED (endstops.enabled || endstops.z_probe_enabled) #else @@ -50,9 +47,14 @@ Endstops endstops; // public: bool Endstops::enabled, Endstops::enabled_globally; // Initialized by settings.load() -volatile uint8_t Endstops::endstop_hit_bits; // use X_MIN, Y_MIN, Z_MIN and Z_MIN_PROBE as BIT value +volatile uint8_t Endstops::hit_state; -Endstops::esbits_t Endstops::current_endstop_bits = 0; +Endstops::esbits_t Endstops::live_state = 0; +#if ENABLED(ENDSTOP_NOISE_FILTER) + Endstops::esbits_t Endstops::old_live_state, + Endstops::validated_live_state; + uint8_t Endstops::endstop_poll_count; +#endif #if HAS_BED_PROBE volatile bool Endstops::z_probe_enabled = false; @@ -230,7 +232,7 @@ void Endstops::poll() { endstops.run_monitor(); // report changes in endstop status #endif - #if DISABLED(ENDSTOP_INTERRUPTS_FEATURE) + #if DISABLED(ENDSTOP_INTERRUPTS_FEATURE) || ENABLED(ENDSTOP_NOISE_FILTER) if (ENDSTOPS_ENABLED) endstops.update(); #endif } @@ -264,7 +266,7 @@ void Endstops::not_homing() { // Clear endstops (i.e., they were hit intentionally) to suppress the report void Endstops::hit_on_purpose() { - endstop_hit_bits = 0; + hit_state = 0; #if ENABLED(ENDSTOP_INTERRUPTS_FEATURE) if (enabled) endstops.update(); // If enabling, update state now @@ -293,7 +295,7 @@ void Endstops::hit_on_purpose() { #endif void Endstops::report_state() { - if (endstop_hit_bits) { + if (hit_state) { #if ENABLED(ULTRA_LCD) char chrX = ' ', chrY = ' ', chrZ = ' ', chrP = ' '; #define _SET_STOP_CHAR(A,C) (chr## A = C) @@ -306,7 +308,7 @@ void Endstops::report_state() { _SET_STOP_CHAR(A,C); }while(0) #define _ENDSTOP_HIT_TEST(A,C) \ - if (TEST(endstop_hit_bits, A ##_MIN) || TEST(endstop_hit_bits, A ##_MAX)) \ + if (TEST(hit_state, A ##_MIN) || TEST(hit_state, A ##_MAX)) \ _ENDSTOP_HIT_ECHO(A,C) #define ENDSTOP_HIT_TEST_X() _ENDSTOP_HIT_TEST(X,'X') @@ -321,7 +323,7 @@ void Endstops::report_state() { #if ENABLED(Z_MIN_PROBE_ENDSTOP) #define P_AXIS Z_AXIS - if (TEST(endstop_hit_bits, Z_MIN_PROBE)) _ENDSTOP_HIT_ECHO(P, 'P'); + if (TEST(hit_state, Z_MIN_PROBE)) _ENDSTOP_HIT_ECHO(P, 'P'); #endif SERIAL_EOL(); @@ -397,69 +399,23 @@ void Endstops::M119() { // The following routines are called from an ISR context. It could be the temperature ISR, the // endstop ISR or the Stepper ISR. -#if ENABLED(X_DUAL_ENDSTOPS) - void Endstops::test_dual_x_endstops(const EndstopEnum es1, const EndstopEnum es2) { - const byte x_test = TEST_ENDSTOP(es1) | (TEST_ENDSTOP(es2) << 1); // bit 0 for X, bit 1 for X2 - if (x_test && stepper.movement_non_null(X_AXIS)) { - SBI(endstop_hit_bits, X_MIN); - if (!stepper.performing_homing || (x_test == 0x3)) //if not performing home or if both endstops were trigged during homing... - stepper.quick_stop(); - } - } -#endif -#if ENABLED(Y_DUAL_ENDSTOPS) - void Endstops::test_dual_y_endstops(const EndstopEnum es1, const EndstopEnum es2) { - const byte y_test = TEST_ENDSTOP(es1) | (TEST_ENDSTOP(es2) << 1); // bit 0 for Y, bit 1 for Y2 - if (y_test && stepper.movement_non_null(Y_AXIS)) { - SBI(endstop_hit_bits, Y_MIN); - if (!stepper.performing_homing || (y_test == 0x3)) //if not performing home or if both endstops were trigged during homing... - stepper.quick_stop(); - } - } -#endif -#if ENABLED(Z_DUAL_ENDSTOPS) - void Endstops::test_dual_z_endstops(const EndstopEnum es1, const EndstopEnum es2) { - const byte z_test = TEST_ENDSTOP(es1) | (TEST_ENDSTOP(es2) << 1); // bit 0 for Z, bit 1 for Z2 - if (z_test && stepper.movement_non_null(Z_AXIS)) { - SBI(endstop_hit_bits, Z_MIN); - if (!stepper.performing_homing || (z_test == 0x3)) //if not performing home or if both endstops were trigged during homing... - stepper.quick_stop(); - } - } -#endif +#define _ENDSTOP(AXIS, MINMAX) AXIS ##_## MINMAX +#define _ENDSTOP_PIN(AXIS, MINMAX) AXIS ##_## MINMAX ##_PIN +#define _ENDSTOP_INVERTING(AXIS, MINMAX) AXIS ##_## MINMAX ##_ENDSTOP_INVERTING // Check endstops - Could be called from ISR! void Endstops::update() { - #define _ENDSTOP(AXIS, MINMAX) AXIS ##_## MINMAX - #define _ENDSTOP_PIN(AXIS, MINMAX) AXIS ##_## MINMAX ##_PIN - #define _ENDSTOP_INVERTING(AXIS, MINMAX) AXIS ##_## MINMAX ##_ENDSTOP_INVERTING - #define _ENDSTOP_HIT(AXIS, MINMAX) SBI(endstop_hit_bits, _ENDSTOP(AXIS, MINMAX)) - #define SET_BIT(N,B,TF) do{ if (TF) SBI(N,B); else CBI(N,B); }while(0) // UPDATE_ENDSTOP_BIT: set the current endstop bits for an endstop to its status - #define UPDATE_ENDSTOP_BIT(AXIS, MINMAX) SET_BIT(current_endstop_bits, _ENDSTOP(AXIS, MINMAX), (READ(_ENDSTOP_PIN(AXIS, MINMAX)) != _ENDSTOP_INVERTING(AXIS, MINMAX))) + #define UPDATE_ENDSTOP_BIT(AXIS, MINMAX) SET_BIT(live_state, _ENDSTOP(AXIS, MINMAX), (READ(_ENDSTOP_PIN(AXIS, MINMAX)) != _ENDSTOP_INVERTING(AXIS, MINMAX))) // COPY_BIT: copy the value of SRC_BIT to DST_BIT in DST #define COPY_BIT(DST, SRC_BIT, DST_BIT) SET_BIT(DST, DST_BIT, TEST(DST, SRC_BIT)) - #define UPDATE_ENDSTOP(AXIS,MINMAX) do { \ - UPDATE_ENDSTOP_BIT(AXIS, MINMAX); \ - if (TEST_ENDSTOP(_ENDSTOP(AXIS, MINMAX))) { \ - _ENDSTOP_HIT(AXIS, MINMAX); \ - planner.endstop_triggered(_AXIS(AXIS)); \ - } \ - }while(0) - #if ENABLED(G38_PROBE_TARGET) && PIN_EXISTS(Z_MIN_PROBE) && !(CORE_IS_XY || CORE_IS_XZ) // If G38 command is active check Z_MIN_PROBE for ALL movement if (G38_move) { UPDATE_ENDSTOP_BIT(Z, MIN_PROBE); - if (TEST_ENDSTOP(_ENDSTOP(Z, MIN_PROBE))) { - if (stepper.movement_non_null(_AXIS(X))) { _ENDSTOP_HIT(X, MIN); planner.endstop_triggered(_AXIS(X)); } - else if (stepper.movement_non_null(_AXIS(Y))) { _ENDSTOP_HIT(Y, MIN); planner.endstop_triggered(_AXIS(Y)); } - else if (stepper.movement_non_null(_AXIS(Z))) { _ENDSTOP_HIT(Z, MIN); planner.endstop_triggered(_AXIS(Z)); } - G38_endstop_hit = true; - } } #endif @@ -553,11 +509,10 @@ void Endstops::update() { #if HAS_X2_MIN UPDATE_ENDSTOP_BIT(X2, MIN); #else - COPY_BIT(current_endstop_bits, X_MIN, X2_MIN); + COPY_BIT(live_state, X_MIN, X2_MIN); #endif - test_dual_x_endstops(X_MIN, X2_MIN); #else - if (X_MIN_TEST) UPDATE_ENDSTOP(X, MIN); + if (X_MIN_TEST) UPDATE_ENDSTOP_BIT(X, MIN); #endif #endif } @@ -568,11 +523,10 @@ void Endstops::update() { #if HAS_X2_MAX UPDATE_ENDSTOP_BIT(X2, MAX); #else - COPY_BIT(current_endstop_bits, X_MAX, X2_MAX); + COPY_BIT(live_state, X_MAX, X2_MAX); #endif - test_dual_x_endstops(X_MAX, X2_MAX); #else - if (X_MAX_TEST) UPDATE_ENDSTOP(X, MAX); + if (X_MAX_TEST) UPDATE_ENDSTOP_BIT(X, MAX); #endif #endif } @@ -586,11 +540,10 @@ void Endstops::update() { #if HAS_Y2_MIN UPDATE_ENDSTOP_BIT(Y2, MIN); #else - COPY_BIT(current_endstop_bits, Y_MIN, Y2_MIN); + COPY_BIT(live_state, Y_MIN, Y2_MIN); #endif - test_dual_y_endstops(Y_MIN, Y2_MIN); #else - UPDATE_ENDSTOP(Y, MIN); + UPDATE_ENDSTOP_BIT(Y, MIN); #endif #endif } @@ -601,11 +554,10 @@ void Endstops::update() { #if HAS_Y2_MAX UPDATE_ENDSTOP_BIT(Y2, MAX); #else - COPY_BIT(current_endstop_bits, Y_MAX, Y2_MAX); + COPY_BIT(live_state, Y_MAX, Y2_MAX); #endif - test_dual_y_endstops(Y_MAX, Y2_MAX); #else - UPDATE_ENDSTOP(Y, MAX); + UPDATE_ENDSTOP_BIT(Y, MAX); #endif #endif } @@ -619,14 +571,13 @@ void Endstops::update() { #if HAS_Z2_MIN UPDATE_ENDSTOP_BIT(Z2, MIN); #else - COPY_BIT(current_endstop_bits, Z_MIN, Z2_MIN); + COPY_BIT(live_state, Z_MIN, Z2_MIN); #endif - test_dual_z_endstops(Z_MIN, Z2_MIN); #else #if ENABLED(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN) - if (z_probe_enabled) UPDATE_ENDSTOP(Z, MIN); + if (z_probe_enabled) UPDATE_ENDSTOP_BIT(Z, MIN); #else - UPDATE_ENDSTOP(Z, MIN); + UPDATE_ENDSTOP_BIT(Z, MIN); #endif #endif #endif @@ -634,8 +585,7 @@ void Endstops::update() { // When closing the gap check the enabled probe #if ENABLED(Z_MIN_PROBE_ENDSTOP) if (z_probe_enabled) { - UPDATE_ENDSTOP(Z, MIN_PROBE); - if (TEST_ENDSTOP(Z_MIN_PROBE)) SBI(endstop_hit_bits, Z_MIN_PROBE); + UPDATE_ENDSTOP_BIT(Z, MIN_PROBE); } #endif } @@ -647,13 +597,149 @@ void Endstops::update() { #if HAS_Z2_MAX UPDATE_ENDSTOP_BIT(Z2, MAX); #else - COPY_BIT(current_endstop_bits, Z_MAX, Z2_MAX); + COPY_BIT(live_state, Z_MAX, Z2_MAX); #endif - test_dual_z_endstops(Z_MAX, Z2_MAX); // If this pin is not hijacked for the bed probe // then it belongs to the Z endstop #elif DISABLED(Z_MIN_PROBE_ENDSTOP) || Z_MAX_PIN != Z_MIN_PROBE_PIN - UPDATE_ENDSTOP(Z, MAX); + UPDATE_ENDSTOP_BIT(Z, MAX); + #endif + #endif + } + } + + // All endstops were updated. + #if ENABLED(ENDSTOP_NOISE_FILTER) + if (old_live_state != live_state) { // We detected a change. Reinit the timeout + /** + * 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 + * of random noise). Then the first sample has a 50% chance to be good or bad. The 2nd sample + * also has a 50% chance to be good or bad. The chances of 2 samples both being bad becomes + * 50% of 50%, or 25%. That was the previous implementation of Marlin endstop handling. It + * reduces chances of bad readings in half, at the cost of 1 extra sample period, but chances + * still exist. The only way to reduce them further is to increase the number of samples. + * To reduce the chance to 1% (1/128th) requires 7 samples (adding 7ms of delay). + */ + endstop_poll_count = 7; + old_live_state = live_state; + } + else if (endstop_poll_count && !--endstop_poll_count) + validated_live_state = live_state; + + #else + + // Lets accept the new endstop values as valid - We assume hardware filtering of lines + esbits_t validated_live_state = live_state; + + #endif + + // Endstop readings are validated in validated_live_state + + // Test the current status of an endstop + #define TEST_ENDSTOP(ENDSTOP) (TEST(validated_live_state, ENDSTOP)) + + // Record endstop was hit + #define _ENDSTOP_HIT(AXIS, MINMAX) SBI(hit_state, _ENDSTOP(AXIS, MINMAX)) + + // Call the endstop triggered routine for single endstops + #define PROCESS_ENDSTOP(AXIS,MINMAX) do { \ + if (TEST_ENDSTOP(_ENDSTOP(AXIS, MINMAX))) { \ + _ENDSTOP_HIT(AXIS, MINMAX); \ + planner.endstop_triggered(_AXIS(AXIS)); \ + } \ + }while(0) + + // Call the endstop triggered routine for single endstops + #define PROCESS_DUAL_ENDSTOP(AXIS1, AXIS2, MINMAX) do { \ + if (TEST_ENDSTOP(_ENDSTOP(AXIS1, MINMAX)) || TEST_ENDSTOP(_ENDSTOP(AXIS2, MINMAX))) { \ + _ENDSTOP_HIT(AXIS1, MINMAX); \ + planner.endstop_triggered(_AXIS(AXIS1)); \ + } \ + }while(0) + + #if ENABLED(G38_PROBE_TARGET) && PIN_EXISTS(Z_MIN_PROBE) && !(CORE_IS_XY || CORE_IS_XZ) + // If G38 command is active check Z_MIN_PROBE for ALL movement + if (G38_move) { + if (TEST_ENDSTOP(_ENDSTOP(Z, MIN_PROBE))) { + if (stepper.movement_non_null(_AXIS(X))) { _ENDSTOP_HIT(X, MIN); planner.endstop_triggered(_AXIS(X)); } + else if (stepper.movement_non_null(_AXIS(Y))) { _ENDSTOP_HIT(Y, MIN); planner.endstop_triggered(_AXIS(Y)); } + else if (stepper.movement_non_null(_AXIS(Z))) { _ENDSTOP_HIT(Z, MIN); planner.endstop_triggered(_AXIS(Z)); } + G38_endstop_hit = true; + } + } + #endif + + // Now, we must signal, after validation, if an endstop limit is pressed or not + if (X_MOVE_TEST) { + if (stepper.motor_direction(X_AXIS_HEAD)) { // -direction + #if HAS_X_MIN + #if ENABLED(X_DUAL_ENDSTOPS) + PROCESS_DUAL_ENDSTOP(X, X2, MIN); + #else + if (X_MIN_TEST) PROCESS_ENDSTOP(X, MIN); + #endif + #endif + } + else { // +direction + #if HAS_X_MAX + #if ENABLED(X_DUAL_ENDSTOPS) + PROCESS_DUAL_ENDSTOP(X, X2, MAX); + #else + if (X_MAX_TEST) PROCESS_ENDSTOP(X, MAX); + #endif + #endif + } + } + + if (Y_MOVE_TEST) { + if (stepper.motor_direction(Y_AXIS_HEAD)) { // -direction + #if HAS_Y_MIN + #if ENABLED(Y_DUAL_ENDSTOPS) + PROCESS_DUAL_ENDSTOP(Y, Y2, MIN); + #else + PROCESS_ENDSTOP(Y, MIN); + #endif + #endif + } + else { // +direction + #if HAS_Y_MAX + #if ENABLED(Y_DUAL_ENDSTOPS) + PROCESS_DUAL_ENDSTOP(Y, Y2, MAX); + #else + PROCESS_ENDSTOP(Y, MAX); + #endif + #endif + } + } + + if (Z_MOVE_TEST) { + if (stepper.motor_direction(Z_AXIS_HEAD)) { // Z -direction. Gantry down, bed up. + #if HAS_Z_MIN + #if ENABLED(Z_DUAL_ENDSTOPS) + PROCESS_DUAL_ENDSTOP(Z, Z2, MIN); + #else + #if ENABLED(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN) + if (z_probe_enabled) PROCESS_ENDSTOP(Z, MIN); + #else + PROCESS_ENDSTOP(Z, MIN); + #endif + #endif + #endif + + // When closing the gap check the enabled probe + #if ENABLED(Z_MIN_PROBE_ENDSTOP) + if (z_probe_enabled) PROCESS_ENDSTOP(Z, MIN_PROBE); + #endif + } + else { // Z +direction. Gantry up, bed down. + #if HAS_Z_MAX + #if ENABLED(Z_DUAL_ENDSTOPS) + PROCESS_DUAL_ENDSTOP(Z, Z2, MAX); + #elif DISABLED(Z_MIN_PROBE_ENDSTOP) || Z_MAX_PIN != Z_MIN_PROBE_PIN + // If this pin is not hijacked for the bed probe + // then it belongs to the Z endstop + PROCESS_ENDSTOP(Z, MAX); #endif #endif } @@ -676,96 +762,96 @@ void Endstops::update() { */ void Endstops::monitor() { - static uint16_t old_endstop_bits_local = 0; + static uint16_t old_live_state_local = 0; static uint8_t local_LED_status = 0; - uint16_t current_endstop_bits_local = 0; + uint16_t live_state_local = 0; #if HAS_X_MIN - if (READ(X_MIN_PIN)) SBI(current_endstop_bits_local, X_MIN); + if (READ(X_MIN_PIN)) SBI(live_state_local, X_MIN); #endif #if HAS_X_MAX - if (READ(X_MAX_PIN)) SBI(current_endstop_bits_local, X_MAX); + if (READ(X_MAX_PIN)) SBI(live_state_local, X_MAX); #endif #if HAS_Y_MIN - if (READ(Y_MIN_PIN)) SBI(current_endstop_bits_local, Y_MIN); + if (READ(Y_MIN_PIN)) SBI(live_state_local, Y_MIN); #endif #if HAS_Y_MAX - if (READ(Y_MAX_PIN)) SBI(current_endstop_bits_local, Y_MAX); + if (READ(Y_MAX_PIN)) SBI(live_state_local, Y_MAX); #endif #if HAS_Z_MIN - if (READ(Z_MIN_PIN)) SBI(current_endstop_bits_local, Z_MIN); + if (READ(Z_MIN_PIN)) SBI(live_state_local, Z_MIN); #endif #if HAS_Z_MAX - if (READ(Z_MAX_PIN)) SBI(current_endstop_bits_local, Z_MAX); + if (READ(Z_MAX_PIN)) SBI(live_state_local, Z_MAX); #endif #if HAS_Z_MIN_PROBE_PIN - if (READ(Z_MIN_PROBE_PIN)) SBI(current_endstop_bits_local, Z_MIN_PROBE); + if (READ(Z_MIN_PROBE_PIN)) SBI(live_state_local, Z_MIN_PROBE); #endif #if HAS_X2_MIN - if (READ(X2_MIN_PIN)) SBI(current_endstop_bits_local, X2_MIN); + if (READ(X2_MIN_PIN)) SBI(live_state_local, X2_MIN); #endif #if HAS_X2_MAX - if (READ(X2_MAX_PIN)) SBI(current_endstop_bits_local, X2_MAX); + if (READ(X2_MAX_PIN)) SBI(live_state_local, X2_MAX); #endif #if HAS_Y2_MIN - if (READ(Y2_MIN_PIN)) SBI(current_endstop_bits_local, Y2_MIN); + if (READ(Y2_MIN_PIN)) SBI(live_state_local, Y2_MIN); #endif #if HAS_Y2_MAX - if (READ(Y2_MAX_PIN)) SBI(current_endstop_bits_local, Y2_MAX); + if (READ(Y2_MAX_PIN)) SBI(live_state_local, Y2_MAX); #endif #if HAS_Z2_MIN - if (READ(Z2_MIN_PIN)) SBI(current_endstop_bits_local, Z2_MIN); + if (READ(Z2_MIN_PIN)) SBI(live_state_local, Z2_MIN); #endif #if HAS_Z2_MAX - if (READ(Z2_MAX_PIN)) SBI(current_endstop_bits_local, Z2_MAX); + if (READ(Z2_MAX_PIN)) SBI(live_state_local, Z2_MAX); #endif - uint16_t endstop_change = current_endstop_bits_local ^ old_endstop_bits_local; + uint16_t endstop_change = live_state_local ^ old_live_state_local; if (endstop_change) { #if HAS_X_MIN - if (TEST(endstop_change, X_MIN)) SERIAL_PROTOCOLPAIR(" X_MIN:", TEST(current_endstop_bits_local, X_MIN)); + if (TEST(endstop_change, X_MIN)) SERIAL_PROTOCOLPAIR(" X_MIN:", TEST(live_state_local, X_MIN)); #endif #if HAS_X_MAX - if (TEST(endstop_change, X_MAX)) SERIAL_PROTOCOLPAIR(" X_MAX:", TEST(current_endstop_bits_local, X_MAX)); + if (TEST(endstop_change, X_MAX)) SERIAL_PROTOCOLPAIR(" X_MAX:", TEST(live_state_local, X_MAX)); #endif #if HAS_Y_MIN - if (TEST(endstop_change, Y_MIN)) SERIAL_PROTOCOLPAIR(" Y_MIN:", TEST(current_endstop_bits_local, Y_MIN)); + if (TEST(endstop_change, Y_MIN)) SERIAL_PROTOCOLPAIR(" Y_MIN:", TEST(live_state_local, Y_MIN)); #endif #if HAS_Y_MAX - if (TEST(endstop_change, Y_MAX)) SERIAL_PROTOCOLPAIR(" Y_MAX:", TEST(current_endstop_bits_local, Y_MAX)); + if (TEST(endstop_change, Y_MAX)) SERIAL_PROTOCOLPAIR(" Y_MAX:", TEST(live_state_local, Y_MAX)); #endif #if HAS_Z_MIN - if (TEST(endstop_change, Z_MIN)) SERIAL_PROTOCOLPAIR(" Z_MIN:", TEST(current_endstop_bits_local, Z_MIN)); + if (TEST(endstop_change, Z_MIN)) SERIAL_PROTOCOLPAIR(" Z_MIN:", TEST(live_state_local, Z_MIN)); #endif #if HAS_Z_MAX - if (TEST(endstop_change, Z_MAX)) SERIAL_PROTOCOLPAIR(" Z_MAX:", TEST(current_endstop_bits_local, Z_MAX)); + if (TEST(endstop_change, Z_MAX)) SERIAL_PROTOCOLPAIR(" Z_MAX:", TEST(live_state_local, Z_MAX)); #endif #if HAS_Z_MIN_PROBE_PIN - if (TEST(endstop_change, Z_MIN_PROBE)) SERIAL_PROTOCOLPAIR(" PROBE:", TEST(current_endstop_bits_local, Z_MIN_PROBE)); + if (TEST(endstop_change, Z_MIN_PROBE)) SERIAL_PROTOCOLPAIR(" PROBE:", TEST(live_state_local, Z_MIN_PROBE)); #endif #if HAS_X2_MIN - if (TEST(endstop_change, X2_MIN)) SERIAL_PROTOCOLPAIR(" X2_MIN:", TEST(current_endstop_bits_local, X2_MIN)); + if (TEST(endstop_change, X2_MIN)) SERIAL_PROTOCOLPAIR(" X2_MIN:", TEST(live_state_local, X2_MIN)); #endif #if HAS_X2_MAX - if (TEST(endstop_change, X2_MAX)) SERIAL_PROTOCOLPAIR(" X2_MAX:", TEST(current_endstop_bits_local, X2_MAX)); + if (TEST(endstop_change, X2_MAX)) SERIAL_PROTOCOLPAIR(" X2_MAX:", TEST(live_state_local, X2_MAX)); #endif #if HAS_Y2_MIN - if (TEST(endstop_change, Y2_MIN)) SERIAL_PROTOCOLPAIR(" Y2_MIN:", TEST(current_endstop_bits_local, Y2_MIN)); + if (TEST(endstop_change, Y2_MIN)) SERIAL_PROTOCOLPAIR(" Y2_MIN:", TEST(live_state_local, Y2_MIN)); #endif #if HAS_Y2_MAX - if (TEST(endstop_change, Y2_MAX)) SERIAL_PROTOCOLPAIR(" Y2_MAX:", TEST(current_endstop_bits_local, Y2_MAX)); + if (TEST(endstop_change, Y2_MAX)) SERIAL_PROTOCOLPAIR(" Y2_MAX:", TEST(live_state_local, Y2_MAX)); #endif #if HAS_Z2_MIN - if (TEST(endstop_change, Z2_MIN)) SERIAL_PROTOCOLPAIR(" Z2_MIN:", TEST(current_endstop_bits_local, Z2_MIN)); + if (TEST(endstop_change, Z2_MIN)) SERIAL_PROTOCOLPAIR(" Z2_MIN:", TEST(live_state_local, Z2_MIN)); #endif #if HAS_Z2_MAX - if (TEST(endstop_change, Z2_MAX)) SERIAL_PROTOCOLPAIR(" Z2_MAX:", TEST(current_endstop_bits_local, Z2_MAX)); + if (TEST(endstop_change, Z2_MAX)) SERIAL_PROTOCOLPAIR(" Z2_MAX:", TEST(live_state_local, Z2_MAX)); #endif SERIAL_PROTOCOLPGM("\n\n"); analogWrite(LED_PIN, local_LED_status); local_LED_status ^= 255; - old_endstop_bits_local = current_endstop_bits_local; + old_live_state_local = live_state_local; } } diff --git a/Marlin/src/module/endstops.h b/Marlin/src/module/endstops.h index da276cc729..74ae6801e3 100644 --- a/Marlin/src/module/endstops.h +++ b/Marlin/src/module/endstops.h @@ -51,7 +51,6 @@ class Endstops { public: static bool enabled, enabled_globally; - static volatile uint8_t endstop_hit_bits; // use X_MIN, Y_MIN, Z_MIN and Z_MIN_PROBE as BIT value #if ENABLED(X_DUAL_ENDSTOPS) || ENABLED(Y_DUAL_ENDSTOPS) || ENABLED(Z_DUAL_ENDSTOPS) typedef uint16_t esbits_t; @@ -65,11 +64,19 @@ class Endstops { static float z_endstop_adj; #endif #else - typedef byte esbits_t; + typedef uint8_t esbits_t; #endif - static esbits_t current_endstop_bits; + private: + 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) + static esbits_t old_live_state, // Old endstop value for debouncing and denoising + validated_live_state; // The validated (accepted as true) endstop bits + static uint8_t endstop_poll_count; // Countdown from threshold for polling + #endif + public: Endstops() {}; /** @@ -93,6 +100,16 @@ class Endstops { */ static void update(); + /** + * Get Endstop hit state. + */ + FORCE_INLINE static uint8_t trigger_state() { return hit_state; } + + /** + * Get current endstops state + */ + FORCE_INLINE static esbits_t state() { return live_state; } + /** * Print an error message reporting the position when the endstops were last hit. */ @@ -127,18 +144,6 @@ class Endstops { static void monitor(); static void run_monitor(); #endif - - private: - - #if ENABLED(X_DUAL_ENDSTOPS) - static void test_dual_x_endstops(const EndstopEnum es1, const EndstopEnum es2); - #endif - #if ENABLED(Y_DUAL_ENDSTOPS) - static void test_dual_y_endstops(const EndstopEnum es1, const EndstopEnum es2); - #endif - #if ENABLED(Z_DUAL_ENDSTOPS) - static void test_dual_z_endstops(const EndstopEnum es1, const EndstopEnum es2); - #endif }; extern Endstops endstops; diff --git a/Marlin/src/module/probe.cpp b/Marlin/src/module/probe.cpp index 3ffdb29e0b..206ab2c57c 100644 --- a/Marlin/src/module/probe.cpp +++ b/Marlin/src/module/probe.cpp @@ -515,7 +515,7 @@ static bool do_probe_move(const float z, const float fr_mm_s) { do_blocking_move_to_z(z, fr_mm_s); // Check to see if the probe was triggered - const bool probe_triggered = TEST(Endstops::endstop_hit_bits, + const bool probe_triggered = TEST(endstops.trigger_state(), #if ENABLED(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN) Z_MIN #else diff --git a/Marlin/src/module/stepper.cpp b/Marlin/src/module/stepper.cpp index 56a4b0d6d5..bc61658ed7 100644 --- a/Marlin/src/module/stepper.cpp +++ b/Marlin/src/module/stepper.cpp @@ -184,12 +184,12 @@ volatile int32_t Stepper::endstops_trigsteps[XYZ]; #define DUAL_ENDSTOP_APPLY_STEP(A,V) \ if (performing_homing) { \ if (A##_HOME_DIR < 0) { \ - if (!(TEST(endstops.current_endstop_bits, A##_MIN) && count_direction[_AXIS(A)] < 0) && !LOCKED_##A##_MOTOR) A##_STEP_WRITE(V); \ - if (!(TEST(endstops.current_endstop_bits, A##2_MIN) && count_direction[_AXIS(A)] < 0) && !LOCKED_##A##2_MOTOR) A##2_STEP_WRITE(V); \ + if (!(TEST(endstops.state(), A##_MIN) && count_direction[_AXIS(A)] < 0) && !LOCKED_##A##_MOTOR) A##_STEP_WRITE(V); \ + if (!(TEST(endstops.state(), A##2_MIN) && count_direction[_AXIS(A)] < 0) && !LOCKED_##A##2_MOTOR) A##2_STEP_WRITE(V); \ } \ else { \ - if (!(TEST(endstops.current_endstop_bits, A##_MAX) && count_direction[_AXIS(A)] > 0) && !LOCKED_##A##_MOTOR) A##_STEP_WRITE(V); \ - if (!(TEST(endstops.current_endstop_bits, A##2_MAX) && count_direction[_AXIS(A)] > 0) && !LOCKED_##A##2_MOTOR) A##2_STEP_WRITE(V); \ + if (!(TEST(endstops.state(), A##_MAX) && count_direction[_AXIS(A)] > 0) && !LOCKED_##A##_MOTOR) A##_STEP_WRITE(V); \ + if (!(TEST(endstops.state(), A##2_MAX) && count_direction[_AXIS(A)] > 0) && !LOCKED_##A##2_MOTOR) A##2_STEP_WRITE(V); \ } \ } \ else { \