From 6567b2168881ce8c47e38debcdc89eba1ac80c5a Mon Sep 17 00:00:00 2001 From: Tomasz Janeczko Date: Wed, 8 Jun 2022 22:51:41 +0100 Subject: Move more UART-based keyboards to use timeout correctly. (#17329) Co-authored-by: Tomasz Janeczko --- keyboards/keyhive/honeycomb/matrix.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'keyboards/keyhive') diff --git a/keyboards/keyhive/honeycomb/matrix.c b/keyboards/keyhive/honeycomb/matrix.c index 9a87ca9a2e..c8a7992ec5 100755 --- a/keyboards/keyhive/honeycomb/matrix.c +++ b/keyboards/keyhive/honeycomb/matrix.c @@ -46,6 +46,8 @@ along with this program. If not, see . # define ROW_SHIFTER ((uint32_t)1) #endif +#define UART_MATRIX_RESPONSE_TIMEOUT 10000 + /* matrix state(1:on, 0:off) */ static matrix_row_t matrix[MATRIX_ROWS]; //extern int8_t encoderValue; @@ -112,12 +114,16 @@ uint8_t matrix_scan(void) // harm to leave it in here while(!uart_available()){ timeout++; - if (timeout > 10000){ - xprintf("\r\nTime out in keyboard."); + if (timeout > UART_MATRIX_RESPONSE_TIMEOUT) { break; } } - uart_data[i] = uart_read(); + + if (timeout < UART_MATRIX_RESPONSE_TIMEOUT) { + uart_data[i] = uart_read(); + } else { + uart_data[i] = 0x00; + } } // Check for the end packet, it's our checksum. -- cgit v1.2.1