   }
 }
 
-//Example JSON strings below:
-//@{"config":{"throttle":10, "elevator":9, "rudder":8, "aileron":7, "aileronIn":6, "throttleIn":5, "elevatorIn":4, "rudderIn":3, "cutoverIn":2}, "servos":{"throttle":32, "elevator":90, "rudder":90, "aileron":90}}#
-//@{"calibration":{"aileronInMin":1084,"aileronInMax":1688,"elevatorInMin":964,"elevatorInMax":1752,"rudderInMin":1044,"rudderInMax":1800,"throttleInMin":1020,"throttleInMax":1704,"cutoverInMin":776,"cutoverInMax":1844}}#
-//@{"ranges":{"aileronMin":45, "aileronMax":135, "elevatorMin":0, "elevatorMax":180, "rudderMin":0, "rudderMax":180, "throttleMin":32, "throttleMax":124}}#
-//@{"servos":{"throttle":0, "elevator":100, "aileron":120, "rudder":75}}#
+//Example JSON input below
+//Complete configuration
+//@{"aileron":{"inputConfig":{"max":1688,"min":1084,"pin":6,"receiverOnly":false},"outputConfig":{"max":180,"min":0,"pin":7},"value":90}}#
+//@{"elevator":{"inputConfig":{"max":1752,"min":964,"pin":4,"receiverOnly":true},"outputConfig":{"max":180,"min":0,"pin":9},"value":90}}#
+//@{"rudder":{"inputConfig":{"max":1800,"min":1044,"pin":3,"receiverOnly":true},"outputConfig":{"max":180,"min":0,"pin":8},"value":90}}#
+//@{"throttle":{"inputConfig":{"max":1688,"min":1084,"pin":5,"receiverOnly":true},"outputConfig":{"max":180,"min":0,"pin":10},"value":90}}#
+//@{"cutover":{"inputConfig":{"max":1844,"min":776,"pin":2}}}#
+
+//Configuration without calibration or receiverOnly configuration
+//@{"aileron":{"inputConfig":{"pin":6},"outputConfig":{"max":135,"min":45,"pin":7},"value":90}}#
+//@{"elevator":{"inputConfig":{"pin":4},"outputConfig":{"max":180,"min":0,"pin":9},"value":90}}#
+//@{"rudder":{"inputConfig":{"pin":3},"outputConfig":{"max":180,"min":0,"pin":8},"value":90}}#
+//@{"throttle":{"inputConfig":{"pin":5},"outputConfig":{"max":124,"min":32,"pin":10},"value":32}}#
+//@{"cutover":{"inputConfig":{"pin":2}}}#
+
+//Receiver calibration data (sent or received)
+//@{"aileron":{"inputConfig":{"max":1832,"min":780}},"cutover":{"inputConfig":{"max":1836,"min":756}},"elevator":{"inputConfig":{"max":1644,"min":1248}},"rudder":{"inputConfig":{"max":1612,"min":980}},"throttle":{"inputConfig":{"max":1708,"min":1016}}}#
+
+//Neutral servo command
+//@{"aileron":{"value":90},"elevator":{"value":90},"rudder":{"value":90},"throttle":{"value":32}}#
+
+//Processes JSON received in the readSerialJsonInput() method
 void processReceivedJson() {
   if (newData) {
     StaticJsonBuffer<CHAR_ARRAY_SIZE> jsonBuffer;

volatile uint16_t rudderInValue;
volatile uint16_t throttleInValue;

//Stores the pin number for each receiver input
byte aileronInPin = 255;
byte cutoverInPin = 255;
byte elevatorInPin = 255;
byte rudderInPin = 255;
byte throttleInPin = 255;

//Stores the servo range of the throttle
byte aileronMax = SERVO_MAX;
byte aileronMin = SERVO_MIN;
byte elevatorMax = SERVO_MAX;
byte elevatorMin = SERVO_MIN;
byte rudderMax = SERVO_MAX;
byte rudderMin = SERVO_MIN;
byte throttleMax = SERVO_MAX;
byte throttleMin = SERVO_MIN;

//Determines if the servos are in the process of calibration
boolean calibrationMode = false;


const byte SERVO_MIN = 0;
const byte SERVO_MAX = 180;

//Cutover threshold in milliseconds
const int CUTOVER_THRESHOLD = 1500;

//Default servo input value
//TODO use better calibration default
const int RECEIVER_INPUT_DEFAULT = 1500;
