add cli option to set custom bluetooth name

This commit is contained in:
Eve committed 2026-11-12 11:09:43 -05:00
1 parent 75737f548e
commit 9e70d32f79
4 files changed
+36 -1

No files matched your search

+20
View File
@@ -2154,6 +2154,26 @@ bool MyMesh::handleCommand(const char* command, uint32_t sender_timestamp, char*
sprintf(reply, "> pin is now %06d", _prefs.ble_pin);
return true;
}
if (memcmp(command, "set ble_name ", 13) == 0) {
if (AdvertDataParser::isValidName(&command[13])) {
StrHelper::strncpy(_prefs.ble_name, &command[13], sizeof(_prefs.ble_name));
savePrefs();
sprintf(reply, "> BLE name is now %s (reboot to apply)", _prefs.ble_name);
} else {
strcpy(reply, "Error, bad chars");
}
return true;
}
if (strcmp(command, "get ble_name") == 0) {
sprintf(reply, "> %s", _prefs.ble_name[0] ? _prefs.ble_name : _prefs.node_name);
return true;
}
if (strcmp(command, "set ble_name_default") == 0) {
_prefs.ble_name[0] = 0;
savePrefs();
sprintf(reply, "> BLE name reset to %s (reboot to apply)", _prefs.node_name);
return true;
}
#ifdef ENABLE_WIFI_INTERFACE
if (memcmp(command, "set wifi.ssid ", 14) == 0) {