Code: Select all
void inc_total_time(){
total_time++;
nvs_handle my_handle;
esp_err_t err = nvs_open(SYS_STORAGE_NAMESPACE, NVS_READWRITE, &my_handle);
if (err != ESP_OK) {
printf("Error (%d) opening NVS!\n", err);
}
err = nvs_set_i32(my_handle, "total_time", total_time);
if (err != ESP_OK) {
printf("ERROR (Close Storage): %d\n", err);
return;
}
err = nvs_commit(my_handle);
if (err != ESP_OK) {
printf("ERROR(Commit Storage): %d\n", err);
return;
}
nvs_close(my_handle);
}