Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bluetooth Problems #13

Open
CVYY39 opened this issue Sep 23, 2020 · 6 comments
Open

Bluetooth Problems #13

CVYY39 opened this issue Sep 23, 2020 · 6 comments

Comments

@CVYY39
Copy link
Contributor

CVYY39 commented Sep 23, 2020

Is anyone using this keyboard with Bluetooth successfully?

I've been trying for a day or two to get it to work reliably. I can get it to connect to either of my two computers (a mac and a PC). It will work for a bit, but then after a while it seems to flake out and start typing random characters, or just stops working altogether.

At one point the keyboard worked itself into some kind of state where I couldn't type. I tried enabling/disabling bluetooth and USB to no avail. I finally fixed it by updating the firmware and restoring all of the files that it came with on the USB drive.

@xiongyihui
Copy link
Contributor

Were these "random characters" triggered by the pair-keys?
By default, pressing J and J within 10ms will send "You just triggered pair keys #0". Sending a sequence of keys like that may cause Bluetooth disconnection when Bluetooth signal is not good enough.
You can disable these pair-keys by comment out keyboard.pairs = [{35, 36}, {20, 19}] in code.py

@CVYY39
Copy link
Contributor Author

CVYY39 commented Sep 24, 2020

No, definitely not. I'm familiar with pair keys and had already changed their function.

It's more like it will be delayed in sending what I type, and then it will start repeating things. Random characters is probably a bad description, I think it is probably related to what I type, just very delayed (like 10+ seconds) and sometimes repeated. I don't think it's a reception issue, because it happens on both the PC and the mac at the same time. My PC BT receiver is about 2 ft from the keyboard, and my Mac OS receiver is maybe 3 ft away. It seems to happen when I switch from one to the other.

@xiongyihui
Copy link
Contributor

It seems that there is a bug when switching between devices. Will look into it.

@xiongyihui
Copy link
Contributor

@CVYY39 The latest code in this repo may fix the issue. The keyboard will release all keycodes when changing devices.

@CVYY39
Copy link
Contributor Author

CVYY39 commented Sep 25, 2020

That definitely improved things, but I'm still seeing some issues. Bluetooth seems to work perfectly connected to my Mac laptop. But the Windows desktop stopped accepting any input from the keyboard and, after I removed it as a BT device, no longer shows it as an option for pairing.

I thought it might be my PC's BT receiver, so I ordered a new one. I'll test that.

However, I also tested the keyboard by connecting it to my iPad Pro. I'm seeing the same weird behavior there as I mentioned in the earlier post. I was able to pair the keyboard to the iPad, and for a couple of seconds it seemed to work fine. Then after I had typed a couple of words, it slowed down considerably, and started repeating keys. It then backspaced the words I had typed.

I switched back to the Mac, and it worked again. Then I switched back to the iPad, and it let me type for maybe 20 seconds, and then the same thing happened.

I switched to the Mac again, and it worked again. Then when I switched back, the iPad would not accept any input from the keyboard. After a switched back and forth a few times, the connection to the iPad started working for a while, but the typing lag got longer and longer until it stopped working at all again.

@xiongyihui
Copy link
Contributor

That's weird. I have tested with a Surface Laptop 3 with Windows 2004, an Xiaomi MIX 3 with Android 9 and an iPhone 6s with iOS 13.2. I don't find the same issue yet. I will try to test more devices.
Maybe, it is an issue related to the Bluetooth connection interval. Different systems may have different requirements.
Currently, we set the connection interval to 11.25. We can remove the following lines to see if the issue still will occur or not.

for c in self.ble.connections:
try:
# 11.25 ms is the min connection interval for most systems
c.connection_interval = 11.25
except Exception:
print("Failed to set ble connection interval")
# Avoid getting connection_interval, as it may block forever
# self.log('ble connection interval {}'.format(c.connection_interval))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants