bt: call nvs_flash_init in examples, show error if NVS is not initialized
NVS is used to store PHY calibration data, WiFi configuration, and BT configuration. Previously BT examples did not call nvs_flash_init, relying on the fact that it is called during PHY init. However PHY init did not handle possible NVS initialization errors. This change moves PHY init procedure into the application, and adds diagnostic messages to BT config management routines if NVS is not initialized.
This commit is contained in:
@@ -18,6 +18,8 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "nvs.h"
|
||||
|
||||
/**
|
||||
* @brief Initialize NVS flash storage with layout given in the partition table.
|
||||
*
|
||||
@@ -30,6 +32,17 @@ extern "C" {
|
||||
esp_err_t nvs_flash_init(void);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Erase NVS partition
|
||||
*
|
||||
* This function erases all contents of NVS partition
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK on success
|
||||
* - ESP_ERR_NOT_FOUND if there is no NVS partition in the partition table
|
||||
*/
|
||||
esp_err_t nvs_flash_erase(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user