Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use extended appFS metadata (step 1) #78

Merged
merged 2 commits into from
Jun 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion components/appfs
Submodule appfs updated 2 files
+29 −5 appfs.c
+36 −0 include/appfs.h
4 changes: 2 additions & 2 deletions main/appfs_wrapper.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ void appfs_boot_app(int fd) {
esp_deep_sleep_start();
}

void appfs_store_app(pax_buf_t* pax_buffer, ILI9341* ili9341, char* path, char* label) {
void appfs_store_app(pax_buf_t* pax_buffer, ILI9341* ili9341, char* path, const char* name, const char* title, uint16_t version) {
display_boot_screen(pax_buffer, ili9341, "Installing app...");
esp_err_t res;
appfs_handle_t handle;
Expand All @@ -70,7 +70,7 @@ void appfs_store_app(pax_buf_t* pax_buffer, ILI9341* ili9341, char* path, char*

ESP_LOGI(TAG, "Application size %d", app_size);

res = appfsCreateFile(label, app_size, &handle);
res = appfsCreateFileExt(name, title, version, app_size, &handle);
if (res != ESP_OK) {
display_boot_screen(pax_buffer, ili9341, "Failed to create file");
ESP_LOGE(TAG, "Failed to create file on AppFS (%d)", res);
Expand Down
2 changes: 1 addition & 1 deletion main/file_browser.c
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ void file_browser(xQueueHandle buttonQueue, pax_buf_t* pax_buffer, ILI9341* ili9
break;
} else {
printf("File selected: %s\n", menuArgs->path);
appfs_store_app(pax_buffer, ili9341, menuArgs->path, menuArgs->label);
appfs_store_app(pax_buffer, ili9341, menuArgs->path, menuArgs->label, menuArgs->label, 0);
}
menuArgs = NULL;
render = true;
Expand Down
2 changes: 1 addition & 1 deletion main/include/appfs_wrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@
esp_err_t appfs_init(void);
uint8_t* load_file_to_ram(FILE* fd, size_t* fsize);
void appfs_boot_app(int fd);
void appfs_store_app(pax_buf_t* pax_buffer, ILI9341* ili9341, char* path, char* label);
void appfs_store_app(pax_buf_t* pax_buffer, ILI9341* ili9341, char* path, const char* name, const char* title, uint16_t version);
14 changes: 12 additions & 2 deletions main/menus/launcher.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,21 @@ void menu_launcher(xQueueHandle buttonQueue, pax_buf_t* pax_buffer, ILI9341* ili
appfs_fd = appfsNextEntry(appfs_fd);
if (appfs_fd == APPFS_INVALID_FD) break;
const char* name = NULL;
appfsEntryInfo(appfs_fd, &name, NULL);
const char* title = NULL;
uint16_t version = 0xFFFF;
appfsEntryInfoExt(appfs_fd, &name, &title, &version, NULL);
menu_launcher_args_t* args = malloc(sizeof(menu_launcher_args_t));
args->fd = appfs_fd;
args->action = ACTION_APPFS;
menu_insert_item(menu, name, NULL, (void*) args, -1);

char label[64];
if (version < 0xFFFF) {
snprintf(label, sizeof(label), "%s (r%u)", title, version);
} else {
snprintf(label, sizeof(label), "%s (dev)", title);
}

menu_insert_item(menu, label, NULL, (void*) args, -1);
}

bool render = true;
Expand Down