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

Opens file directly and Parametric IR_REMOTE_PATH #7

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions infrared_remote.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include <stdbool.h>

#include "infrared_remote_button.h"
#define IR_REMOTE_PATH EXT_PATH("infrared/remote")

typedef struct InfraredRemote InfraredRemote;

Expand Down
36 changes: 20 additions & 16 deletions infrared_remote_app.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,7 @@ static void app_input_callback(InputEvent* input_event, void* ctx) {
furi_message_queue_put(event_queue, input_event, FuriWaitForever);
}

int32_t infrared_remote_app(void* p) {
UNUSED(p);
int32_t infrared_remote_app(char* p) {
FuriMessageQueue* event_queue = furi_message_queue_alloc(8, sizeof(InputEvent));

// App button string
Expand Down Expand Up @@ -137,21 +136,26 @@ int32_t infrared_remote_app(void* p) {

InputEvent event;

Storage* storage = furi_record_open(RECORD_STORAGE);
FlipperFormat* ff = flipper_format_file_alloc(storage);

DialogsApp* dialogs = furi_record_open(RECORD_DIALOGS);
DialogsFileBrowserOptions browser_options;
dialog_file_browser_set_basic_options(&browser_options, ".txt", &I_sub1_10px);
FuriString* map_file = furi_string_alloc();
furi_string_set(map_file,"/ext/ir_remote");
if(!storage_file_exists(storage, ANY_PATH("ir_remote"))){
storage_common_mkdir(storage, ANY_PATH("ir_remote"));//Make Folder If dir not exist
FuriString* map_file = furi_string_alloc();
Storage* storage = furi_record_open(RECORD_STORAGE);
FlipperFormat* ff = flipper_format_file_alloc(storage);
if(!storage_file_exists(storage, IR_REMOTE_PATH)) {
storage_common_mkdir(storage, IR_REMOTE_PATH); //Make Folder If dir not exist
}

bool res = dialog_file_browser_show(dialogs, map_file, map_file, &browser_options);

furi_record_close(RECORD_DIALOGS);
bool res;
if(p && strlen(p)) {
furi_string_set(map_file, p);
res = true;
} else {
DialogsApp* dialogs = furi_record_open(RECORD_DIALOGS);
DialogsFileBrowserOptions browser_options;
dialog_file_browser_set_basic_options(&browser_options, ".txt", &I_sub1_10px);
browser_options.base_path = IR_REMOTE_PATH;
furi_string_set(map_file, IR_REMOTE_PATH);
res = dialog_file_browser_show(dialogs, map_file, map_file, &browser_options);
furi_record_close(RECORD_DIALOGS);
}

// if user didn't choose anything, free everything and exit
if(!res){
Expand Down Expand Up @@ -663,4 +667,4 @@ int32_t infrared_remote_app(void* p) {
furi_record_close(RECORD_GUI);

return 0;
}
}