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

Update BleKeyboard.cpp #54

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open

Conversation

DustinWatts
Copy link
Contributor

Edited BleKeyboard::begin and BleKeyboard::end to be able to delete the Task when stopping BleKeyboard. I had the need for this to so I could stop ESP32-BLE-Keyboard and start AsyncWebServer.

If you create a task like this:

TaskHandle_t xHandle = NULL;

void BleKeyboard::begin(void) { xTaskCreate(this->taskServer, "server", 20000, (void *)this, 5, &xHandle); }

You will be able to delete the task using BleKeyboard.end();

void BleKeyboard::end(void) { vTaskDelete(xHandle); }

Edited BleKeyboard::begin and BleKeyboard::end to be able to delete the Task when stopping BleKeyboard
@T-vK
Copy link
Owner

T-vK commented Nov 4, 2020

Thanks for your contribution. However, I would like to get #53 merged first and from what I recall it removes the xTaskCreate. I think with #53 merged the memory footprint will be greatly reduced and thus you should be able to run a webserver in parallel without having to end the BleKeyboard instance.
The only reason I haven't merged #53 yet is that I would like startAdvertising to be called by the library internally rather than forcing the user deal with this. Maybe you can help with that? Because rousir hasn't replied.

@DustinWatts
Copy link
Contributor Author

I can at least test it for you on Mac. I reduced the STACK_SIZE to about 2500 but is still wasn't good enough. That is why I create the vTaskDelete. In my case in doesn't matter because when the AsyncWebServer is started, I do not need BLE until I restart.

Was 20000, now it is 4096.
Defined BLE_KEYBOARD_VERSION "1.1" for debugging purposes.
@DustinWatts
Copy link
Contributor Author

I have changed the task size to 4096. 20000 was quite big. Haven't had issues since.

I also included BLE_KEYBOARD_VERSION "1.1" (Which off course can be any version number) for debugging purposes.

@asianplanet
Copy link

Thanks for the efforts and I have tested without issues on PC, Android. However, can someone suggest how to convert this to classic BT instead of BLE environment please? I am a volunteer worker teaching remote region juniors to make fun projects, To cut the story short, the facility only equipped with outdated computers (BT2.0) , no BLE.

@T-vK
Copy link
Owner

T-vK commented Jan 9, 2021

No it can't be converted. Maybe if you work at espressif.

@roblatour
Copy link

To Dustin Watts, thanks for posting this - it solved a problem I have been working on for a few days now.

T-vk - I would like to second Dustin Watts' request to have this change accepted.

ASTERIX should be ASTERISK :)
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

Successfully merging this pull request may close these issues.

4 participants