main.cpp 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /*
  2. *
  3. * Copyright (c) 2021 Project CHIP Authors
  4. *
  5. * Licensed under the Apache License, Version 2.0 (the "License");
  6. * you may not use this file except in compliance with the License.
  7. * You may obtain a copy of the License at
  8. *
  9. * http://www.apache.org/licenses/LICENSE-2.0
  10. *
  11. * Unless required by applicable law or agreed to in writing, software
  12. * distributed under the License is distributed on an "AS IS" BASIS,
  13. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. * See the License for the specific language governing permissions and
  15. * limitations under the License.
  16. */
  17. #include "KeyValueStorageTest.h"
  18. #include "esp_log.h"
  19. #include "freertos/FreeRTOS.h"
  20. #include "freertos/task.h"
  21. #include "nvs_flash.h"
  22. #include <lib/support/ErrorStr.h>
  23. #include <platform/KeyValueStoreManager.h>
  24. const char * TAG = "persistent-storage";
  25. extern "C" void app_main()
  26. {
  27. esp_err_t err = nvs_flash_init();
  28. if (err != ESP_OK)
  29. {
  30. ESP_LOGE(TAG, "nvs_flash_init() failed: %s", esp_err_to_name(err));
  31. return;
  32. }
  33. ESP_LOGI(TAG, "=============================================");
  34. ESP_LOGI(TAG, "chip-esp32-persitent-storage-example starting");
  35. ESP_LOGI(TAG, "=============================================");
  36. // Run tests
  37. while (true)
  38. {
  39. ESP_LOGI(TAG, "Running Tests:");
  40. // Partial and offset reads are not currently supported on the ESP32
  41. // platform, skip these tests,
  42. chip::RunKvsTest(chip::SKIP_MULTI_READ_TEST);
  43. vTaskDelay(60000); // Run every minute
  44. }
  45. }