From 83f902f2f65ce0c6afd2e1165686a00a36e9ad0c Mon Sep 17 00:00:00 2001 From: Peter Johnson Date: Thu, 14 Jan 2016 21:49:50 -0800 Subject: [PATCH] Fix HALGetJoystickDescriptor(). This reverts the previous commit instead fixing it at the root HALGetJoystickDescriptor function, which also fixes use of that function by the C++ DriverStation class. Change-Id: I1f203a015d8f10d119c61635def2822bf124754c --- hal/lib/Shared/HAL.cpp | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/hal/lib/Shared/HAL.cpp b/hal/lib/Shared/HAL.cpp index 0549259430..ab2a2a34c2 100644 --- a/hal/lib/Shared/HAL.cpp +++ b/hal/lib/Shared/HAL.cpp @@ -37,6 +37,12 @@ int HALGetJoystickButtons(uint8_t joystickNum, HALJoystickButtons *buttons) int HALGetJoystickDescriptor(uint8_t joystickNum, HALJoystickDescriptor *desc) { + desc->isXbox = 0; + desc->type = -1; + desc->name[0] = '\0'; + desc->axisCount = 0; + desc->buttonCount = 0; + desc->povCount = 0; return FRC_NetworkCommunication_getJoystickDesc(joystickNum, &desc->isXbox, &desc->type, (char *)(&desc->name), &desc->axisCount, (uint8_t *)&desc->axisTypes, &desc->buttonCount, &desc->povCount); } @@ -44,9 +50,6 @@ int HALGetJoystickDescriptor(uint8_t joystickNum, HALJoystickDescriptor *desc) int HALGetJoystickIsXbox(uint8_t joystickNum) { HALJoystickDescriptor joystickDesc; - joystickDesc.isXbox = 0; - joystickDesc.type = -1; - joystickDesc.name[0] = '\0'; if(HALGetJoystickDescriptor(joystickNum, &joystickDesc)<0) { return 0; @@ -59,9 +62,6 @@ int HALGetJoystickIsXbox(uint8_t joystickNum) int HALGetJoystickType(uint8_t joystickNum) { HALJoystickDescriptor joystickDesc; - joystickDesc.isXbox = 0; - joystickDesc.type = -1; - joystickDesc.name[0] = '\0'; if(HALGetJoystickDescriptor(joystickNum, &joystickDesc)<0) { return -1; @@ -74,9 +74,6 @@ int HALGetJoystickType(uint8_t joystickNum) char* HALGetJoystickName(uint8_t joystickNum) { HALJoystickDescriptor joystickDesc; - joystickDesc.isXbox = 0; - joystickDesc.type = -1; - joystickDesc.name[0] = '\0'; if(HALGetJoystickDescriptor(joystickNum, &joystickDesc)<0) { char* name = (char*)std::malloc(1); @@ -94,9 +91,6 @@ char* HALGetJoystickName(uint8_t joystickNum) int HALGetJoystickAxisType(uint8_t joystickNum, uint8_t axis) { HALJoystickDescriptor joystickDesc; - joystickDesc.isXbox = 0; - joystickDesc.type = -1; - joystickDesc.name[0] = '\0'; if(HALGetJoystickDescriptor(joystickNum, &joystickDesc)<0) { return -1;