   //ble.setDisconnectCallback(disconnectCallback);
   
   ble.setMode(BLUEFRUIT_MODE_DATA);
+  ble.setTimeout(5);
 
   lastSendMicros = micros();
 

    target_fade_ms = 0;
  } else {
    // In the middle of a linear fade
    long dT = fade_start_ms - (millis() - fade_start_ms);
    long ratio = dT * 10000 / target_fade_ms;
    int dH = ratio * fade_dH / 10000;
    int dS = ratio * fade_dS / 10000;
    int dV = ratio * fade_dV / 10000;

    current_hue = target_hue - dH;
    current_saturation = target_saturation + dH;
  }
    
  sendCommand(current_hue, current_saturation, current_brightness);
}

void sendCommand(uint16_t hue, uint8_t saturation, uint8_t brightness) {

  unsigned long startTime = micros();


    target_fade_ms = 0;
  } else if (target_fade_ms == 65535) {
    // Code for UO decay
  } else if (millis() - fade_start_ms > 60000 || millis() - fade_start_ms > target_fade_ms) {
    // Max fade is 60 seconds, terminate the transition.
    // Or we exceeded the fade target ms, also terminate the transition
    
    current_hue = target_hue;
    current_saturation = target_saturation;
    current_brightness = target_brightness;
