mirror of
https://github.com/qmk/qmk_firmware.git
synced 2024-11-22 11:29:26 +00:00
Reduce SPLIT_USB_TIMEOUT by 500ms (#7637)
* Update SPLIT_USB_TIMEOUT -500ms * Align keyboard level SPLIT_USB_TIMEOUT defaults * Align keyboard level SPLIT_USB_TIMEOUT_POLL * Review fixes
This commit is contained in:
parent
a557a5b2c5
commit
307be48de9
@ -276,9 +276,12 @@ There are a few different ways to set handedness for split keyboards (listed in
|
||||
* Default behavior for ARM
|
||||
* Required for AVR Teensy
|
||||
|
||||
* `#define SPLIT_USB_TIMEOUT 2500`
|
||||
* `#define SPLIT_USB_TIMEOUT 2000`
|
||||
* Maximum timeout when detecting master/slave when using `SPLIT_USB_DETECT`
|
||||
|
||||
* `#define SPLIT_USB_TIMEOUT_POLL 10`
|
||||
* Poll frequency when detecting master/slave when using `SPLIT_USB_DETECT`
|
||||
|
||||
# The `rules.mk` File
|
||||
|
||||
This is a [make](https://www.gnu.org/software/make/manual/make.html) file that is included by the top-level `Makefile`. It is used to set some information about the MCU that we will be compiling for as well as enabling and disabling certain features.
|
||||
|
@ -198,10 +198,15 @@ This option changes the startup behavior to detect an active USB connection when
|
||||
?> This setting will stop the ability to demo using battery packs.
|
||||
|
||||
```c
|
||||
#define SPLIT_USB_TIMEOUT 2500
|
||||
#define SPLIT_USB_TIMEOUT 2000
|
||||
```
|
||||
This sets the maximum timeout when detecting master/slave when using `SPLIT_USB_DETECT`.
|
||||
|
||||
```c
|
||||
#define SPLIT_USB_TIMEOUT_POLL 10
|
||||
```
|
||||
This sets the poll frequency when detecting master/slave when using `SPLIT_USB_DETECT`
|
||||
|
||||
## Additional Resources
|
||||
|
||||
Nicinabox has a [very nice and detailed guide](https://github.com/nicinabox/lets-split-guide) for the Let's Split keyboard, that covers most everything you need to know, including troubleshooting information.
|
||||
|
@ -20,18 +20,22 @@
|
||||
#endif
|
||||
|
||||
#ifndef SPLIT_USB_TIMEOUT
|
||||
# define SPLIT_USB_TIMEOUT 2500
|
||||
# define SPLIT_USB_TIMEOUT 2000
|
||||
#endif
|
||||
|
||||
#ifndef SPLIT_USB_TIMEOUT_POLL
|
||||
# define SPLIT_USB_TIMEOUT_POLL 10
|
||||
#endif
|
||||
|
||||
volatile bool isLeftHand = true;
|
||||
|
||||
bool waitForUsb(void) {
|
||||
for (uint8_t i = 0; i < (SPLIT_USB_TIMEOUT / 100); i++) {
|
||||
// This will return true of a USB connection has been established
|
||||
for (uint8_t i = 0; i < (SPLIT_USB_TIMEOUT / SPLIT_USB_TIMEOUT_POLL); i++) {
|
||||
// This will return true if a USB connection has been established
|
||||
if (UDADDR & _BV(ADDEN)) {
|
||||
return true;
|
||||
}
|
||||
wait_ms(100);
|
||||
wait_ms(SPLIT_USB_TIMEOUT_POLL);
|
||||
}
|
||||
|
||||
// Avoid NO_USB_STARTUP_CHECK - Disable USB as the previous checks seem to enable it somehow
|
||||
|
@ -20,18 +20,22 @@
|
||||
#endif
|
||||
|
||||
#ifndef SPLIT_USB_TIMEOUT
|
||||
#define SPLIT_USB_TIMEOUT 2500
|
||||
# define SPLIT_USB_TIMEOUT 2000
|
||||
#endif
|
||||
|
||||
#ifndef SPLIT_USB_TIMEOUT_POLL
|
||||
# define SPLIT_USB_TIMEOUT_POLL 10
|
||||
#endif
|
||||
|
||||
volatile bool isLeftHand = true;
|
||||
|
||||
bool waitForUsb(void) {
|
||||
for (uint8_t i = 0; i < (SPLIT_USB_TIMEOUT / 100); i++) {
|
||||
// This will return true of a USB connection has been established
|
||||
for (uint8_t i = 0; i < (SPLIT_USB_TIMEOUT / SPLIT_USB_TIMEOUT_POLL); i++) {
|
||||
// This will return true if a USB connection has been established
|
||||
if (UDADDR & _BV(ADDEN)) {
|
||||
return true;
|
||||
}
|
||||
wait_ms(100);
|
||||
wait_ms(SPLIT_USB_TIMEOUT_POLL);
|
||||
}
|
||||
|
||||
// Avoid NO_USB_STARTUP_CHECK - Disable USB as the previous checks seem to enable it somehow
|
||||
|
@ -15,14 +15,18 @@
|
||||
#endif
|
||||
|
||||
#ifndef SPLIT_USB_TIMEOUT
|
||||
# define SPLIT_USB_TIMEOUT 2500
|
||||
# define SPLIT_USB_TIMEOUT 2000
|
||||
#endif
|
||||
|
||||
#ifndef SPLIT_USB_TIMEOUT_POLL
|
||||
# define SPLIT_USB_TIMEOUT_POLL 10
|
||||
#endif
|
||||
|
||||
volatile bool isLeftHand = true;
|
||||
|
||||
bool waitForUsb(void) {
|
||||
for (uint8_t i = 0; i < (SPLIT_USB_TIMEOUT / 100); i++) {
|
||||
// This will return true of a USB connection has been established
|
||||
for (uint8_t i = 0; i < (SPLIT_USB_TIMEOUT / SPLIT_USB_TIMEOUT_POLL); i++) {
|
||||
// This will return true if a USB connection has been established
|
||||
#if defined(__AVR__)
|
||||
if (UDADDR & _BV(ADDEN)) {
|
||||
#else
|
||||
@ -30,7 +34,7 @@ bool waitForUsb(void) {
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
wait_ms(100);
|
||||
wait_ms(SPLIT_USB_TIMEOUT_POLL);
|
||||
}
|
||||
|
||||
// Avoid NO_USB_STARTUP_CHECK - Disable USB as the previous checks seem to enable it somehow
|
||||
|
Loading…
Reference in New Issue
Block a user