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

[iOS] New Line seems not to be send corectly #48

Open
SunboX opened this issue Oct 6, 2020 · 10 comments
Open

[iOS] New Line seems not to be send corectly #48

SunboX opened this issue Oct 6, 2020 · 10 comments

Comments

@SunboX
Copy link

SunboX commented Oct 6, 2020

If I'm trying to send something like this:

bleKeyboard.print("0000111133335\n");
bleKeyboard.print("0000111133335\n");
bleKeyboard.print("0000111133335\n");
bleKeyboard.print("0000111133335\n");

it mostly gets printed on iOS like this:

0000111133335000011113333500001111333350000111133335

and sometimes like this

0000111133335000011113333500001111333350000111133335








...(never ending new lines)

I would expect it like this:

0000111133335
0000111133335
0000111133335
0000111133335

I know, there's no official OSX or iOS support yet. But it's working really well so far. Just this issue is frustrating.

@T-vK
Copy link
Owner

T-vK commented Oct 7, 2020

Try println: https://www.arduino.cc/reference/en/language/functions/usb/keyboard/keyboardprintln/
Or check: https://forum.arduino.cc/index.php?topic=243947.0

@SunboX
Copy link
Author

SunboX commented Oct 7, 2020

Thx, will try it!

@T-vK
Copy link
Owner

T-vK commented Oct 7, 2020

The example has an example for sending an enter key as well: https://github.com/T-vK/ESP32-BLE-Keyboard/blob/master/examples/SendKeyStrokes/SendKeyStrokes.ino

@T-vK T-vK closed this as completed Oct 7, 2020
@SunboX
Copy link
Author

SunboX commented Oct 8, 2020

Sadly, none of both versions did work. I tried this one:

bleKeyboard.println("0000111133335");

and also this one:

bleKeyboard.print("0000111133335");
bleKeyboard.write(KEY_RETURN);

PXL_20201008_065841188
PXL_20201008_065916470

@T-vK T-vK reopened this Oct 8, 2020
@T-vK
Copy link
Owner

T-vK commented Oct 8, 2020

Can you try adding delays and separating the press and release for the ENTER key?

Like this:

bleKeyboard.print("0000111133335");
delay(500); // wait 1/2 a second
bleKeyboard.press(KEY_RETURN); // Hold enter key down
delay(500); // wait 1/2 a second
bleKeyboard.release(KEY_RETURN); // Release enter key
delay(500); // wait 1/2 a second

Do other characters work? What about letters that involve the shift key? Can you test bleKeyboard.print("Hello");?

Also, can you rule out that the issue is with the app? For example by sending the keys to a different note app?

@SunboX
Copy link
Author

SunboX commented Oct 8, 2020

Yep, that did the trick:

PXL_20201008_094053796
PXL_20201008_094100225

@SunboX
Copy link
Author

SunboX commented Oct 8, 2020

I did some tests, 30ms has many missed line breaks, 40ms still has some occasional misses, with 50ms it seems to be fine.

@SunboX
Copy link
Author

SunboX commented Oct 8, 2020

Can we add some config parameter for such a delay between key events?

@T-vK
Copy link
Owner

T-vK commented Oct 8, 2020

I want to keep the BLE Keyboard library compatible with the USB Keyboard library, so probably not. But feel free to write your own function that wraps the print, press, release and delay.

@T-vK
Copy link
Owner

T-vK commented Aug 30, 2021

We have added a default delay of 7 milliseconds in PR #111 and also added a setDelay method. We need some people to test it before we can merge it and release a new version though. (Especially with Mac OS and iOS devices.) Maybe you can give it a try?

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