fix keyboard startup delay

This commit is contained in:
my 2026-09-23 13:01:56 +02:00
parent 77702c0d05
commit 44f10676b3

View file

@ -5,6 +5,8 @@
#include <Arduino.h> #include <Arduino.h>
static TwoWire kbWire(1); // Use other I2C bus static TwoWire kbWire(1); // Use other I2C bus
static bool present = false;
static unsigned long lastRetry = 0;
void cardkb_init() { void cardkb_init() {
esp_log_level_set("esp32-hal-i2c-ng", ESP_LOG_NONE); esp_log_level_set("esp32-hal-i2c-ng", ESP_LOG_NONE);
@ -13,12 +15,10 @@ void cardkb_init() {
pinMode(PIN_KB_SCL, INPUT_PULLUP); pinMode(PIN_KB_SCL, INPUT_PULLUP);
kbWire.begin(PIN_KB_SDA, PIN_KB_SCL); kbWire.begin(PIN_KB_SDA, PIN_KB_SCL);
kbWire.setClock(CARDKB_I2C_HZ); kbWire.setClock(CARDKB_I2C_HZ);
lastRetry = millis() - 10000;
} }
char cardkb_read() { char cardkb_read() {
static bool present = false;
static unsigned long lastRetry = 0;
// test if the keyboard is connected, // test if the keyboard is connected,
// prevent endless logging of errors // prevent endless logging of errors
if (!present) { if (!present) {