Repository navigation
Allow the user to set a custom bluetooth name using the cli - #3754
netrunnereve wants to merge 1 commit into
Conversation
|
They should implement this and move the default Meshcore - into this method. I think that would solve everything. |
From the way the backend code is written it looks like the Bluetooth name is intended to have a separate prefix (which can be changed at compile time) followed by the node name. I mean I could add another command to change the prefix as well but let's see what the maintainers think about this first. |
9dda58d to
1cdd9c5
Compare
1cdd9c5 to
2d44e14
Compare
| sprintf(reply, "> pin is now %06d", _prefs.ble_pin); | ||
| return true; | ||
| } | ||
| if (memcmp(command, "set ble_name ", 13) == 0) { |
There was a problem hiding this comment.
Can we please change all the commands from set ble_name to set ble.name. This will keep is consistent with all the other commands we have, that use dot notation, instead of underscores.
| sprintf(reply, "> %s", _prefs.ble_name[0] ? _prefs.ble_name : _prefs.node_name); | ||
| return true; | ||
| } | ||
| if (strcmp(command, "set ble_name_default") == 0) { |
There was a problem hiding this comment.
We could probably avoid having this extra command, by checking if the name passed to set ble.name is empty. In that case, reset it to default, as it shouldn't be allowed to have an empty name, so we can use that state to revert to default.
| def("defs_nm", _parent->default_scope_name, sizeof(_parent->default_scope_name)); | ||
| def("defs_key", (void *) _parent->default_scope_key, sizeof(_parent->default_scope_key)); | ||
| def("pin", _parent->ble_pin); | ||
| def("ble_name", _parent->ble_name, sizeof(_parent->ble_name)); |
There was a problem hiding this comment.
Underscore is fine here, just recommend updating the command strings themselves.
|
Hey, thanks for the PR @netrunnereve, I've left some comments in the review above.
We could possibly check if a custom name was set. If so, don't add the prefix. If a custom name is not set, add the prefix by default. That way users that want to hide that it's a MeshCore device, don't see the This could probably be done by passing in an empty string as prefix in |
This fixes #1243 by letting the user set their own bluetooth name using the cli. If there's no custom name set it'll automatically use the node name instead.
Note that this doesn't let them change the "Meshcore-" prefix as that apparently breaks some apps. If someone really wants to change that they'll have to build the firmware manually with a different
BLE_NAME_PREFIX.This acts as a workaround for #1769 as well since you now can just set a shorter name manually. I tested this on my Heltec v4 companion and it's working fine with a custom name set.