Followup to new endstop interrupts feature

- Fix typos, verbiage
- Fix naming of `setup_endstop_interrupts`
- Some formatting, indentation, spacing
This commit is contained in:
Scott Lahteine 2016-11-18 21:53:45 -06:00
parent 832fe284b4
commit eb120e518c
25 changed files with 215 additions and 217 deletions

View file

@ -445,8 +445,8 @@
#define Z_MAX_ENDSTOP_INVERTING false // set to true to invert the logic of the endstop. #define Z_MAX_ENDSTOP_INVERTING false // set to true to invert the logic of the endstop.
#define Z_MIN_PROBE_ENDSTOP_INVERTING false // set to true to invert the logic of the endstop. #define Z_MIN_PROBE_ENDSTOP_INVERTING false // set to true to invert the logic of the endstop.
// If all used endstop pins are able to cause interrupts, you can enable ENDSTOP_INTERRUPTS_FEATURE. // Enable this feature if all enabled endstop pins are interrupt-capable.
// Then the function testing the endstops will only be called, if the state of one of the endstops changed. // This will remove the need to poll the interrupt pins, saving many CPU cycles.
//#define ENDSTOP_INTERRUPTS_FEATURE //#define ENDSTOP_INTERRUPTS_FEATURE
//============================================================================= //=============================================================================

View file

