From 2b19388f6c5db34dd18f62aea127c5110a746ffe Mon Sep 17 00:00:00 2001 From: Gergely Nagy Date: Sun, 20 May 2018 10:14:37 +0200 Subject: [PATCH] ErgoDoxScanner: Try re-attaching every 5 seconds only Not doing so destroys the latency of the still functional right half. Signed-off-by: Gergely Nagy --- src/kaleidoscope/hardware/ErgoDoxScanner.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/kaleidoscope/hardware/ErgoDoxScanner.cpp b/src/kaleidoscope/hardware/ErgoDoxScanner.cpp index 630dc3d3..7ed32212 100644 --- a/src/kaleidoscope/hardware/ErgoDoxScanner.cpp +++ b/src/kaleidoscope/hardware/ErgoDoxScanner.cpp @@ -185,15 +185,16 @@ out: void ErgoDoxScanner::reattachExpanderOnError() { - static uint8_t attach_counter; + static uint32_t start_time = millis(); if (!expander_error_) return; - if (attach_counter++ != 0) + if (millis() - start_time < 5000) return; expander_error_ = initExpander(); + start_time = millis(); } }