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 <algernon@keyboard.io>
pull/427/head^2
Gergely Nagy 7 years ago
parent f8726905ea
commit 2b19388f6c

@ -185,15 +185,16 @@ out:
void void
ErgoDoxScanner::reattachExpanderOnError() { ErgoDoxScanner::reattachExpanderOnError() {
static uint8_t attach_counter; static uint32_t start_time = millis();
if (!expander_error_) if (!expander_error_)
return; return;
if (attach_counter++ != 0) if (millis() - start_time < 5000)
return; return;
expander_error_ = initExpander(); expander_error_ = initExpander();
start_time = millis();
} }
} }

Loading…
Cancel
Save