diff options
| author | QMK Bot <hello@qmk.fm> | 2021-04-25 03:12:09 +0000 |
|---|---|---|
| committer | QMK Bot <hello@qmk.fm> | 2021-04-25 03:12:09 +0000 |
| commit | 64a9cf18e154aab7c767f2a519530d4190f49d8c (patch) | |
| tree | 66d77e73d6dc897b11ab5e87acee68fabaf97da5 /tmk_core/protocol/lufa | |
| parent | 19b3aa3a12324fb4fb732acd24aa162c88badc85 (diff) | |
| parent | dbd65d01b656e0e43511da4b144dc3408f3046d1 (diff) | |
| download | qmk_firmware-64a9cf18e154aab7c767f2a519530d4190f49d8c.tar.gz qmk_firmware-64a9cf18e154aab7c767f2a519530d4190f49d8c.zip | |
Merge remote-tracking branch 'origin/master' into develop
Diffstat (limited to 'tmk_core/protocol/lufa')
| -rw-r--r-- | tmk_core/protocol/lufa/lufa.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/tmk_core/protocol/lufa/lufa.c b/tmk_core/protocol/lufa/lufa.c index f1908b3d0..85d71d083 100644 --- a/tmk_core/protocol/lufa/lufa.c +++ b/tmk_core/protocol/lufa/lufa.c | |||
| @@ -829,9 +829,10 @@ static void send_consumer(uint16_t data) { | |||
| 829 | * FIXME: Needs doc | 829 | * FIXME: Needs doc |
| 830 | */ | 830 | */ |
| 831 | int8_t sendchar(uint8_t c) { | 831 | int8_t sendchar(uint8_t c) { |
| 832 | // Not wait once timeouted. | 832 | // Do not wait if the previous write has timed_out. |
| 833 | // Because sendchar() is called so many times, waiting each call causes big lag. | 833 | // Because sendchar() is called so many times, waiting each call causes big lag. |
| 834 | static bool timeouted = false; | 834 | // The `timed_out` state is an approximation of the ideal `is_listener_disconnected?` state. |
| 835 | static bool timed_out = false; | ||
| 835 | 836 | ||
| 836 | // prevents Console_Task() from running during sendchar() runs. | 837 | // prevents Console_Task() from running during sendchar() runs. |
| 837 | // or char will be lost. These two function is mutually exclusive. | 838 | // or char will be lost. These two function is mutually exclusive. |
| @@ -845,11 +846,11 @@ int8_t sendchar(uint8_t c) { | |||
| 845 | goto ERROR_EXIT; | 846 | goto ERROR_EXIT; |
| 846 | } | 847 | } |
| 847 | 848 | ||
| 848 | if (timeouted && !Endpoint_IsReadWriteAllowed()) { | 849 | if (timed_out && !Endpoint_IsReadWriteAllowed()) { |
| 849 | goto ERROR_EXIT; | 850 | goto ERROR_EXIT; |
| 850 | } | 851 | } |
| 851 | 852 | ||
| 852 | timeouted = false; | 853 | timed_out = false; |
| 853 | 854 | ||
| 854 | uint8_t timeout = SEND_TIMEOUT; | 855 | uint8_t timeout = SEND_TIMEOUT; |
| 855 | while (!Endpoint_IsReadWriteAllowed()) { | 856 | while (!Endpoint_IsReadWriteAllowed()) { |
| @@ -860,7 +861,7 @@ int8_t sendchar(uint8_t c) { | |||
| 860 | goto ERROR_EXIT; | 861 | goto ERROR_EXIT; |
| 861 | } | 862 | } |
| 862 | if (!(timeout--)) { | 863 | if (!(timeout--)) { |
| 863 | timeouted = true; | 864 | timed_out = true; |
| 864 | goto ERROR_EXIT; | 865 | goto ERROR_EXIT; |
| 865 | } | 866 | } |
| 866 | _delay_ms(1); | 867 | _delay_ms(1); |
