 const unsigned int UPDATE_INTERVAL = 15000;
 const unsigned int DIGITS = 2;
 const unsigned int PRECISION = 2;
-const unsigned int DHT_TYPE = DHT22; // DHT 22  (AM2302)
 
 /* --- Variables --- */
 int chksum;
-boolean canbus_status = 0;
-boolean pump_off = false;
-boolean fan_off = false;
-boolean cooling_required = false;
-
+bool canbus_status = 0;
+bool pump_off = false;
+bool fan_off = false;
+bool irrigation_required = false;
+bool cooling_required = false;
+int moisture_sp_low = 30;
+int moisture_sp_high = 60;
+int temperature_sp_low = 25;
+int temperature_sp_high = 35;
 int temperature_pv = 0;
+int volts_a = 1024;
+int volts_b = 0;
+int moisture_a = 0;
+int moisture_b = 100;
 int moisture_pv = 0;
-float internal_humidity = 0;
-float internal_temperature = 0;
 
 // Buffers
 char output_buffer[OUTPUT_LENGTH];




/*
Offroad kit for trail feedback
 
 This build supports the following sensor functions:
 - Roll
 - Pitch
 - Intake Temperature
 - Transfer Case Temperature
 - Steering Position
 - Front Suspension Position
 - Differential Ground Clearance Sensor
 
 */

/* --- Libraries --- */
#include <Adafruit_LSM303.h>
#include <Adafruit_L3GD20.h>
#include <Adafruit_L3GD20_U.h>
#include <Adafruit_BMP085_U.h>
#include "Wire.h"
#include "Adafruit_Sensor.h"
#include "Canbus.h"
#include "ArduinoJson.h"
#include "RunningMedian.h"
#include "DallasTemperature.h"
#include "OneWire.h"
#include "stdio.h"
#include "DHT.h"
#include "Adafruit_10DOF.h"

/* --- Prototypes --- */
int checksum(char *buf);

/* --- Global --- */
// Digital IO Pins
// Pins 0 - 1 Reserved for TTY
const unsigned int DHT_PIN = 2;
const unsigned int TEMP_ENGINE_PIN = 3;
const unsigned int TEMP_TRANSFERCASE_PIN = 4;
const unsigned int TEMP_INTAKE_PIN = 5;
const unsigned int SENSOR_POWER_PIN = 7; 
const unsigned int FAN_RELAY_PIN = 8;
const unsigned int LOCKER_RELAY_PIN = 9;
// Pins 10 - 13 Reserved for CANBus SPI

// Analog IO Pins
const unsigned int ROLL_SENSOR_PIN = 0;
const unsigned int PITCH_SENSOR_PIN = 1;
//const unsigned int TEMP_SENSOR_PIN = 2;
//const unsigned int TEMP_SENSOR_PIN = 3;
//const unsigned int TEMP_SENSOR_PIN = 4;
//const unsigned int TEMP_SENSOR_PIN = 5; 

// Et cetera
const unsigned int SAMPLES = 9;

  return int_part;
}

float getMoistureContent(int pin) {
  int v = analogRead(pin);
  float mc = (float)(v - volts_a) * (moisture_b - moisture_a) / (float)(volts_b - volts_a) + moisture_a;
  return mc;
}

