 }
 
 void setup () {
-    #if SERIAL || DEBUG
-        Serial.begin(57600);
-        Serial.print("\n[roomNode.3]");
-        myNodeID = rf12_config();
-        serialFlush();
-    #else
-        myNodeID = rf12_config(0); // don't report info on the serial port
-    #endif
+#if SERIAL || DEBUG
+    Serial.begin(57600);
+    Serial.print("\n[roomNode.3]");
+    myNodeID = rf12_config();
+    serialFlush();
+#else
+    myNodeID = rf12_config(0); // don't report info on the serial port
+#endif
 
     rf12_sleep(RF12_SLEEP); // power down
 
-    #if PIR_PORT
-        pir.digiWrite(PIR_PULLUP);
+#if PIR_PORT
+    pir.digiWrite(PIR_PULLUP);
 #ifdef PCMSK2
-        bitSet(PCMSK2, PIR_PORT + 3);
-        bitSet(PCICR, PCIE2);
+    bitSet(PCMSK2, PIR_PORT + 3);
+    bitSet(PCICR, PCIE2);
 #else
         //XXX TINY!
 #endif
-    #endif
+#endif
 
     reportCount = REPORT_EVERY;     // report right away for easy debugging
     scheduler.timer(MEASURE, 0);    // start the measurement loop going
 }
 
 void loop () {
-    #if DEBUG
-        Serial.print('.');
-        serialFlush();
-    #endif
-
-    #if PIR_PORT
-        if (pir.triggered()) {
-            payload.moved = pir.state();
-            doTrigger();
-        }
-    #endif
+#if DEBUG
+    Serial.print('.');
+    serialFlush();
+#endif
+
+#if PIR_PORT
+    if (pir.triggered()) {
+        payload.moved = pir.state();
+        doTrigger();
+    }
+#endif
 
     switch (scheduler.pollWaiting()) {
-
         case MEASURE:
             // reschedule these measurements periodically
             scheduler.timer(MEASURE, MEASURE_PERIOD);


    payload.lobat = rf12_lowbat();

    #if SHT11_PORT
#ifndef __AVR_ATtiny84__
        sht11.measure(SHT11::HUMI, shtDelay);
        sht11.measure(SHT11::TEMP, shtDelay);
        float h, t;
        sht11.calculate(h, t);
        int humi = h + 0.5, temp = 10 * t + 0.5;
#else
        //XXX TINY!
        int humi = 50, temp = 25;
#endif
        payload.humi = smoothedAverage(payload.humi, humi, firstTime);
        payload.temp = smoothedAverage(payload.temp, temp, firstTime);
    #endif
    #if LDR_PORT
        ldr.digiWrite2(1);  // enable AIO pull-up
        byte light = ~ ldr.anaRead() >> 2;
        ldr.digiWrite2(0);  // disable pull-up to reduce current draw
        payload.light = smoothedAverage(payload.light, light, firstTime);
    #endif
    #if PIR_PORT
        payload.moved = pir.state();
    #endif
}

static void serialFlush () {
    #if ARDUINO >= 100
        Serial.flush();
    #endif
    delay(2); // make sure tx buf is empty before going back to sleep
}


        rf12_sleep(RF12_SLEEP);

        if (acked) {
#if DEBUG
            Serial.print(" ack ");
            Serial.println((int) i);
            serialFlush();
#endif

            // reset scheduling to start a fresh measurement cycle
            scheduler.timer(MEASURE, MEASURE_PERIOD);
            return;
