kopia lustrzana https://github.com/espressif/esp-idf
Merge branch 'bugfix/nvs_cxx_example' into 'master'
nvs_flash: fixed wrong error check after open_nvs_handle in example Closes IDFGH-8809 See merge request espressif/esp-idf!21269pull/10469/head
commit
732b76e3a0
|
@ -224,7 +224,7 @@ protected:
|
||||||
* - ESP_ERR_NVS_INVALID_NAME if namespace name doesn't satisfy constraints
|
* - ESP_ERR_NVS_INVALID_NAME if namespace name doesn't satisfy constraints
|
||||||
* - other error codes from the underlying storage driver
|
* - other error codes from the underlying storage driver
|
||||||
*
|
*
|
||||||
* @return shared pointer of an nvs handle on success, an empty shared pointer otherwise
|
* @return unique pointer of an nvs handle on success, an empty unique pointer otherwise
|
||||||
*/
|
*/
|
||||||
std::unique_ptr<NVSHandle> open_nvs_handle_from_partition(const char *partition_name,
|
std::unique_ptr<NVSHandle> open_nvs_handle_from_partition(const char *partition_name,
|
||||||
const char *ns_name,
|
const char *ns_name,
|
||||||
|
|
|
@ -33,9 +33,8 @@ extern "C" void app_main(void)
|
||||||
// Open
|
// Open
|
||||||
printf("\n");
|
printf("\n");
|
||||||
printf("Opening Non-Volatile Storage (NVS) handle... ");
|
printf("Opening Non-Volatile Storage (NVS) handle... ");
|
||||||
esp_err_t result;
|
|
||||||
// Handle will automatically close when going out of scope or when it's reset.
|
// Handle will automatically close when going out of scope or when it's reset.
|
||||||
std::shared_ptr<nvs::NVSHandle> handle = nvs::open_nvs_handle("storage", NVS_READWRITE, &result);
|
std::unique_ptr<nvs::NVSHandle> handle = nvs::open_nvs_handle("storage", NVS_READWRITE, &err);
|
||||||
if (err != ESP_OK) {
|
if (err != ESP_OK) {
|
||||||
printf("Error (%s) opening NVS handle!\n", esp_err_to_name(err));
|
printf("Error (%s) opening NVS handle!\n", esp_err_to_name(err));
|
||||||
} else {
|
} else {
|
||||||
|
|
Ładowanie…
Reference in New Issue