From a1d9b3a77f8d520e37f9f6ee7765314c08ef0b3e Mon Sep 17 00:00:00 2001 From: mcgurk Date: Sun, 9 Oct 2016 22:50:54 +0300 Subject: [PATCH] Update RetroJoystickAdapter_WiiClassicController.ino --- RetroJoystickAdapter_WiiClassicController.ino | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/RetroJoystickAdapter_WiiClassicController.ino b/RetroJoystickAdapter_WiiClassicController.ino index 84535c0..36ab17d 100644 --- a/RetroJoystickAdapter_WiiClassicController.ino +++ b/RetroJoystickAdapter_WiiClassicController.ino @@ -198,6 +198,10 @@ void setup() { void loop() { + #ifdef DEBUG + unsigned long t = micros(); + #endif + Wire.requestFrom(ADDRESS, 6); //request data from wii classic /*Serial.print(Wire.read(), HEX);Serial.print(" "); Serial.print(Wire.read(), HEX);Serial.print(" "); @@ -215,7 +219,7 @@ void loop() { } //detect if init is needed - if (i < 5) { + if (i < 6) { delay(100); sendByte(0x55, 0xF0); sendByte(0x00, 0xFB); @@ -224,7 +228,10 @@ void loop() { #endif delay(100); } else sendByte(0x00, 0x00); - + + #ifdef DEBUG + Serial.println(micros()-t); + #endif /*for (uint8_t i = 0; i < 6; i++) { Joystick[0].data[i] = Wire.read(); @@ -284,6 +291,8 @@ void loop() { Joystick[0].updateState(); Joystick[0].sendState(); - //delay(100); // used to see changes in the serial monitor easier. + #ifdef DEBUG + delay(100); // used to see changes in the serial monitor easier. + #endif delayMicroseconds(1000); }