Closed DavidPowell closed 2 years ago
Hi @DavidPowell ! Many thanks for your contribution! That is a good idea. There was also some other PR which tackles this issue but unfortunately I have not checked it and merged it (https://github.com/corneliusmunz/legoino/pull/60). In the used BLE Library (NimBLE) there is already a member variable where it is possible to check if a scan is already ongoing but I have never checked this state in the init function :-( I will try to review your PR next week after I am back from my vacation.
Thanks @corneliusmunz. Sorry that I didn't notice PR #60 - but it seems that you have merged it, I see this code appears in my own branch. I think I may not have understood all the terminology about scanning vs connecting etc.
I will check whether I can use this existing isScanning()
function rather than creating an additional variable, but it might take me a while to get to this.
I see now that my proposed solution is needlessly complex. I will create a new PR with the simpler solution based on isScanning()
.
Hey @corneliusmunz did you merge it yet? thanks!
Calling
Lpf2Hub::init()
repeatedly from the loop function causes the ESP32 to crash and reboot, see issue #56.I believe the origin of this problem is that
init()
does not check if a BLE scan is currently ongoing before creating another, noting that the function returns before the scan is complete.My solution is to create a static variable in the
Lpf2Hub
class, which is set by theinit()
method, and cleared by the scan end callback function.Resolves #56