 }
 
 //-----------------------------------------------------------------------------
-// generates a sensor report, sending it to the RF gateway
-void report() {    
-    sensors->report(sensorData);
+// Generates a sensor report, sending it to the RF gateway
+void report(byte type, byte component) {
+  sensors->report(sensorData);
     
-    memset(&outbound, 0, sizeof(outbound));
-    outbound.msg.type = MSG_READING;
-    outbound.msg.source = NODEID;
-    outbound.msg.destination = 0;
-    outbound.msg.component = 0;
-    outbound.msg.rssi = 0;
-    memcpy(&outbound.msg.data, sensorData, sizeof(*sensorData));
+  memset(&outbound, 0, sizeof(outbound));
+  outbound.msg.type = type;
+  outbound.msg.source = NODEID;
+  outbound.msg.destination = 0;
+  outbound.msg.component = component;
+  outbound.msg.rssi = 0;
+  memcpy(&outbound.msg.data, sensorData, sizeof(*sensorData));
     
+  #if DEBUG
+    Serial.print("Broadcasting report to gateway...");
+  #endif
+  if (radio.sendWithRetry(GATEWAYID, outbound.raw, MSG_LENGTH)) {
     #if DEBUG
-        Serial.print("Broadcasting report to gateway...");
+      Serial.println("ACK");
     #endif
-    if (radio.sendWithRetry(GATEWAYID, outbound.raw, MSG_LENGTH)) {
-        #if DEBUG
-            Serial.println("ACK");
-        #endif
-    } else {
-        #if DEBUG
-            Serial.println("No ACK!");
-        #endif
-    }
+  } else {
+    #if DEBUG
+      Serial.println("No ACK!");
+    #endif
+  }
 }
 

// Main Loop
//
void loop () {
    if (f_timer == 1) {
        f_timer = 0;
        enterSleep();
    }
    
}

//-----------------------------------------------------------------------------
// Timer1 Interrupt Service Routine
ISR(TIMER1_OVF_vect) {
     if (f_timer == 0) {
        f_timer = 1;
        
        noInterrupts();
        digitalWrite(MOTE_LED_PIN, HIGH);        
        sensors->measure();
        report();
        digitalWrite(MOTE_LED_PIN, LOW);
        interrupts();         
        
     }
}

//-----------------------------------------------------------------------------
// sleeps the microcontroller until the internal timer expires
void enterSleep(void) {
  set_sleep_mode(SLEEP_MODE_IDLE);
  

   * A2 - Temperature
   * D3 - Water Leak detector
 
   Created 15-MAR-2015 by Jon Brule
----------------------------------------------------------------------------- */
#include <avr/sleep.h>
#include <avr/power.h>