@ -92,6 +92,7 @@
#if ENABLED(ENDSTOP_INTERRUPTS_FEATURE) #if ENABLED(ENDSTOP_INTERRUPTS_FEATURE)
#include "endstop_interrupts.h" #include "endstop_interrupts.h"
#endif #endif
/** /**
* Look here for descriptions of G-codes: * Look here for descriptions of G-codes:
* - http://linuxcnc.org/handbook/gcode/g-code.html * - http://linuxcnc.org/handbook/gcode/g-code.html
@ -10020,7 +10021,7 @@ void setup() {
#endif #endif
#if ENABLED(ENDSTOP_INTERRUPTS_FEATURE) #if ENABLED(ENDSTOP_INTERRUPTS_FEATURE)
setup_enstop_interrupts(); setup_endstop_interrupts();
#endif #endif
} }

View file

@ -21,13 +21,18 @@
*/ */
/** /**
* Endstop interrupts * Endstop Interrupts
* Without endstop interrups the stepper-ISR must always test all endstops when interested in their states (endstops.update()).
* Most time the test will result in finding out nothing has changed.
* With endstop interrupts endstops.update() is called only when we know that at least one endstop has changed its state.
* *
* This can work only if all __used__ endstop pins can provide ether an 'external interrupt' or a 'pin change interrupt'. * Without endstop interrupts the endstop pins must be polled continually in
* You can find out about pins issuing interrupts by running 'pin_interrupt_test.ino' (Marlin\buildroot\share\pin_interrupt_test\pin_interrupt_test.ino) * the stepper-ISR via endstops.update(), most of the time finding no change.
* With this feature endstops.update() is called only when we know that at
* least one endstop has changed state, saving valuable CPU cycles.
*
* This feature only works when all used endstop pins can generate either an
* 'external interrupt' or a 'pin change interrupt'.
*
* Test whether pins issue interrupts on your board by flashing 'pin_interrupt_test.ino'.
* (Located in Marlin/buildroot/share/pin_interrupt_test/pin_interrupt_test.ino)
*/ */
#ifndef _ENDSTOP_INTERRUPTS_H_ #ifndef _ENDSTOP_INTERRUPTS_H_
@ -37,8 +42,8 @@
* Patch for pins_arduino.h (...\Arduino\hardware\arduino\avr\variants\mega\pins_arduino.h) * Patch for pins_arduino.h (...\Arduino\hardware\arduino\avr\variants\mega\pins_arduino.h)
* *
* These macros for the Arduino MEGA do not include the two connected pins on Port J (D13, D14). * These macros for the Arduino MEGA do not include the two connected pins on Port J (D13, D14).
* So we extend them here because this are the normal pins for Y_MIN and Y_MAX on RAMPS. * So we extend them here because these are the normal pins for Y_MIN and Y_MAX on RAMPS.
* There are more PCI enabled processor pins on Port J, but they are not connected to Arduino MEGA. * There are more PCI-enabled processor pins on Port J, but they are not connected to Arduino MEGA.
*/ */
#if defined(ARDUINO_AVR_MEGA2560) || defined(ARDUINO_AVR_MEGA) #if defined(ARDUINO_AVR_MEGA2560) || defined(ARDUINO_AVR_MEGA)
#undef digitalPinToPCICR #undef digitalPinToPCICR
@ -70,7 +75,7 @@
volatile uint8_t e_hit = 0; // Different from 0 when the endstops shall be tested in detail. volatile uint8_t e_hit = 0; // Different from 0 when the endstops shall be tested in detail.
// Must be reset to 0 by the test function when the tests are finished. // Must be reset to 0 by the test function when the tests are finished.
// Install Pin change interrupt for a pin, can be called multiple times // Install Pin change interrupt for a pin. Can be called multiple times.
void pciSetup(byte pin) { void pciSetup(byte pin) {
*digitalPinToPCMSK(pin) |= bit (digitalPinToPCMSKbit(pin)); // enable pin *digitalPinToPCMSK(pin) |= bit (digitalPinToPCMSKbit(pin)); // enable pin
PCIFR |= bit (digitalPinToPCICRbit(pin)); // clear any outstanding interrupt PCIFR |= bit (digitalPinToPCICRbit(pin)); // clear any outstanding interrupt
@ -84,35 +89,26 @@
// Use one Routine to handle each group // Use one Routine to handle each group
// One ISR for all EXT-Interrupts // One ISR for all EXT-Interrupts
void endstop_ISR(void) { void endstop_ISR(void) { endstop_ISR_worker(); }
endstop_ISR_worker();
}
// Handlers for pin change interrupts
#ifdef PCINT0_vect #ifdef PCINT0_vect
ISR(PCINT0_vect) { // handle pin change interrupt ISR(PCINT0_vect) { endstop_ISR_worker(); }
endstop_ISR_worker();
}
#endif #endif
#ifdef PCINT1_vect #ifdef PCINT1_vect
ISR(PCINT1_vect) { // handle pin change interrupt ISR(PCINT1_vect) { endstop_ISR_worker(); }
endstop_ISR_worker();
}
#endif #endif
#ifdef PCINT2_vect #ifdef PCINT2_vect
ISR(PCINT2_vect) { // handle pin change interrupt ISR(PCINT2_vect) { endstop_ISR_worker(); }
endstop_ISR_worker();
}
#endif #endif
#ifdef PCINT3_vect #ifdef PCINT3_vect
ISR(PCINT3_vect) { // handle pin change interrupt ISR(PCINT3_vect) { endstop_ISR_worker(); }
endstop_ISR_worker();
}
#endif #endif
void setup_enstop_interrupts( void ) { void setup_endstop_interrupts( void ) {
#if HAS_X_MAX #if HAS_X_MAX
#if (digitalPinToInterrupt(X_MAX_PIN) != NOT_AN_INTERRUPT) // if pin has an external interrupt #if (digitalPinToInterrupt(X_MAX_PIN) != NOT_AN_INTERRUPT) // if pin has an external interrupt
@ -204,8 +200,7 @@
#endif #endif
#endif #endif
// When we arive here without error each pin has ether a EXT-interrupt or a PCI. // If we arrive here without raising an assertion, each pin has either an EXT-interrupt or a PCI.
} }
#endif //_ENDSTOP_INTERRUPTS_H_ #endif //_ENDSTOP_INTERRUPTS_H_

View file

@ -445,8 +445,8 @@
#define Z_MAX_ENDSTOP_INVERTING false // set to true to invert the logic of the endstop. #define Z_MAX_ENDSTOP_INVERTING false // set to true to invert the logic of the endstop.
#define Z_MIN_PROBE_ENDSTOP_INVERTING false // set to true to invert the logic of the endstop. #define Z_MIN_PROBE_ENDSTOP_INVERTING false // set to true to invert the logic of the endstop.
// If all used endstop pins are able to cause interrupts, you can enable ENDSTOP_INTERRUPTS_FEATURE. // Enable this feature if all enabled endstop pins are interrupt-capable.
// Then the function testing the endstops will only be called, if the state of one of the endstops changed. // This will remove the need to poll the interrupt pins, saving many CPU cycles.
//#define ENDSTOP_INTERRUPTS_FEATURE //#define ENDSTOP_INTERRUPTS_FEATURE
//============================================================================= //=============================================================================

View file

@ -427,8 +427,8 @@
#define Z_MAX_ENDSTOP_INVERTING true // set to true to invert the logic of the endstop. #define Z_MAX_ENDSTOP_INVERTING true // set to true to invert the logic of the endstop.
#define Z_MIN_PROBE_ENDSTOP_INVERTING false // set to true to invert the logic of the endstop. #define Z_MIN_PROBE_ENDSTOP_INVERTING false // set to true to invert the logic of the endstop.
// If all used endstop pins are able to cause interrupts, you can enable ENDSTOP_INTERRUPTS_FEATURE. // Enable this feature if all enabled endstop pins are interrupt-capable.
// Then the function testing the endstops will only be called, if the state of one of the endstops changed. // This will remove the need to poll the interrupt pins, saving many CPU cycles.
//#define ENDSTOP_INTERRUPTS_FEATURE //#define ENDSTOP_INTERRUPTS_FEATURE
//============================================================================= //=============================================================================

View file

@ -427,8 +427,8 @@
#define Z_MAX_ENDSTOP_INVERTING true // set to true to invert the logic of the endstop. #define Z_MAX_ENDSTOP_INVERTING true // set to true to invert the logic of the endstop.
#define Z_MIN_PROBE_ENDSTOP_INVERTING false // set to true to invert the logic of the endstop. #define Z_MIN_PROBE_ENDSTOP_INVERTING false // set to true to invert the logic of the endstop.
// If all used endstop pins are able to cause interrupts, you can enable ENDSTOP_INTERRUPTS_FEATURE. // Enable this feature if all enabled endstop pins are interrupt-capable.
// Then the function testing the endstops will only be called, if the state of one of the endstops changed. // This will remove the need to poll the interrupt pins, saving many CPU cycles.
//#define ENDSTOP_INTERRUPTS_FEATURE //#define ENDSTOP_INTERRUPTS_FEATURE
//============================================================================= //=============================================================================

View file

@ -437,8 +437,8 @@
#define Z_MAX_ENDSTOP_INVERTING true // set to true to invert the logic of the endstop. #define Z_MAX_ENDSTOP_INVERTING true // set to true to invert the logic of the endstop.
#define Z_MIN_PROBE_ENDSTOP_INVERTING true // set to true to invert the logic of the endstop. #define Z_MIN_PROBE_ENDSTOP_INVERTING true // set to true to invert the logic of the endstop.
// If all used endstop pins are able to cause interrupts, you can enable ENDSTOP_INTERRUPTS_FEATURE. // Enable this feature if all enabled endstop pins are interrupt-capable.
// Then the function testing the endstops will only be called, if the state of one of the endstops changed. // This will remove the need to poll the interrupt pins, saving many CPU cycles.
//#define ENDSTOP_INTERRUPTS_FEATURE //#define ENDSTOP_INTERRUPTS_FEATURE
//============================================================================= //=============================================================================

View file

@ -439,8 +439,8 @@
#define Z_MAX_ENDSTOP_INVERTING true // set to true to invert the logic of the endstop. #define Z_MAX_ENDSTOP_INVERTING true // set to true to invert the logic of the endstop.
#define Z_MIN_PROBE_ENDSTOP_INVERTING false // set to true to invert the logic of the endstop. #define Z_MIN_PROBE_ENDSTOP_INVERTING false // set to true to invert the logic of the endstop.
// If all used endstop pins are able to cause interrupts, you can enable ENDSTOP_INTERRUPTS_FEATURE. // Enable this feature if all enabled endstop pins are interrupt-capable.
// Then the function testing the endstops will only be called, if the state of one of the endstops changed. // This will remove the need to poll the interrupt pins, saving many CPU cycles.
//#define ENDSTOP_INTERRUPTS_FEATURE //#define ENDSTOP_INTERRUPTS_FEATURE
//============================================================================= //=============================================================================

View file

@ -462,8 +462,8 @@
#define Z_MAX_ENDSTOP_INVERTING true // set to true to invert the logic of the endstop. #define Z_MAX_ENDSTOP_INVERTING true // set to true to invert the logic of the endstop.
#define Z_MIN_PROBE_ENDSTOP_INVERTING false // set to true to invert the logic of the endstop. #define Z_MIN_PROBE_ENDSTOP_INVERTING false // set to true to invert the logic of the endstop.
// If all used endstop pins are able to cause interrupts, you can enable ENDSTOP_INTERRUPTS_FEATURE. // Enable this feature if all enabled endstop pins are interrupt-capable.
// Then the function testing the endstops will only be called, if the state of one of the endstops changed. // This will remove the need to poll the interrupt pins, saving many CPU cycles.
//#define ENDSTOP_INTERRUPTS_FEATURE //#define ENDSTOP_INTERRUPTS_FEATURE
//============================================================================= //=============================================================================

View file

@ -445,8 +445,8 @@
#define Z_MAX_ENDSTOP_INVERTING true // set to true to invert the logic of the endstop. #define Z_MAX_ENDSTOP_INVERTING true // set to true to invert the logic of the endstop.
#define Z_MIN_PROBE_ENDSTOP_INVERTING true // set to true to invert the logic of the endstop. #define Z_MIN_PROBE_ENDSTOP_INVERTING true // set to true to invert the logic of the endstop.
// If all used endstop pins are able to cause interrupts, you can enable ENDSTOP_INTERRUPTS_FEATURE. // Enable this feature if all enabled endstop pins are interrupt-capable.
// Then the function testing the endstops will only be called, if the state of one of the endstops changed. // This will remove the need to poll the interrupt pins, saving many CPU cycles.
//#define ENDSTOP_INTERRUPTS_FEATURE //#define ENDSTOP_INTERRUPTS_FEATURE
//============================================================================= //=============================================================================

View file

@ -445,8 +445,8 @@
#define Z_MAX_ENDSTOP_INVERTING true // set to true to invert the logic of the endstop. #define Z_MAX_ENDSTOP_INVERTING true // set to true to invert the logic of the endstop.
#define Z_MIN_PROBE_ENDSTOP_INVERTING true // set to true to invert the logic of the endstop. #define Z_MIN_PROBE_ENDSTOP_INVERTING true // set to true to invert the logic of the endstop.
// If all used endstop pins are able to cause interrupts, you can enable ENDSTOP_INTERRUPTS_FEATURE. // Enable this feature if all enabled endstop pins are interrupt-capable.
// Then the function testing the endstops will only be called, if the state of one of the endstops changed. // This will remove the need to poll the interrupt pins, saving many CPU cycles.
//#define ENDSTOP_INTERRUPTS_FEATURE //#define ENDSTOP_INTERRUPTS_FEATURE
//============================================================================= //=============================================================================

View file

@ -445,8 +445,8 @@
#define Z_MAX_ENDSTOP_INVERTING true // set to true to invert the logic of the endstop. #define Z_MAX_ENDSTOP_INVERTING true // set to true to invert the logic of the endstop.
#define Z_MIN_PROBE_ENDSTOP_INVERTING false // set to true to invert the logic of the endstop. #define Z_MIN_PROBE_ENDSTOP_INVERTING false // set to true to invert the logic of the endstop.
// If all used endstop pins are able to cause interrupts, you can enable ENDSTOP_INTERRUPTS_FEATURE. // Enable this feature if all enabled endstop pins are interrupt-capable.
// Then the function testing the endstops will only be called, if the state of one of the endstops changed. // This will remove the need to poll the interrupt pins, saving many CPU cycles.
//#define ENDSTOP_INTERRUPTS_FEATURE //#define ENDSTOP_INTERRUPTS_FEATURE
//============================================================================= //=============================================================================

View file

@ -442,8 +442,8 @@
#define Z_MAX_ENDSTOP_INVERTING true // set to true to invert the logic of the endstop. #define Z_MAX_ENDSTOP_INVERTING true // set to true to invert the logic of the endstop.
#define Z_MIN_PROBE_ENDSTOP_INVERTING false // set to true to invert the logic of the endstop. #define Z_MIN_PROBE_ENDSTOP_INVERTING false // set to true to invert the logic of the endstop.
// If all used endstop pins are able to cause interrupts, you can enable ENDSTOP_INTERRUPTS_FEATURE. // Enable this feature if all enabled endstop pins are interrupt-capable.
// Then the function testing the endstops will only be called, if the state of one of the endstops changed. // This will remove the need to poll the interrupt pins, saving many CPU cycles.
//#define ENDSTOP_INTERRUPTS_FEATURE //#define ENDSTOP_INTERRUPTS_FEATURE
//============================================================================= //=============================================================================

View file

@ -460,8 +460,8 @@
#define Z_MAX_ENDSTOP_INVERTING true // set to true to invert the logic of the endstop. #define Z_MAX_ENDSTOP_INVERTING true // set to true to invert the logic of the endstop.
#define Z_MIN_PROBE_ENDSTOP_INVERTING false // set to true to invert the logic of the endstop. #define Z_MIN_PROBE_ENDSTOP_INVERTING false // set to true to invert the logic of the endstop.
// If all used endstop pins are able to cause interrupts, you can enable ENDSTOP_INTERRUPTS_FEATURE. // Enable this feature if all enabled endstop pins are interrupt-capable.
// Then the function testing the endstops will only be called, if the state of one of the endstops changed. // This will remove the need to poll the interrupt pins, saving many CPU cycles.
//#define ENDSTOP_INTERRUPTS_FEATURE //#define ENDSTOP_INTERRUPTS_FEATURE
//============================================================================= //=============================================================================

View file

@ -466,8 +466,8 @@
#define Z_MAX_ENDSTOP_INVERTING true // set to true to invert the logic of the endstop. #define Z_MAX_ENDSTOP_INVERTING true // set to true to invert the logic of the endstop.
#define Z_MIN_PROBE_ENDSTOP_INVERTING false // set to true to invert the logic of the endstop. #define Z_MIN_PROBE_ENDSTOP_INVERTING false // set to true to invert the logic of the endstop.
// If all used endstop pins are able to cause interrupts, you can enable ENDSTOP_INTERRUPTS_FEATURE. // Enable this feature if all enabled endstop pins are interrupt-capable.
// Then the function testing the endstops will only be called, if the state of one of the endstops changed. // This will remove the need to poll the interrupt pins, saving many CPU cycles.
//#define ENDSTOP_INTERRUPTS_FEATURE //#define ENDSTOP_INTERRUPTS_FEATURE
//============================================================================= //=============================================================================

View file

@ -437,8 +437,8 @@
#define Z_MAX_ENDSTOP_INVERTING true // set to true to invert the logic of the endstop. #define Z_MAX_ENDSTOP_INVERTING true // set to true to invert the logic of the endstop.
#define Z_MIN_PROBE_ENDSTOP_INVERTING true // set to true to invert the logic of the endstop. #define Z_MIN_PROBE_ENDSTOP_INVERTING true // set to true to invert the logic of the endstop.
// If all used endstop pins are able to cause interrupts, you can enable ENDSTOP_INTERRUPTS_FEATURE. // Enable this feature if all enabled endstop pins are interrupt-capable.
// Then the function testing the endstops will only be called, if the state of one of the endstops changed. // This will remove the need to poll the interrupt pins, saving many CPU cycles.
//#define ENDSTOP_INTERRUPTS_FEATURE //#define ENDSTOP_INTERRUPTS_FEATURE
//============================================================================= //=============================================================================

View file

@ -445,8 +445,8 @@
#define Z_MAX_ENDSTOP_INVERTING false // set to true to invert the logic of the endstop. #define Z_MAX_ENDSTOP_INVERTING false // set to true to invert the logic of the endstop.
#define Z_MIN_PROBE_ENDSTOP_INVERTING false // set to true to invert the logic of the endstop. #define Z_MIN_PROBE_ENDSTOP_INVERTING false // set to true to invert the logic of the endstop.
// If all used endstop pins are able to cause interrupts, you can enable ENDSTOP_INTERRUPTS_FEATURE. // Enable this feature if all enabled endstop pins are interrupt-capable.
// Then the function testing the endstops will only be called, if the state of one of the endstops changed. // This will remove the need to poll the interrupt pins, saving many CPU cycles.
//#define ENDSTOP_INTERRUPTS_FEATURE //#define ENDSTOP_INTERRUPTS_FEATURE
//============================================================================= //=============================================================================

View file

@ -489,8 +489,8 @@
#define Z_MAX_ENDSTOP_INVERTING false // set to true to invert the logic of the endstop. #define Z_MAX_ENDSTOP_INVERTING false // set to true to invert the logic of the endstop.
#define Z_MIN_PROBE_ENDSTOP_INVERTING true // set to true to invert the logic of the endstop. #define Z_MIN_PROBE_ENDSTOP_INVERTING true // set to true to invert the logic of the endstop.
// If all used endstop pins are able to cause interrupts, you can enable ENDSTOP_INTERRUPTS_FEATURE. // Enable this feature if all enabled endstop pins are interrupt-capable.
// Then the function testing the endstops will only be called, if the state of one of the endstops changed. // This will remove the need to poll the interrupt pins, saving many CPU cycles.
//#define ENDSTOP_INTERRUPTS_FEATURE //#define ENDSTOP_INTERRUPTS_FEATURE
//============================================================================= //=============================================================================

View file

@ -489,8 +489,8 @@
#define Z_MAX_ENDSTOP_INVERTING true // set to true to invert the logic of the endstop. #define Z_MAX_ENDSTOP_INVERTING true // set to true to invert the logic of the endstop.
#define Z_MIN_PROBE_ENDSTOP_INVERTING true // set to true to invert the logic of the endstop. #define Z_MIN_PROBE_ENDSTOP_INVERTING true // set to true to invert the logic of the endstop.
// If all used endstop pins are able to cause interrupts, you can enable ENDSTOP_INTERRUPTS_FEATURE. // Enable this feature if all enabled endstop pins are interrupt-capable.
// Then the function testing the endstops will only be called, if the state of one of the endstops changed. // This will remove the need to poll the interrupt pins, saving many CPU cycles.
//#define ENDSTOP_INTERRUPTS_FEATURE //#define ENDSTOP_INTERRUPTS_FEATURE
//============================================================================= //=============================================================================

View file

@ -489,8 +489,8 @@
#define Z_MAX_ENDSTOP_INVERTING false // set to true to invert the logic of the endstop. #define Z_MAX_ENDSTOP_INVERTING false // set to true to invert the logic of the endstop.
#define Z_MIN_PROBE_ENDSTOP_INVERTING false // set to true to invert the logic of the endstop. #define Z_MIN_PROBE_ENDSTOP_INVERTING false // set to true to invert the logic of the endstop.
// If all used endstop pins are able to cause interrupts, you can enable ENDSTOP_INTERRUPTS_FEATURE. // Enable this feature if all enabled endstop pins are interrupt-capable.
// Then the function testing the endstops will only be called, if the state of one of the endstops changed. // This will remove the need to poll the interrupt pins, saving many CPU cycles.
//#define ENDSTOP_INTERRUPTS_FEATURE //#define ENDSTOP_INTERRUPTS_FEATURE
//============================================================================= //=============================================================================

View file

@ -478,8 +478,8 @@
#define Z_MAX_ENDSTOP_INVERTING false // set to true to invert the logic of the endstop. #define Z_MAX_ENDSTOP_INVERTING false // set to true to invert the logic of the endstop.
#define Z_MIN_PROBE_ENDSTOP_INVERTING false // set to true to invert the logic of the endstop. #define Z_MIN_PROBE_ENDSTOP_INVERTING false // set to true to invert the logic of the endstop.
// If all used endstop pins are able to cause interrupts, you can enable ENDSTOP_INTERRUPTS_FEATURE. // Enable this feature if all enabled endstop pins are interrupt-capable.
// Then the function testing the endstops will only be called, if the state of one of the endstops changed. // This will remove the need to poll the interrupt pins, saving many CPU cycles.
//#define ENDSTOP_INTERRUPTS_FEATURE //#define ENDSTOP_INTERRUPTS_FEATURE
//============================================================================= //=============================================================================

View file

@ -487,8 +487,8 @@
#define Z_MAX_ENDSTOP_INVERTING false // set to true to invert the logic of the endstop. #define Z_MAX_ENDSTOP_INVERTING false // set to true to invert the logic of the endstop.
#define Z_MIN_PROBE_ENDSTOP_INVERTING false // set to true to invert the logic of the endstop. #define Z_MIN_PROBE_ENDSTOP_INVERTING false // set to true to invert the logic of the endstop.
// If all used endstop pins are able to cause interrupts, you can enable ENDSTOP_INTERRUPTS_FEATURE. // Enable this feature if all enabled endstop pins are interrupt-capable.
// Then the function testing the endstops will only be called, if the state of one of the endstops changed. // This will remove the need to poll the interrupt pins, saving many CPU cycles.
//#define ENDSTOP_INTERRUPTS_FEATURE //#define ENDSTOP_INTERRUPTS_FEATURE
//============================================================================= //=============================================================================

View file

@ -448,8 +448,8 @@
#define Z_MAX_ENDSTOP_INVERTING true // set to true to invert the logic of the endstop. #define Z_MAX_ENDSTOP_INVERTING true // set to true to invert the logic of the endstop.
#define Z_MIN_PROBE_ENDSTOP_INVERTING false // set to true to invert the logic of the endstop. #define Z_MIN_PROBE_ENDSTOP_INVERTING false // set to true to invert the logic of the endstop.
// If all used endstop pins are able to cause interrupts, you can enable ENDSTOP_INTERRUPTS_FEATURE. // Enable this feature if all enabled endstop pins are interrupt-capable.
// Then the function testing the endstops will only be called, if the state of one of the endstops changed. // This will remove the need to poll the interrupt pins, saving many CPU cycles.
//#define ENDSTOP_INTERRUPTS_FEATURE //#define ENDSTOP_INTERRUPTS_FEATURE
//============================================================================= //=============================================================================

View file

@ -435,8 +435,8 @@
#define Z_MAX_ENDSTOP_INVERTING true // set to true to invert the logic of the endstop. #define Z_MAX_ENDSTOP_INVERTING true // set to true to invert the logic of the endstop.
#define Z_MIN_PROBE_ENDSTOP_INVERTING true // set to true to invert the logic of the endstop. #define Z_MIN_PROBE_ENDSTOP_INVERTING true // set to true to invert the logic of the endstop.
// If all used endstop pins are able to cause interrupts, you can enable ENDSTOP_INTERRUPTS_FEATURE. // Enable this feature if all enabled endstop pins are interrupt-capable.
// Then the function testing the endstops will only be called, if the state of one of the endstops changed. // This will remove the need to poll the interrupt pins, saving many CPU cycles.
//#define ENDSTOP_INTERRUPTS_FEATURE //#define ENDSTOP_INTERRUPTS_FEATURE
//============================================================================= //=============================================================================

View file

@ -378,19 +378,21 @@ void Stepper::isr() {
} }
// Update endstops state, if enabled // Update endstops state, if enabled
if (endstops.enabled if ((endstops.enabled
#if HAS_BED_PROBE #if HAS_BED_PROBE
|| endstops.z_probe_enabled || endstops.z_probe_enabled
#endif #endif
) )
#if ENABLED(ENDSTOP_INTERRUPTS_FEATURE) #if ENABLED(ENDSTOP_INTERRUPTS_FEATURE)
if(e_hit) { && e_hit
#endif #endif
) {
endstops.update(); endstops.update();
#if ENABLED(ENDSTOP_INTERRUPTS_FEATURE) #if ENABLED(ENDSTOP_INTERRUPTS_FEATURE)
e_hit--; e_hit--;
}
#endif #endif
}
// Take multiple steps per interrupt (For high speed moves) // Take multiple steps per interrupt (For high speed moves)
bool all_steps_done = false; bool all_steps_done = false;