Skip to content

Commit 2836d0b

Browse files
committed
Added JOYSTICK_HATSWITCH_RELEASE
1 parent aaaf29a commit 2836d0b

File tree

3 files changed

+3
-2
lines changed

3 files changed

+3
-2
lines changed

Joystick/src/Joystick.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,7 @@ Joystick_::Joystick_(
466466
_steering = 0;
467467
for (int index = 0; index < JOYSTICK_HATSWITCH_COUNT_MAXIMUM; index++)
468468
{
469-
_hatSwitchValues[index] = -1;
469+
_hatSwitchValues[index] = JOYSTICK_HATSWITCH_RELEASE;
470470
}
471471
for (int index = 0; index < _buttonValuesArraySize; index++)
472472
{

Joystick/src/Joystick.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
#define JOYSTICK_DEFAULT_SIMULATOR_MAXIMUM 1023
4949
#define JOYSTICK_DEFAULT_HATSWITCH_COUNT 2
5050
#define JOYSTICK_HATSWITCH_COUNT_MAXIMUM 2
51+
#define JOYSTICK_HATSWITCH_RELEASE -1
5152

5253
class Joystick_
5354
{

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ Press the indicated button (range: `0` - (`buttonCount - 1`)). The button is the
161161
Release the indicated button (range: `0` - (`buttonCount - 1`)). The button is the 0-based button number (i.e. button #1 is `0`, button #2 is `1`, etc.).
162162

163163
###Joystick.setHatSwitch(byte hatSwitch, int value)
164-
Sets the value of the specified hat switch. The hatSwitch is 0-based (i.e. hat switch #1 is `0` and hat switch #2 is `1`). The value is from 0° to 360°, but in 45° increments. Any value less than 45° will be rounded down (i.e. 44° is rounded down to 0°, 89° is rounded down to 45°, etc.). Set the value to `-1` to release the hat switch.
164+
Sets the value of the specified hat switch. The hatSwitch is 0-based (i.e. hat switch #1 is `0` and hat switch #2 is `1`). The value is from 0° to 360°, but in 45° increments. Any value less than 45° will be rounded down (i.e. 44° is rounded down to 0°, 89° is rounded down to 45°, etc.). Set the value to `JOYSTICK_HATSWITCH_RELEASE` or `-1` to release the hat switch.
165165

166166
###Joystick.sendState()
167167
Sends the updated joystick state to the host computer. Only needs to be called if `AutoSendState` is `false` (see `Joystick.begin` for more details).

0 commit comments

Comments
 (0)