 int SENSORDELAY = 3000; // milliseconds (runs x1)
 int EVENTSDELAY = 1000; // milliseconds (runs x10)
 int OTAUPDDELAY = 7000; // milliseconds (runs x1)
-int SLEEP_DELAY = 40; // 40 seconds (runs x1) - should get about 24 hours on 2100mAH, 0 to disable and use RELAX_DELAY instead
+int SLEEP_DELAY = 0; // 40 seconds (runs x1) - should get about 24 hours on 2100mAH, 0 to disable and use RELAX_DELAY instead
 String SLEEP_DELAY_MIN = "15"; // seconds - easier to store as string then convert to int
 String SLEEP_DELAY_STATUS = "OK"; // always OK to start with
-int RELAX_DELAY = 40; // seconds (runs x1) - no power impact, just idle/relaxing
+int RELAX_DELAY = 10; // seconds (runs x1) - no power impact, just idle/relaxing
+
+// Variables for the I2C scan
+byte I2CERR, I2CADR;
+
+//********************************************************************************
+//********************************************************************************
+//********************************************************************************
 
 int I2CEN = D2;
 int ALGEN = D3;

int readWeatherBMP180() {
    Adafruit_BMP085_Unified bmp180 = Adafruit_BMP085_Unified(10085);
    BMP180OK = bmp180.begin(); // Initialize BMP180

    if (BMP180OK)
    {

}

int readMotion() {
    FOXFIRE_MPU9150 mpu9150;
    ACCELOK = mpu9150.begin(mpu9150._addr_motion); // Initialize MPU9150

    if (ACCELOK)
    {
        // Clear the 'sleep' bit to start the sensor.
        mpu9150.writeSensor(mpu9150._addr_motion, MPU9150_PWR_MGMT_1, 0);

        // Set up compass
        mpu9150.writeSensor(mpu9150._addr_compass, 0x0A, 0x00); //PowerDownMode
        mpu9150.writeSensor(mpu9150._addr_compass, 0x0A, 0x0F); //SelfTest
        mpu9150.writeSensor(mpu9150._addr_compass, 0x0A, 0x00); //PowerDownMode

        mpu9150.writeSensor(mpu9150._addr_motion, 0x24, 0x40); //Wait for Data at Slave0
        mpu9150.writeSensor(mpu9150._addr_motion, 0x25, 0x8C); //Set i2c address at slave0 at 0x0C
        mpu9150.writeSensor(mpu9150._addr_motion, 0x26, 0x02); //Set where reading at slave 0 starts
        mpu9150.writeSensor(mpu9150._addr_motion, 0x27, 0x88); //set offset at start reading and enable
        mpu9150.writeSensor(mpu9150._addr_motion, 0x28, 0x0C); //set i2c address at slv1 at 0x0C
        mpu9150.writeSensor(mpu9150._addr_motion, 0x29, 0x0A); //Set where reading at slave 1 starts
        mpu9150.writeSensor(mpu9150._addr_motion, 0x2A, 0x81); //Enable at set length to 1
        mpu9150.writeSensor(mpu9150._addr_motion, 0x64, 0x01); //overvride register
        mpu9150.writeSensor(mpu9150._addr_motion, 0x67, 0x03); //set delay rate
        mpu9150.writeSensor(mpu9150._addr_motion, 0x01, 0x80);

        mpu9150.writeSensor(mpu9150._addr_motion, 0x34, 0x04); //set i2c slv4 delay
        mpu9150.writeSensor(mpu9150._addr_motion, 0x64, 0x00); //override register
        mpu9150.writeSensor(mpu9150._addr_motion, 0x6A, 0x00); //clear usr setting
        mpu9150.writeSensor(mpu9150._addr_motion, 0x64, 0x01); //override register
        mpu9150.writeSensor(mpu9150._addr_motion, 0x6A, 0x20); //enable master i2c mode
        mpu9150.writeSensor(mpu9150._addr_motion, 0x34, 0x13); //disable slv4

        // Read all sensor values which the sensor provides
        // Formated all values as x, y, and z in order for
        // Compass, Gyro, Acceleration. The First value is
        // the temperature.

        tm = ( (double) mpu9150.readSensor(mpu9150._addr_motion, MPU9150_TEMP_OUT_L, MPU9150_TEMP_OUT_H) + 12412.0 ) / 340.0;
        cx = mpu9150.readSensor(mpu9150._addr_motion, MPU9150_CMPS_XOUT_L, MPU9150_CMPS_XOUT_H);
        cy = mpu9150.readSensor(mpu9150._addr_motion, MPU9150_CMPS_YOUT_L, MPU9150_CMPS_YOUT_H);
        cz = mpu9150.readSensor(mpu9150._addr_motion, MPU9150_CMPS_ZOUT_L, MPU9150_CMPS_ZOUT_H);
        ax = mpu9150.readSensor(mpu9150._addr_motion, MPU9150_ACCEL_XOUT_L, MPU9150_ACCEL_XOUT_H);
        ay = mpu9150.readSensor(mpu9150._addr_motion, MPU9150_ACCEL_YOUT_L, MPU9150_ACCEL_YOUT_H);
        az = mpu9150.readSensor(mpu9150._addr_motion, MPU9150_ACCEL_ZOUT_L, MPU9150_ACCEL_ZOUT_H);
        gx = mpu9150.readSensor(mpu9150._addr_motion, MPU9150_GYRO_XOUT_L, MPU9150_GYRO_XOUT_H);
        gy = mpu9150.readSensor(mpu9150._addr_motion, MPU9150_GYRO_YOUT_L, MPU9150_GYRO_YOUT_H);
        gz = mpu9150.readSensor(mpu9150._addr_motion, MPU9150_GYRO_ZOUT_L, MPU9150_GYRO_ZOUT_H);
    }

    return ACCELOK ? 1 : 0;
