Skip to content

esp32-snippets BLE replacement #4050

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

Closed

Conversation

vicatcu
Copy link
Contributor

@vicatcu vicatcu commented Jun 1, 2020

This PR was created by simply simply running this NodeJS script from a clean checkout of the latest / master branch of https://github.com/nkolban/esp32-snippets

const fs = require('fs');
const dest_dir = '/home/me/arduino-esp32/libraries/BLE/src';
const src_dir =  './cpp_utils';
const dest_files = fs.readdirSync(dest_dir);
const src_files = fs.readdirSync(src_dir);

src_files.forEach(file => {
  if (dest_files.indexOf(file) >= 0) {
    console.log(`copying file "${file}"`);
    fs.copyFileSync(`${src_dir}/${file}`, `${dest_dir}/${file}`);
  }
});

console.log('done');

It does not add new files, it merely replaces existing files in the arduino-esp32 library folder one-for-one.

This is in light of nkolban/esp32-snippets#796 and by proxy aims to address #4046 (comment)

geeksville added a commit to meshtastic/arduino-esp32-archive that referenced this pull request Jun 13, 2020
So I merged the pull-request mentioned in espressif#4046, and noticed a regression
compared to the code currently in master:

In my app I use light-sleep, and to do so I have to carefully not
just turnoff bluetooth, but stop and delete my various services before
going to sleep. During this process I would call BLEDevice::deinit(false).
That still works fine.

However, when my app woke from light-sleep and needed to restart bluetooth
it was hanging in registerApp:

```
Starting bluetooth
[D][BLEDevice.cpp:80] createServer(): >> createServer
[D][BLEServer.cpp:291] registerApp(): >> registerApp - 1
[D][FreeRTOS.cpp:164] take(): Semaphore taking: name: RegisterAppEvt (0x3ffdd7b0), owner: <N/A> for registerApp
[D][FreeRTOS.cpp:173] take(): Semaphore taken:  name: RegisterAppEvt (0x3ffdd7b0), owner: registerApp
```

To I poked around a bit, and it seems that in the PR espressif#4050 branch, there
is a change compared to master.  A bit of code that used to be #ifdef
was changed to be #ifndef.  Which has the effect of never setting
initialized to false.  If initialized is left true, my call to BLEDevice::init()
was having no effect.

So I've changed this ifdef back to what master had, and now my app works
nicely and the corruption I was previously seeing in my BLE structures
seems fixed (the original goal of pulling in 4050.
@vicatcu
Copy link
Contributor Author

vicatcu commented Jun 29, 2020

This is never going to be merged, and maybe it shouldn't be

@vicatcu vicatcu closed this Jun 29, 2020
@h2zero
Copy link
Contributor

h2zero commented Jul 2, 2020

For the most part this should be merged with a few changes, but like you said "never going to be merged".

I maintain a library here based on this API that is updated a much lighter weight if you want to check it out, I'd appreciate some more testers before release 😄.

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.

2 participants