change prefix as well
This commit is contained in:
1 parent
de721bcb4b
commit
7416193a76
3 files changed
+14
-4
No files matched your search
@@ -421,7 +421,7 @@ Radio parameters are common to all roles and handled by `CommonRadioPrefs`.
|
||||
**Parameters:**
|
||||
- `name`: New BLE name
|
||||
|
||||
**Note:** By default the node name will be used as the BLE name. If `<name>` is empty the BLE name will be reset to the aforementioned default. These commands require a reboot to take effect.
|
||||
**Note:** By default the BLE name is `Meshcore-` followed by the node name. If `<name>` is empty the BLE name will be reset to the aforementioned default. These commands require a reboot to take effect.
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -2157,7 +2157,7 @@ bool MyMesh::handleCommand(const char* command, uint32_t sender_timestamp, char*
|
||||
if (strcmp(command, "set ble.name") == 0) {
|
||||
_prefs.ble_name[0] = 0;
|
||||
savePrefs();
|
||||
sprintf(reply, "> BLE name reset to %s (reboot to apply)", _prefs.node_name);
|
||||
sprintf(reply, "> BLE name reset to %s%s (reboot to apply)", BLE_NAME_PREFIX, _prefs.node_name);
|
||||
return true;
|
||||
}
|
||||
if (memcmp(command, "set ble.name ", 13) == 0) {
|
||||
@@ -2171,7 +2171,11 @@ bool MyMesh::handleCommand(const char* command, uint32_t sender_timestamp, char*
|
||||
return true;
|
||||
}
|
||||
if (strcmp(command, "get ble.name") == 0) {
|
||||
sprintf(reply, "> %s", _prefs.ble_name[0] ? _prefs.ble_name : _prefs.node_name);
|
||||
if (_prefs.ble_name[0]) {
|
||||
sprintf(reply, "> %s", _prefs.ble_name);
|
||||
} else {
|
||||
sprintf(reply, "> %s%s", BLE_NAME_PREFIX, _prefs.node_name);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -215,7 +215,13 @@ void setup() {
|
||||
|
||||
// add bluetooth interface
|
||||
#if defined(BLE_PIN_CODE)
|
||||
bluetooth_interface.begin(BLE_NAME_PREFIX, the_mesh.getNodePrefs()->ble_name[0] ? the_mesh.getNodePrefs()->ble_name : the_mesh.getNodePrefs()->node_name, the_mesh.getBLEPin());
|
||||
char *prefix = BLE_NAME_PREFIX;
|
||||
char *ble_name = the_mesh.getNodePrefs()->node_name;
|
||||
if (the_mesh.getNodePrefs()->ble_name[0]) {
|
||||
prefix = "";
|
||||
ble_name = the_mesh.getNodePrefs()->ble_name;
|
||||
}
|
||||
bluetooth_interface.begin((const char *) prefix, ble_name, the_mesh.getBLEPin());
|
||||
interface_manager.addInterface(InterfaceType::Bluetooth, &bluetooth_interface);
|
||||
#endif
|
||||
|
||||
|
||||
Reference in new issue
Block a user