 
 
   // fast debounce driver error signals to filter short glitches
-  debounce(motorDiagAPin, &motorDiagA, &motorDiagADebounce);
-  debounce(motorDiagBPin, &motorDiagB, &motorDiagBDebounce);
+  debounce(motorDiagAPin, &motorDiagA, &motorDiagADeglitch, &motorDiagADebounce);
+  debounce(motorDiagBPin, &motorDiagB, &motorDiagBDeglitch, &motorDiagBDebounce);
 
   // The WAM is overheating!
   if ((motorDiagA == LOW || motorDiagB == LOW) && doorState != doorError) {

    motorEnable();

    // diag pull-ups should have brought the lines up by now
    motorDiagADebounce = (motorDiagA = digitalRead(motorDiagAPin)) * 0xFFFF;
    motorDiagBDebounce = (motorDiagB = digitalRead(motorDiagBPin)) * 0xFFFF;

    if (doorState != doorBlocked) {
      motorBrake();

unsigned long ledMillis = 0;

bool swFront, swBack, swTrigger, motorDiagA, motorDiagB; // debounced inputs
bool swFrontDeglitch, swBackDeglitch, swTriggerDeglitch, motorDiagADeglitch, motorDiagBDeglitch; // TODO: quick hack. document
uint16_t swFrontDebounce, swBackDebounce, swTriggerDebounce, motorDiagADebounce, motorDiagBDebounce; // debounce shift registers


