| 76 | } |
| 77 | |
| 78 | esp_err_t initPartitionsEsp() { |
| 79 | LOGGER.info("Init partitions"); |
| 80 | ESP_ERROR_CHECK(initNvsFlashSafely()); |
| 81 | |
| 82 | const esp_vfs_fat_mount_config_t mount_config = { |
| 83 | .format_if_mount_failed = false, |
| 84 | .max_files = 4, |
| 85 | .allocation_unit_size = getSectorSize(), |
| 86 | .disk_status_check_enable = false, |
| 87 | .use_one_fat = true, |
| 88 | }; |
| 89 | |
| 90 | auto system_result = esp_vfs_fat_spiflash_mount_ro("/system", "system", &mount_config); |
| 91 | if (system_result != ESP_OK) { |
| 92 | LOGGER.error("Failed to mount /system ({})", esp_err_to_name(system_result)); |
| 93 | } else { |
| 94 | LOGGER.info("Mounted /system"); |
| 95 | static auto system_fs_data = PartitionFsData("/system"); |
| 96 | file_system_add(&partition_fs_api, &system_fs_data); |
| 97 | } |
| 98 | |
| 99 | auto data_result = esp_vfs_fat_spiflash_mount_rw_wl("/data", "data", &mount_config, &data_wl_handle); |
| 100 | if (data_result != ESP_OK) { |
| 101 | LOGGER.error("Failed to mount /data ({})", esp_err_to_name(data_result)); |
| 102 | } else { |
| 103 | LOGGER.info("Mounted /data"); |
| 104 | static auto data_fs_data = PartitionFsData("/data"); |
| 105 | file_system_add(&partition_fs_api, &data_fs_data); |
| 106 | } |
| 107 | |
| 108 | return system_result == ESP_OK && data_result == ESP_OK; |
| 109 | } |
| 110 | |
| 111 | } // namespace |
| 112 |
no test coverage detected