grbl/grbl — pull request #490 by tmpvar (2014-09-14 22:59:54+00:00)
Title: install G38.{3,4,5} commands

This is accomplished by adding a `sys.probe_away` flag that is used to flip the direction of the switch depending on which direction we are probing in.

truth table

```

towards (G38.2, G38.3) away (G38.4, G38.5)
before sys.probe_away = 0 sys.probe_away = 1
sys.probe_state = 0 sys.probe_state = 1

after sys.probe_away = 0 sys.probe_away = 1
sys.probe_state = 1 sys.probe_state = 0
```

This assumes that the switch is engaged when "probing away" begins, which appears to be sound given the wording in linuxcnc's description

```
G38.2 - probe toward workpiece, stop on contact, signal error if failure
G38.3 - probe toward workpiece, stop on contact
G38.4 - probe away from workpiece, stop on loss of contact, signal error if failure
G38.5 - probe away from workpiece, stop on loss of contact
```

grbl with this patch builds at 27758 bytes vs master at 27654 bytes