   lcd.print("KSP-Gegi");
   lcd.setCursor(0,1);
   lcd.print("Ready for action");
+  // joystick setup
+  Joystick.begin(false);	// don't do auto send state
   // request status update
   Serial.println("I");
 }

#include <Wire.h>
// https://bitbucket.org/fmalpartida/new-liquidcrystal/downloads
#include <LiquidCrystal_I2C.h> // Using version 1.2.1

// IDE: Arduino/Genuino Micro


  }
}

// called after UART slave reports button press/release
void handleSlaveButton(const uint8_t id, const uint8_t state) {
	// handle stage switch
	uint8_t buttonId = 0x80;
	switch (id) {
		case 4:
			buttonId = 5;
			break;
		case 5:
			buttonId = 4;
			break;
		case 6:
			buttonId = 2;
			break;
		case 7:
			buttonId = 3;
			break;
		case 8:
			buttonId = stageabort ? 1 : 0;
			break;
		case 9:
			stageabort = state;	// on=abort, off=stage
			break;
	}
//Serial.print("id,state,buttonid,stageabort="); Serial.print(id); Serial.write(' '); Serial.print(state); Serial.write(' '); Serial.print(buttonId); Serial.write(' '); Serial.println(stageabort);
	if (buttonId < 0x80) {
		Joystick.setButton(buttonId,state);
	}
}

// pass data from USB host (PC) to UART
// - handle own devices (consume this data)
// - pass everything else to mini slave
