diff options
| author | Joel Challis <git@zvecr.com> | 2020-02-05 03:37:04 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-02-04 19:37:04 -0800 |
| commit | 307be48de9a24a182420a6c42222906132035ea2 (patch) | |
| tree | 269de1fe60e4f36b5ba1d266060308dc49209df3 | |
| parent | a557a5b2c5e62c20e037fbca56dc902a20cd6ff8 (diff) | |
| download | qmk_firmware-307be48de9a24a182420a6c42222906132035ea2.tar.gz qmk_firmware-307be48de9a24a182420a6c42222906132035ea2.zip | |
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
| -rw-r--r-- | docs/config_options.md | 5 | ||||
| -rw-r--r-- | docs/feature_split_keyboard.md | 7 | ||||
| -rw-r--r-- | keyboards/crkbd/rev1/split_util.c | 12 | ||||
| -rw-r--r-- | keyboards/helix/rev2/split_util.c | 12 | ||||
| -rw-r--r-- | quantum/split_common/split_util.c | 12 |
5 files changed, 34 insertions, 14 deletions
diff --git a/docs/config_options.md b/docs/config_options.md index 6df082335..be328405e 100644 --- a/docs/config_options.md +++ b/docs/config_options.md | |||
| @@ -276,9 +276,12 @@ There are a few different ways to set handedness for split keyboards (listed in | |||
| 276 | * Default behavior for ARM | 276 | * Default behavior for ARM |
| 277 | * Required for AVR Teensy | 277 | * Required for AVR Teensy |
| 278 | 278 | ||
| 279 | * `#define SPLIT_USB_TIMEOUT 2500` | 279 | * `#define SPLIT_USB_TIMEOUT 2000` |
| 280 | * Maximum timeout when detecting master/slave when using `SPLIT_USB_DETECT` | 280 | * Maximum timeout when detecting master/slave when using `SPLIT_USB_DETECT` |
| 281 | 281 | ||
| 282 | * `#define SPLIT_USB_TIMEOUT_POLL 10` | ||
| 283 | * Poll frequency when detecting master/slave when using `SPLIT_USB_DETECT` | ||
| 284 | |||
| 282 | # The `rules.mk` File | 285 | # The `rules.mk` File |
| 283 | 286 | ||
| 284 | 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. | 287 | 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. |
diff --git a/docs/feature_split_keyboard.md b/docs/feature_split_keyboard.md index affce3429..66194c5f4 100644 --- a/docs/feature_split_keyboard.md +++ b/docs/feature_split_keyboard.md | |||
| @@ -198,10 +198,15 @@ This option changes the startup behavior to detect an active USB connection when | |||
| 198 | ?> This setting will stop the ability to demo using battery packs. | 198 | ?> This setting will stop the ability to demo using battery packs. |
| 199 | 199 | ||
| 200 | ```c | 200 | ```c |
| 201 | #define SPLIT_USB_TIMEOUT 2500 | 201 | #define SPLIT_USB_TIMEOUT 2000 |
| 202 | ``` | 202 | ``` |
| 203 | This sets the maximum timeout when detecting master/slave when using `SPLIT_USB_DETECT`. | 203 | This sets the maximum timeout when detecting master/slave when using `SPLIT_USB_DETECT`. |
| 204 | 204 | ||
| 205 | ```c | ||
| 206 | #define SPLIT_USB_TIMEOUT_POLL 10 | ||
| 207 | ``` | ||
| 208 | This sets the poll frequency when detecting master/slave when using `SPLIT_USB_DETECT` | ||
| 209 | |||
| 205 | ## Additional Resources | 210 | ## Additional Resources |
| 206 | 211 | ||
| 207 | 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. | 212 | 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. |
diff --git a/keyboards/crkbd/rev1/split_util.c b/keyboards/crkbd/rev1/split_util.c index 35aa54d78..b642a734c 100644 --- a/keyboards/crkbd/rev1/split_util.c +++ b/keyboards/crkbd/rev1/split_util.c | |||
| @@ -20,18 +20,22 @@ | |||
| 20 | #endif | 20 | #endif |
| 21 | 21 | ||
| 22 | #ifndef SPLIT_USB_TIMEOUT | 22 | #ifndef SPLIT_USB_TIMEOUT |
| 23 | # define SPLIT_USB_TIMEOUT 2500 | 23 | # define SPLIT_USB_TIMEOUT 2000 |
| 24 | #endif | ||
| 25 | |||
| 26 | #ifndef SPLIT_USB_TIMEOUT_POLL | ||
| 27 | # define SPLIT_USB_TIMEOUT_POLL 10 | ||
| 24 | #endif | 28 | #endif |
| 25 | 29 | ||
| 26 | volatile bool isLeftHand = true; | 30 | volatile bool isLeftHand = true; |
| 27 | 31 | ||
| 28 | bool waitForUsb(void) { | 32 | bool waitForUsb(void) { |
| 29 | for (uint8_t i = 0; i < (SPLIT_USB_TIMEOUT / 100); i++) { | 33 | for (uint8_t i = 0; i < (SPLIT_USB_TIMEOUT / SPLIT_USB_TIMEOUT_POLL); i++) { |
| 30 | // This will return true of a USB connection has been established | 34 | // This will return true if a USB connection has been established |
| 31 | if (UDADDR & _BV(ADDEN)) { | 35 | if (UDADDR & _BV(ADDEN)) { |
| 32 | return true; | 36 | return true; |
| 33 | } | 37 | } |
| 34 | wait_ms(100); | 38 | wait_ms(SPLIT_USB_TIMEOUT_POLL); |
| 35 | } | 39 | } |
| 36 | 40 | ||
| 37 | // Avoid NO_USB_STARTUP_CHECK - Disable USB as the previous checks seem to enable it somehow | 41 | // Avoid NO_USB_STARTUP_CHECK - Disable USB as the previous checks seem to enable it somehow |
diff --git a/keyboards/helix/rev2/split_util.c b/keyboards/helix/rev2/split_util.c index 89df43e27..9d31d0dec 100644 --- a/keyboards/helix/rev2/split_util.c +++ b/keyboards/helix/rev2/split_util.c | |||
| @@ -20,18 +20,22 @@ | |||
| 20 | #endif | 20 | #endif |
| 21 | 21 | ||
| 22 | #ifndef SPLIT_USB_TIMEOUT | 22 | #ifndef SPLIT_USB_TIMEOUT |
| 23 | #define SPLIT_USB_TIMEOUT 2500 | 23 | # define SPLIT_USB_TIMEOUT 2000 |
| 24 | #endif | ||
| 25 | |||
| 26 | #ifndef SPLIT_USB_TIMEOUT_POLL | ||
| 27 | # define SPLIT_USB_TIMEOUT_POLL 10 | ||
| 24 | #endif | 28 | #endif |
| 25 | 29 | ||
| 26 | volatile bool isLeftHand = true; | 30 | volatile bool isLeftHand = true; |
| 27 | 31 | ||
| 28 | bool waitForUsb(void) { | 32 | bool waitForUsb(void) { |
| 29 | for (uint8_t i = 0; i < (SPLIT_USB_TIMEOUT / 100); i++) { | 33 | for (uint8_t i = 0; i < (SPLIT_USB_TIMEOUT / SPLIT_USB_TIMEOUT_POLL); i++) { |
| 30 | // This will return true of a USB connection has been established | 34 | // This will return true if a USB connection has been established |
| 31 | if (UDADDR & _BV(ADDEN)) { | 35 | if (UDADDR & _BV(ADDEN)) { |
| 32 | return true; | 36 | return true; |
| 33 | } | 37 | } |
| 34 | wait_ms(100); | 38 | wait_ms(SPLIT_USB_TIMEOUT_POLL); |
| 35 | } | 39 | } |
| 36 | 40 | ||
| 37 | // Avoid NO_USB_STARTUP_CHECK - Disable USB as the previous checks seem to enable it somehow | 41 | // Avoid NO_USB_STARTUP_CHECK - Disable USB as the previous checks seem to enable it somehow |
diff --git a/quantum/split_common/split_util.c b/quantum/split_common/split_util.c index 076f18664..103bc9714 100644 --- a/quantum/split_common/split_util.c +++ b/quantum/split_common/split_util.c | |||
| @@ -15,14 +15,18 @@ | |||
| 15 | #endif | 15 | #endif |
| 16 | 16 | ||
| 17 | #ifndef SPLIT_USB_TIMEOUT | 17 | #ifndef SPLIT_USB_TIMEOUT |
| 18 | # define SPLIT_USB_TIMEOUT 2500 | 18 | # define SPLIT_USB_TIMEOUT 2000 |
| 19 | #endif | ||
| 20 | |||
| 21 | #ifndef SPLIT_USB_TIMEOUT_POLL | ||
| 22 | # define SPLIT_USB_TIMEOUT_POLL 10 | ||
| 19 | #endif | 23 | #endif |
| 20 | 24 | ||
| 21 | volatile bool isLeftHand = true; | 25 | volatile bool isLeftHand = true; |
| 22 | 26 | ||
| 23 | bool waitForUsb(void) { | 27 | bool waitForUsb(void) { |
| 24 | for (uint8_t i = 0; i < (SPLIT_USB_TIMEOUT / 100); i++) { | 28 | for (uint8_t i = 0; i < (SPLIT_USB_TIMEOUT / SPLIT_USB_TIMEOUT_POLL); i++) { |
| 25 | // This will return true of a USB connection has been established | 29 | // This will return true if a USB connection has been established |
| 26 | #if defined(__AVR__) | 30 | #if defined(__AVR__) |
| 27 | if (UDADDR & _BV(ADDEN)) { | 31 | if (UDADDR & _BV(ADDEN)) { |
| 28 | #else | 32 | #else |
| @@ -30,7 +34,7 @@ bool waitForUsb(void) { | |||
| 30 | #endif | 34 | #endif |
| 31 | return true; | 35 | return true; |
| 32 | } | 36 | } |
| 33 | wait_ms(100); | 37 | wait_ms(SPLIT_USB_TIMEOUT_POLL); |
| 34 | } | 38 | } |
| 35 | 39 | ||
| 36 | // Avoid NO_USB_STARTUP_CHECK - Disable USB as the previous checks seem to enable it somehow | 40 | // Avoid NO_USB_STARTUP_CHECK - Disable USB as the previous checks seem to enable it somehow |
