mirror of
https://github.com/h2zero/esp-nimble-cpp.git
synced 2024-11-24 14:10:55 +01:00
Update NimBLEAdvertising.cpp
Apparently a name length of 19 is a magic number because if it is longer than this then adding the null at the end isn't necessary, shortening the name works. Furthermore, adding the null appears to step on something and cause the uP to reboot. However if the name is shorter than 19 then adding a null at the end allows the name to be shortened without having the end of the previous longer name tacked onto the end of the shorter name AND it doesn't seem to step on anything as the uP appears to continue to operate fine.
This commit is contained in:
parent
6b555d763b
commit
217d06ca3a
1 changed files with 1 additions and 1 deletions
|
@ -138,7 +138,7 @@ void NimBLEAdvertising::addTxPower() {
|
|||
*/
|
||||
void NimBLEAdvertising::setName(const std::string &name) {
|
||||
m_name.assign(name.begin(), name.end());
|
||||
m_name[name.length()] = 0;
|
||||
if (name.length() <= 19) m_name[name.length()] = 0;
|
||||
m_advData.name = &m_name[0];
|
||||
m_advData.name_len = m_name.size();
|
||||
m_advDataSet = false;
|
||||
|
|
Loading…
Reference in a new issue