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:
Joel Challis
2020-02-05 03:37:04 +00:00
committed by Florian Didron
parent 6defb96175
commit cca46a85f3

View File

@@ -15,14 +15,18 @@
#endif #endif
#ifndef SPLIT_USB_TIMEOUT #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 #endif
volatile bool isLeftHand = true; volatile bool isLeftHand = true;
bool waitForUsb(void) { bool waitForUsb(void) {
for (uint8_t i = 0; i < (SPLIT_USB_TIMEOUT / 100); i++) { for (uint8_t i = 0; i < (SPLIT_USB_TIMEOUT / SPLIT_USB_TIMEOUT_POLL); i++) {
// This will return true of a USB connection has been established // This will return true if a USB connection has been established
#if defined(__AVR__) #if defined(__AVR__)
if (UDADDR & _BV(ADDEN)) { if (UDADDR & _BV(ADDEN)) {
#else #else
@@ -30,7 +34,7 @@ bool waitForUsb(void) {
#endif #endif
return true; 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 // Avoid NO_USB_STARTUP_CHECK - Disable USB as the previous checks seem to enable it somehow