       } else {
         sendJsonString("error", servoError);
       }
-    }
-  } else {
-    sendJsonString("error", servoInputError);
-  }
-}
+    } else {
+      sendJsonString("error", servoInputError);
+    }
+  }
+}

//Determines if the plane is controlled only by the receiver
boolean receiverControl = false;

//Determines if the plane control is shared between the phone and the receiver
boolean sharedControl = false;

//All valid input/output must start/end with the corresponding chars below
char endMarker = '#';
char startMarker = '@';

//This array stores Json characters read from serial input
char receivedJson[CHAR_ARRAY_SIZE];

//The running average for cutover receiver input
uint16_t cutoverInputAverage = RECEIVER_INPUT_DEFAULT;

//The start time for determining the cutover double switch flip for emergency input shutoff
uint32_t receiverControlStartTime = millis();

struct ServoData {
  byte outputMax = SERVO_MAX;

    //While interrupts are paused, copy new servo input values to the corresponding local static variables
    receiverInputFlagsLocal = receiverInputFlags;
    if (receiverInputFlagsLocal & FLAG_CUTOVER) cutoverInValueLocal = cutoverInValue;
    if (receiverInputFlagsLocal & FLAG_AILERON) aileronInValueLocal = aileronInValue;
    if (receiverInputFlagsLocal & FLAG_ELEVATOR) elevatorInValueLocal = elevatorInValue;
    if (receiverInputFlagsLocal & FLAG_RUDDER) rudderInValueLocal = rudderInValue;
    if (receiverInputFlagsLocal & FLAG_THROTTLE) throttleInValueLocal = throttleInValue;
    receiverInputFlags = 0;
    interrupts();
  }
