Skip to content

Commit 4250add

Browse files
committed
app_wifi: Make provisioning prefix configurable
1 parent c0af462 commit 4250add

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

examples/common/app_wifi/Kconfig.projbuild

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,13 @@ menu "ESP RainMaker App Wi-Fi Provisioning"
5454
default 30
5555
help
5656
Timeout (in minutes) after which the provisioning will auto stop. A reboot will be required
57-
to restart provisioning. Set to 0 if you do not want provisioning to auto stop.
58-
It is recommended to set this to some non zero value if provisioning does not have PoP.
57+
to restart provisioning. It is always recommended to set this to some non zero value, especially
58+
if you are not using PoP. Set to 0 if you do not want provisioning to auto stop.
59+
60+
config APP_WIFI_PROV_NAME_PREFIX
61+
string "Provisioning Name Prefix"
62+
default "PROV"
63+
help
64+
Provisioning Name Prefix.
5965

6066
endmenu

examples/common/app_wifi/app_wifi.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -234,14 +234,14 @@ static esp_err_t read_random_bytes_from_nvs(uint8_t **random_bytes, size_t *len)
234234
static esp_err_t get_device_service_name(char *service_name, size_t max)
235235
{
236236
uint8_t *nvs_random = NULL;
237-
const char *ssid_prefix = "PROV_";
237+
const char *ssid_prefix = CONFIG_APP_WIFI_PROV_NAME_PREFIX;
238238
size_t nvs_random_size = 0;
239239
if ((read_random_bytes_from_nvs(&nvs_random, &nvs_random_size) != ESP_OK) || nvs_random_size < 3) {
240240
uint8_t eth_mac[6];
241241
esp_wifi_get_mac(WIFI_IF_STA, eth_mac);
242-
snprintf(service_name, max, "%s%02x%02x%02x", ssid_prefix, eth_mac[3], eth_mac[4], eth_mac[5]);
242+
snprintf(service_name, max, "%s_%02x%02x%02x", ssid_prefix, eth_mac[3], eth_mac[4], eth_mac[5]);
243243
} else {
244-
snprintf(service_name, max, "%s%02x%02x%02x", ssid_prefix, nvs_random[nvs_random_size - 3],
244+
snprintf(service_name, max, "%s_%02x%02x%02x", ssid_prefix, nvs_random[nvs_random_size - 3],
245245
nvs_random[nvs_random_size - 2], nvs_random[nvs_random_size - 1]);
246246
}
247247
if (nvs_random) {

0 commit comments

Comments
 (0)