   return oldestIndex;
 }
 
-/**
- * Send the correct message for the correct number of times.
- */
+/*
+// Send the correct message for the correct number of times.
 void processMsgQueue()
 {
+return;
+  
   if (millis() - lastTransmit > MSG_TRANSMIT_DELAY) {
     // Time to send another transmition if one is waiting.
     byte oldestIndex = getOldestMsqQueueIndex(); 

#define PING_INTERVAL 33 // Milliseconds between sensor pings (29ms is about the min to avoid cross-sensor echo).

// Flags definitions
#define F_MOTION 1 // 1 = activated  0 = no movement
#define F_LEFT   2 // 1 = detection  0 = no detection
#define F_RIGHT  3 // 1 = detection  0 = no detection
#define F_ACTIVE_LEFT   4 // 1 = detection  0 = no detection
#define F_ACTIVE_RIGHT  5 // 1 = detection  0 = no detection

#define MSG_BUFFER_LEN   30    // How long the transmitted message can be.
#define MSG_QUEUE_LENGTH 3     // How many transmission message to store.
#define MSG_TRANSMIT_NUM 5     // How many times to transmit each message.
#define MSG_TRANSMIT_DELAY 100 // How long to wait before sending the next message.

const byte DISTANCE_THRESHOLD = 40; // Less than this (in cm) activates the detection sequence.

// Pins
const byte PIN_PIR = 2;         // PIR on external interupt to wake up the cpu, int.0 interupt 0 on pin 2

/**
 * Create a transmition message
 */
void createTransmitionMsg(char movementDirection)
{
  msgId++;
  char buf[MSG_BUFFER_LEN];
  // Device rf id, message id, direction char, volts
  sprintf(buf, "%u,%lu,%c,%lu", RF_ID, msgId, movementDirection, readVcc());
  // TODO queue message for transmition multiple times.
  transmit(buf); // just send it for now.
  //msgEnqueue(buf);
}


void msgEnqueue(char *msg) 
{
  unsigned long now = millis();
  byte queued = 0;
  for (uint8_t i = 0; i < MSG_QUEUE_LENGTH; i++) {
    Serial.print(i); Serial.print(" - "); //Serial.println();
    
    Serial.println(msgQueue[i]);
    // MMMMmmmm they all end up the same, is the pointer pointing to the same thing????
    if (msgQueue[i][0] == '0') { // String is just "0".
      msgQueue[i] = msg;
      msgTime[i] = now;
      return;
      //queued = 1; // Managed to add to the queue.
    }
    
  }
  /*
  if (queued == 0) {
    // Didn't get into the queue.
    byte oldestIndex = getOldestMsqQueueIndex(); 
