mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-07 06:34:34 +02:00
examples: Add Kconfig for resetting provisioning config
This commit is contained in:
@@ -20,4 +20,11 @@ menu "Example Configuration"
|
|||||||
default 1 if EXAMPLE_PROV_TRANSPORT_BLE
|
default 1 if EXAMPLE_PROV_TRANSPORT_BLE
|
||||||
default 2 if EXAMPLE_PROV_TRANSPORT_SOFTAP
|
default 2 if EXAMPLE_PROV_TRANSPORT_SOFTAP
|
||||||
|
|
||||||
|
config EXAMPLE_RESET_PROVISIONED
|
||||||
|
bool
|
||||||
|
default n
|
||||||
|
prompt "Reset provisioned status of the device"
|
||||||
|
help
|
||||||
|
This erases the NVS to reset provisioned status of the device on every reboot.
|
||||||
|
Provisioned status is determined by the Wi-Fi STA configuration, saved on the NVS.
|
||||||
endmenu
|
endmenu
|
||||||
|
@@ -185,9 +185,13 @@ void app_main(void)
|
|||||||
ESP_ERROR_CHECK(wifi_prov_mgr_init(config));
|
ESP_ERROR_CHECK(wifi_prov_mgr_init(config));
|
||||||
|
|
||||||
bool provisioned = false;
|
bool provisioned = false;
|
||||||
|
#ifdef CONFIG_EXAMPLE_RESET_PROVISIONED
|
||||||
|
wifi_prov_mgr_reset_provisioning();
|
||||||
|
#else
|
||||||
/* Let's find out if the device is provisioned */
|
/* Let's find out if the device is provisioned */
|
||||||
ESP_ERROR_CHECK(wifi_prov_mgr_is_provisioned(&provisioned));
|
ESP_ERROR_CHECK(wifi_prov_mgr_is_provisioned(&provisioned));
|
||||||
|
|
||||||
|
#endif
|
||||||
/* If device is not yet provisioned start provisioning service */
|
/* If device is not yet provisioned start provisioning service */
|
||||||
if (!provisioned) {
|
if (!provisioned) {
|
||||||
ESP_LOGI(TAG, "Starting provisioning");
|
ESP_LOGI(TAG, "Starting provisioning");
|
||||||
|
Reference in New Issue
Block a user