The conventional wisdom of CNC is to wire Single-Throw limit switches as "normally closed" so the chip's I/O pad is connected directly to a power supply rail (VDD) during normal operation and therefore as noise-immune as possible. A limit-hit is signaled by the switch opening, which leaves the chip I/O pad floating; presumably there is a weak pull-down resistor to drag it down to GND.
HOWEVER: we aren't using single-throw switches! Our switches are double-throw switches: normally they connect the chip I/O pad to VDD, and when the limit is hit they connect it to GND. With a double-throw switch neither position is inherently more noise-immune than the other: you've got the chip I/O pad directly connected to a power supply rail through the same amount of wiring either way.
HOWEVER-EVER: there is a twist. Atmel AVR chip I/O pads include an optional weak pull-up resistor, but not a weak pull-down. The weak pull is useful for detecting when a switch has become unwired for some reason.
HOWEVER-EVER-EVER: the TinyG ALWAYS ENABLES THE PULL UP, NO MATTER WHICH SWITCH TYPE YOU HAVE SET. I just verified this. This is kinda bonkers. This means that if a normally-closed-configured limit switch comes unwired the TinyG won't notice! Days or weeks later, the machine could smash itself to pieces if run unattended. Very very bad. It also means that single-throw switches simply won't work in normally-open mode, although I guess you shouldn't do that anyways. The TinyG ought to disable the AVR I/O pad pull-up when $st=0 (Normally Open).
Conclusion: we should wire our switches as Normally-Closed-to-GND (swap the "NO" and "NC" terminals on the switch, then tell TinyG they are "normally-open" even thought this is technically incorrect). This will have these consequences:
- [li] Not any more or less noise-sensitive, because we are using double-throw switches
[li] If a switch comes unwired for any reason (defective switch, broken wire, etc) it will register as "limit hit" and prevent further operation until repaired.