summaryrefslogtreecommitdiff
path: root/src/drivers/spiffs.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/drivers/spiffs.cpp')
-rw-r--r--src/drivers/spiffs.cpp35
1 files changed, 33 insertions, 2 deletions
diff --git a/src/drivers/spiffs.cpp b/src/drivers/spiffs.cpp
index 9a85c0d3..f03d2f68 100644
--- a/src/drivers/spiffs.cpp
+++ b/src/drivers/spiffs.cpp
@@ -14,7 +14,7 @@ namespace drivers {
[[maybe_unused]] static constexpr char kTag[] = "spiffs";
-esp_err_t spiffs_mount() {
+static auto mount_script_dir() -> esp_err_t {
esp_vfs_spiffs_conf_t config{
.base_path = "/lua",
.partition_label = "lua",
@@ -26,10 +26,41 @@ esp_err_t spiffs_mount() {
if (res == ESP_OK) {
size_t total, used;
esp_spiffs_info("lua", &total, &used);
- ESP_LOGI(kTag, "spiffs mounted okay. %d / %d ", used / 1024, total / 1024);
+ ESP_LOGI(kTag, "lua scripts mounted okay. %d / %d ", used / 1024,
+ total / 1024);
}
return res;
}
+static auto mount_repl_dir() -> esp_err_t {
+ esp_vfs_spiffs_conf_t config{
+ .base_path = "/repl",
+ .partition_label = "repl",
+ .max_files = 5,
+ .format_if_mount_failed = false,
+ };
+
+ esp_err_t res = esp_vfs_spiffs_register(&config);
+ if (res == ESP_OK) {
+ size_t total, used;
+ esp_spiffs_info("repl", &total, &used);
+ ESP_LOGI(kTag, "lua repl mounted okay. %d / %d ", used / 1024,
+ total / 1024);
+ }
+
+ return res;
+}
+
+esp_err_t spiffs_mount() {
+ esp_err_t res;
+ if ((res = mount_script_dir()) != ESP_OK) {
+ return res;
+ }
+ if ((res = mount_repl_dir()) != ESP_OK) {
+ return res;
+ }
+ return ESP_OK;
+}
+
} // namespace drivers