 
 int arglen[256] = {};
 
-#define TRAY_OPEN 1
-#define TRAY_CLOSED 0
+#define TRAY_OPEN 0
+#define TRAY_CLOSED 1
 
 #define LOADER_REST 1
 #define LOADER_ACTIVE 0

  if (Serial.available()) {
    int data = Serial.read();
    if (data == CMD_HEADER_A) {
      serial_index = 0;
    } else {
      serial_buffer[serial_index++] = data;

int kcup_tray_close() {
  digitalWriteFast(PIN_TRAY_PISTON, TRAY_CLOSED);
  if (tray_state != TRAY_CLOSED) {
    delay(3000);
  }
  tray_state = TRAY_CLOSED;
  return 0;
