From 9426e4192d2dc89801f7f5a0c25cd527dc435db6 Mon Sep 17 00:00:00 2001 From: Kristian Sloth Lauszus Date: Thu, 16 Apr 2015 20:19:33 +0200 Subject: [PATCH] Updated some variables names and updated some debug messages --- Wii.cpp | 15 ++++++++------- Wii.h | 2 +- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/Wii.cpp b/Wii.cpp index f8d7186d..189bdcd3 100755 --- a/Wii.cpp +++ b/Wii.cpp @@ -264,7 +264,7 @@ void WII::ACLData(uint8_t* l2capinbuf) { else if(wiiUProControllerConnected) ButtonState = (uint32_t)(((~l2capinbuf[23]) & 0xFE) | ((uint16_t)(~l2capinbuf[24]) << 8) | ((uint32_t)((~l2capinbuf[25]) & 0x03) << 16)); else if(motionPlusConnected) { - if(l2capinbuf[20] & 0x02) // Only update the wiimote buttons, since the extension bytes are from the Motion Plus + if(l2capinbuf[20] & 0x02) // Only update the Wiimote buttons, since the extension bytes are from the Motion Plus ButtonState = (uint32_t)((l2capinbuf[10] & 0x1F) | ((uint16_t)(l2capinbuf[11] & 0x9F) << 8) | ((uint32_t)(ButtonState & 0xFFFF0000))); else if(nunchuckConnected) // Update if it's a report from the Nunchuck ButtonState = (uint32_t)((l2capinbuf[10] & 0x1F) | ((uint16_t)(l2capinbuf[11] & 0x9F) << 8) | ((uint32_t)((~l2capinbuf[20]) & 0x0C) << 14)); @@ -332,10 +332,11 @@ void WII::ACLData(uint8_t* l2capinbuf) { setReportMode(false, 0x31); // If there is no extension connected we will read the buttons and accelerometer } } -#ifdef DEBUG_USB_HOST +#ifdef EXTRADEBUG else Notify(PSTR("\r\nChecking battery level"), 0x80); - +#endif +#ifdef DEBUG_USB_HOST if(l2capinbuf[12] & 0x01) Notify(PSTR("\r\nWARNING: Battery is nearly empty"), 0x80); #endif @@ -405,7 +406,7 @@ void WII::ACLData(uint8_t* l2capinbuf) { for(uint8_t j = 0; j < 4; j++) wiiBalanceBoardCal[2][j] = l2capinbuf[16 + 2 * j] | l2capinbuf[15 + 2 * j] << 8; #ifdef DEBUG_USB_HOST - Notify(PSTR("\r\nWii Balance Board calibrated successfully"), 0x80); + Notify(PSTR("\r\nWii Balance Board calibration values read successfully"), 0x80); #endif wiiBalanceBoardCalibrationComplete = true; } @@ -793,9 +794,9 @@ void WII::Run() { } else if(stateCounter == 400) { if(wiiBalanceBoardConnected) { #ifdef DEBUG_USB_HOST - Notify(PSTR("\r\nCalibrating Wii Balance Board"), 0x80); + Notify(PSTR("\r\nReading Wii Balance Board calibration values"), 0x80); #endif - calibrateWiiBalanceBoard(); + readWiiBalanceBoardCalibration(); } else stateCounter = 499; } else if(stateCounter == 500) { @@ -1071,7 +1072,7 @@ void WII::checkMotionPresent() { readData(0xA600FA, 6, false); } -void WII::calibrateWiiBalanceBoard() { +void WII::readWiiBalanceBoardCalibration() { readData(0xA40024, 24, false); } diff --git a/Wii.h b/Wii.h index 3cf4edc0..2a3b5a3e 100755 --- a/Wii.h +++ b/Wii.h @@ -475,11 +475,11 @@ private: void readData(uint32_t offset, uint16_t size, bool EEPROM); void readExtensionType(); void readCalData(); + void readWiiBalanceBoardCalibration(); // Used by the library to read the Wii Balance Board calibration values void checkMotionPresent(); // Used to see if a Motion Plus is connected to the Wiimote void initMotionPlus(); void activateMotionPlus(); - void calibrateWiiBalanceBoard(); uint16_t wiiBalanceBoardRaw[4]; // Wii Balance Board raw values uint16_t wiiBalanceBoardCal[3][4]; // Wii Balance Board calibration values