To allow for the case where a Z endstop (e.g., hall effect) is higher than the probe trigger point, don't check the Z min endstop during probe moves. See #11134
* Misc fixes and improvements
- Get rid of most critical sections on the Serial port drivers for AVR and DUE. Proper usage of FIFOs should allow interrupts to stay enabled without harm to queuing and dequeuing.
Also, with 8-bit indices (for AVR) and up to 32-bit indices (for ARM), there is no need to protect reads and writes to those indices.
- Simplify the XON/XOFF logic quite a bit. Much cleaner now (both for AVR and ARM)
- Prevent a race condition (edge case) that could happen when estimating the proper value for the stepper timer (by reading it) and writing the calculated value for the time to the next ISR by disabling interrupts in those critical and small sections of the code - The problem could lead to lost steps.
- Fix dual endstops not properly homing bug (maybe).
* Set position immediately when possible
1. The CORExx printers were checking more endstop axis than needed.
2. Removed all the CORE_xx_NOT logic. The motor_direction(xx) routine
always returns the correct data so it is not needed. It was actually
cause the wrong direction to be checked in some cases.
3. Made the logic/defines for X, Y & Z axis all the same. The old logic
checked inappropriate configurations for Y and didn't check all the
correct configurations on Z.
4. Added a check for zero steps before the X, Y & Z axis. Previously
would check the they axis even if there were no movement.
Made the double touch portion a conditional compile based on the
PROBE_DOUBLE_TOUCH flag.
==============================================
Bugfix
The current G38 only stopped a move if it involved the Z axis.
Moved all the G38 code to it's own section and put it where it would
always be executed no matter what axis was moving or if the endstop was
enabled.
Also added a comment to configuration_adv to alert the user the double
tap had to be turned on.
==============================================
Change G38 back to using Z_MIN_PROBE
There's no Z_MIN endstop if Z_DUAL_ENDSTOPS is enabled and you have them
set to the top of the gantry.
G38 started out as using the Z_MIN_PROBE pin. I don't remember why we
changed it to the Z_MIN endstop.
In the endstop testing section, add the "reverse" logic in addition to "normal" core handling.
In CoreXY/YZ/XZ steppers rotating the same direction gives X movement. Opposing directions produces Y movement.
In CoreYX/ZY/ZX this is reversed. Same = Y, Opposite = X.
----
Fixes the issue where the Y endstop was being checked when moving in the X direction, etc.
1) modified 3 code files
Marlin.h
Marlin_main.cpp
endstops.cpp
2) modified config files so I could test on my machine
Testing was done on an AzteegX3pro based machine.
The probe was hooked to the Z_MIN endstop.
My controller doesn't have a dedicated Z_PROBE input so I couldn't test
that functionality.
Verified that a large file (without any G38 commands) executed the same
before and after the changes.
Verified that the head moves as expected when G38.2 and G38.3 commands
are issued. Single & multiple axis moves were tested along with + and -
directions.
Code was added to the main ISR. In normal operation only one extra IF
statement is evaluated. I didn't notice any performance degradation
because of the added code.
The G38 commands are expected to be issued manually by the operator
during machine setup. The G38 commands wait until the machine is idle
before proceeding. That way the other commands are minimally impacted
by the extra ISR overhead when a G38 command is in the queue.
The G38 commands are very similar to the G28 commands except 1) only the
Z_PROBE is used and movement can be in the + or - direction.
See issue 4677 for a discussion on adding G38 commands to Marlin.
Feature request: add ability to use G38.2 command (CNC)
MarlinFirmware/Marlin#4677