 #endif
 
 #if PIR_PORT
-    #define PIR_HOLD_TIME   30  // hold PIR value this many seconds after change
-    #define PIR_PULLUP      1   // set to one to pull-up the PIR input pin
-    #define PIR_INVERTED    1   // 0 or 1, to match PIR reporting high or low
+    #define PIR_PULLUP   1 // set to one to pull-up the PIR input pin
+    #define PIR_INVERTED 0 // 0 or 1, to match PIR reporting high or low
 
     /// Interface to a Passive Infrared motion sensor.
     class PIR : public Port {
         volatile byte value, changed;
-        volatile uint32_t lastOn;
+
     public:
         PIR (byte portnum)
-            : Port (portnum), value (0), changed (0), lastOn (0) {}
+            : Port (portnum), value (0), changed (0) {}
 
         // this code is called from the pin-change interrupt handler
         void poll() {
             // see http://talk.jeelabs.net/topic/811#post-4734 for PIR_INVERTED
             byte pin = digiRead() ^ PIR_INVERTED;
-            // if the pin just went on, then set the changed flag to report it
-            if (pin) {
-                if (!state())
-                    changed = 1;
-                lastOn = millis();
-            }
+
+            // if the pin changed then set the changed flag to report it
+            if (pin != state())
+                changed = 1;
+
             value = pin;
         }
 
         // state is true if curr value is still on or if it was on recently
         byte state() const {
             byte f = value;
-            if (lastOn > 0)
-                ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
-                    if (millis() - lastOn < 1000 * PIR_HOLD_TIME)
-                        f = 1;
-                }
             return f;
         }
 

        delay(RETRY_PERIOD * 100);
    }
    scheduler.timer(MEASURE, MEASURE_PERIOD);
    #if DEBUG
        Serial.println(" no ack!");
        serialFlush();
    #endif
}

void blink (byte pin) {

            doReport();
            break;
    }
}
