Skip to content

Commit

Permalink
Fix of ISSUE 6.
Browse files Browse the repository at this point in the history
Timeout with a defauls of 2 ms added to sendState.
Individual timeout can be defined in the begin() methode
Readme updated.
  • Loading branch information
schnoog committed Nov 10, 2023
1 parent 118e045 commit 37e0fc1
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,10 @@ The following constants define the default values for the constructor parameters
- `JOYSTICK_DEFAULT_BUTTON_COUNT` is set to `32`
- `JOYSTICK_DEFAULT_HATSWITCH_COUNT` is set to `2`

### Joystick.begin(bool initAutoSendState)
### Joystick.begin(bool initAutoSendState, uint8_t timeout_ms = 2)

Starts emulating a game controller connected to a computer. By default, all methods update the game controller state immediately. If `initAutoSendState` is set to `false`, the `Joystick.sendState` method must be called to update the game controller state.
The timeout_ms defines the timeout for the USB communication.

### Joystick.end()

Expand Down
4 changes: 2 additions & 2 deletions library.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name=Joystick_ESP32S2
version=0.9.4
version=0.9.5
author=Schnoog feat. Matthew Heironimus
maintainer=Matthew Heironimus <[email protected]>
maintainer=Schnoog <[email protected]>
sentence=Allows an ESP32S2/S3 board with USB capabilities to appear as a Joystick or Gamepad.
paragraph=This library is built on the espressif/arduino-esp32 library. It can be used with or without other HID-based libraries (Mouse, Keyboard, etc.).
category=Device Control
Expand Down
4 changes: 2 additions & 2 deletions src/Joystick_ESP32S2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -486,10 +486,10 @@ Joystick_::Joystick_(
}


void Joystick_::begin(bool initAutoSendState, uint8_t intervalMs)
void Joystick_::begin(bool initAutoSendState, uint8_t timeout_ms)
{
HID.begin();
_timeout_ms = intervalMs;
_timeout_ms = timeout_ms;
_autoSendState = initAutoSendState;
sendState();
}
Expand Down
2 changes: 1 addition & 1 deletion src/Joystick_ESP32S2.h
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ class Joystick_: public USBHIDDevice
bool includeBrake = true,
bool includeSteering = true);

void begin(bool initAutoSendState = true, uint8_t interval_ms = 2);
void begin(bool initAutoSendState = true, uint8_t timeout_ms = 2);

void end();

Expand Down

0 comments on commit 37e0fc1

Please sign in to comment.