From 80b8a0dddbf351506526328d816ce28108726089 Mon Sep 17 00:00:00 2001 From: Willy-JL Date: Sun, 12 Feb 2023 07:39:15 +0000 Subject: [PATCH 01/10] Fix file browser clownage comment --- applications/services/gui/modules/file_browser_worker.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/applications/services/gui/modules/file_browser_worker.c b/applications/services/gui/modules/file_browser_worker.c index 4b7be70a12..e9877f277d 100644 --- a/applications/services/gui/modules/file_browser_worker.c +++ b/applications/services/gui/modules/file_browser_worker.c @@ -226,13 +226,15 @@ static bool // break; // } - // FLIPPER DEVS MOMENT - // this used to load the file list in chunks, and then sort it... + // ROGUE MASTER MOMENT + // this used to load the file list in chunks, which makes sense + // but then RM made it sort the files, still in chunks... // so while scrolling, it loads more files and sorts them... // chances are, the new files are higher in the sorted list... // so the files keep shifting around while scrolling... - // now this does something intelligent and loads all in one go. + // now this does something intelligent: loads and sorts all in one go. // might take a few milliseconds longer, but atleast it works :kekw: + // and yes skotopes, most definitely a "limitation of fatfs driver" :roflmao: UNUSED(offset); UNUSED(count); if(browser->list_load_cb) { From 82f77edc702f5631c806a7f7b9f250b721628ab9 Mon Sep 17 00:00:00 2001 From: Willy-JL Date: Sun, 12 Feb 2023 11:15:11 +0000 Subject: [PATCH 02/10] Fix file browser back history --- .../main/archive/helpers/archive_browser.c | 3 ++- .../services/gui/modules/file_browser.c | 27 ++++++++++++++----- .../gui/modules/file_browser_worker.c | 4 +-- .../gui/modules/file_browser_worker.h | 1 + 4 files changed, 26 insertions(+), 9 deletions(-) diff --git a/applications/main/archive/helpers/archive_browser.c b/applications/main/archive/helpers/archive_browser.c index 97c68545e1..b37c550bdc 100644 --- a/applications/main/archive/helpers/archive_browser.c +++ b/applications/main/archive/helpers/archive_browser.c @@ -58,8 +58,9 @@ static void archive_list_load_cb(void* context, uint32_t list_load_offset) { } static void - archive_list_item_cb(void* context, FuriString* item_path, bool is_folder, bool is_last) { + archive_list_item_cb(void* context, FuriString* item_path, uint32_t idx, bool is_folder, bool is_last) { furi_assert(context); + UNUSED(idx); ArchiveBrowserView* browser = (ArchiveBrowserView*)context; if(!is_last) { diff --git a/applications/services/gui/modules/file_browser.c b/applications/services/gui/modules/file_browser.c index dc3c65eedc..3639c140e8 100644 --- a/applications/services/gui/modules/file_browser.c +++ b/applications/services/gui/modules/file_browser.c @@ -34,6 +34,7 @@ typedef enum { } BrowserItemType; typedef struct { + uint32_t unsorted_idx; FuriString* path; BrowserItemType type; uint8_t* custom_icon_data; @@ -41,6 +42,7 @@ typedef struct { } BrowserItem_t; static void BrowserItem_t_init(BrowserItem_t* obj) { + obj->unsorted_idx = 0; obj->type = BrowserItemTypeLoading; obj->path = furi_string_alloc(); obj->display_name = furi_string_alloc(); @@ -48,6 +50,7 @@ static void BrowserItem_t_init(BrowserItem_t* obj) { } static void BrowserItem_t_init_set(BrowserItem_t* obj, const BrowserItem_t* src) { + obj->unsorted_idx = src->unsorted_idx; obj->type = src->type; obj->path = furi_string_alloc_set(src->path); obj->display_name = furi_string_alloc_set(src->display_name); @@ -60,6 +63,7 @@ static void BrowserItem_t_init_set(BrowserItem_t* obj, const BrowserItem_t* src) } static void BrowserItem_t_set(BrowserItem_t* obj, const BrowserItem_t* src) { + obj->unsorted_idx = src->unsorted_idx; obj->type = src->type; furi_string_set(obj->path, src->path); furi_string_set(obj->display_name, src->display_name); @@ -158,7 +162,7 @@ static void browser_folder_open_cb(void* context, uint32_t item_cnt, int32_t file_idx, bool is_root); static void browser_list_load_cb(void* context, uint32_t list_load_offset); static void - browser_list_item_cb(void* context, FuriString* item_path, bool is_folder, bool is_last); + browser_list_item_cb(void* context, FuriString* item_path, uint32_t idx, bool is_folder, bool is_last); static void browser_long_load_cb(void* context); static void file_browser_scroll_timer_callback(void* context) { @@ -413,12 +417,13 @@ static void browser_list_load_cb(void* context, uint32_t list_load_offset) { } static void - browser_list_item_cb(void* context, FuriString* item_path, bool is_folder, bool is_last) { + browser_list_item_cb(void* context, FuriString* item_path, uint32_t idx, bool is_folder, bool is_last) { furi_assert(context); FileBrowser* browser = (FileBrowser*)context; BrowserItem_t item; item.custom_icon_data = NULL; + item.unsorted_idx = idx; if(!is_last) { item.path = furi_string_alloc_set(item_path); @@ -465,10 +470,23 @@ static void browser->view, FileBrowserModel * model, { + FuriString* selected = NULL; + if(model->item_idx > 0) { + selected = furi_string_alloc_set(items_array_get(model->items, model->item_idx)->path); + } items_array_sort(model->items); + if(selected) { + for(uint32_t i = 0; i < model->item_cnt; i++) { + if(!furi_string_cmp(items_array_get(model->items, i)->path, selected)) { + model->item_idx = i; + break; + } + } + } model->list_loading = false; }, true); + browser_update_offset(browser); } } @@ -667,10 +685,7 @@ static bool file_browser_view_input_callback(InputEvent* event, void* context) { if(browser_is_item_in_array(model, model->item_idx)) { selected_item = items_array_get(model->items, model->item_idx - model->array_offset); - select_index = model->item_idx; - if((!model->is_root) && (select_index > 0)) { - select_index -= 1; - } + select_index = selected_item->unsorted_idx; } }, false); diff --git a/applications/services/gui/modules/file_browser_worker.c b/applications/services/gui/modules/file_browser_worker.c index e9877f277d..28a9684282 100644 --- a/applications/services/gui/modules/file_browser_worker.c +++ b/applications/services/gui/modules/file_browser_worker.c @@ -247,13 +247,13 @@ static bool furi_string_printf(name_str, "%s/%s", furi_string_get_cstr(path), name_temp); if(browser->list_item_cb) { browser->list_item_cb( - browser->cb_ctx, name_str, (file_info.flags & FSF_DIRECTORY), false); + browser->cb_ctx, name_str, items_cnt, (file_info.flags & FSF_DIRECTORY), false); } items_cnt++; } } if(browser->list_item_cb) { - browser->list_item_cb(browser->cb_ctx, NULL, false, true); + browser->list_item_cb(browser->cb_ctx, NULL, 0, false, true); } ret = true; } while(0); diff --git a/applications/services/gui/modules/file_browser_worker.h b/applications/services/gui/modules/file_browser_worker.h index 3b4be6aa77..19a9337ff7 100644 --- a/applications/services/gui/modules/file_browser_worker.h +++ b/applications/services/gui/modules/file_browser_worker.h @@ -17,6 +17,7 @@ typedef void (*BrowserWorkerListLoadCallback)(void* context, uint32_t list_load_ typedef void (*BrowserWorkerListItemCallback)( void* context, FuriString* item_path, + uint32_t idx, bool is_folder, bool is_last); typedef void (*BrowserWorkerLongLoadCallback)(void* context); From 5a2f6935517020b1483f02ee41f53216c0e550d3 Mon Sep 17 00:00:00 2001 From: Willy-JL Date: Sun, 12 Feb 2023 11:16:12 +0000 Subject: [PATCH 03/10] File browser load speed improvements (skip redraw) --- applications/main/archive/views/archive_browser_view.c | 2 +- applications/services/gui/modules/file_browser.c | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/applications/main/archive/views/archive_browser_view.c b/applications/main/archive/views/archive_browser_view.c index 26ed17d75d..d40b716b8f 100644 --- a/applications/main/archive/views/archive_browser_view.c +++ b/applications/main/archive/views/archive_browser_view.c @@ -482,7 +482,7 @@ static bool archive_view_input(InputEvent* event, void* context) { model->scroll_counter = 0; } }, - true); + false); archive_update_offset(browser); } diff --git a/applications/services/gui/modules/file_browser.c b/applications/services/gui/modules/file_browser.c index 3639c140e8..1fdfc7c9ad 100644 --- a/applications/services/gui/modules/file_browser.c +++ b/applications/services/gui/modules/file_browser.c @@ -351,7 +351,7 @@ static void browser_update_offset(FileBrowser* browser) { CLAMP(model->item_idx - 1, (int32_t)model->item_cnt - bounds, 0); } }, - false); + true); } static void @@ -383,7 +383,7 @@ static void model->list_loading = true; model->folder_loading = false; }, - true); + false); browser_update_offset(browser); file_browser_worker_load(browser->worker, load_offset, ITEM_LIST_LEN_MAX); @@ -459,7 +459,7 @@ static void items_array_push_back(model->items, item); // TODO: calculate if element is visible }, - true); + false); furi_string_free(item.display_name); furi_string_free(item.path); if(item.custom_icon_data) { @@ -485,7 +485,7 @@ static void } model->list_loading = false; }, - true); + false); browser_update_offset(browser); } } @@ -670,7 +670,7 @@ static bool file_browser_view_input_callback(InputEvent* event, void* context) { model->scroll_counter = 0; } }, - true); + false); browser_update_offset(browser); consumed = true; } From 37b84a9dbb025aba0485f3648d1c8e801247b0a2 Mon Sep 17 00:00:00 2001 From: Willy-JL Date: Sun, 12 Feb 2023 12:28:40 +0000 Subject: [PATCH 04/10] Remove unnecessary sarcastic comment --- applications/services/gui/modules/file_browser_worker.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/applications/services/gui/modules/file_browser_worker.c b/applications/services/gui/modules/file_browser_worker.c index 28a9684282..5955d8714c 100644 --- a/applications/services/gui/modules/file_browser_worker.c +++ b/applications/services/gui/modules/file_browser_worker.c @@ -233,8 +233,7 @@ static bool // chances are, the new files are higher in the sorted list... // so the files keep shifting around while scrolling... // now this does something intelligent: loads and sorts all in one go. - // might take a few milliseconds longer, but atleast it works :kekw: - // and yes skotopes, most definitely a "limitation of fatfs driver" :roflmao: + // might take a few milliseconds longer, but atleast it works UNUSED(offset); UNUSED(count); if(browser->list_load_cb) { From 896a78c645b34b508da4d087312d83487e39271a Mon Sep 17 00:00:00 2001 From: MX <10697207+xMasterX@users.noreply.github.com> Date: Sun, 12 Feb 2023 20:02:27 +0300 Subject: [PATCH 05/10] Use 17 (1W) pin for subghz debug mode --- .../main/subghz/scenes/subghz_scene_ext_module_settings.c | 2 +- applications/main/subghz/subghz_i.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/applications/main/subghz/scenes/subghz_scene_ext_module_settings.c b/applications/main/subghz/scenes/subghz_scene_ext_module_settings.c index 7d7a505cbb..4627c57be0 100644 --- a/applications/main/subghz/scenes/subghz_scene_ext_module_settings.c +++ b/applications/main/subghz/scenes/subghz_scene_ext_module_settings.c @@ -13,7 +13,7 @@ const char* const radio_modules_variables_text[] = { #define DEBUG_P_COUNT 2 const char* const debug_pin_text[DEBUG_P_COUNT] = { "OFF", - "A7", + "17(1W)", }; static void subghz_scene_ext_module_changed(VariableItem* item) { diff --git a/applications/main/subghz/subghz_i.c b/applications/main/subghz/subghz_i.c index 1fbe662ed2..9f9a4be8fd 100644 --- a/applications/main/subghz/subghz_i.c +++ b/applications/main/subghz/subghz_i.c @@ -598,7 +598,7 @@ void subghz_hopper_update(SubGhz* subghz) { void subghz_speaker_on(SubGhz* subghz) { if(subghz->txrx->debug_pin_state) { - furi_hal_subghz_set_async_mirror_pin(&gpio_ext_pa7); + furi_hal_subghz_set_async_mirror_pin(&ibutton_gpio); } if(subghz->txrx->speaker_state == SubGhzSpeakerStateEnable) { @@ -643,7 +643,7 @@ void subghz_speaker_mute(SubGhz* subghz) { void subghz_speaker_unmute(SubGhz* subghz) { if(subghz->txrx->debug_pin_state) { - furi_hal_subghz_set_async_mirror_pin(&gpio_ext_pa7); + furi_hal_subghz_set_async_mirror_pin(&ibutton_gpio); } if(subghz->txrx->speaker_state == SubGhzSpeakerStateEnable) { if(furi_hal_speaker_is_mine()) { From ca12057426368d48e87805015c68eb58b961feea Mon Sep 17 00:00:00 2001 From: MX <10697207+xMasterX@users.noreply.github.com> Date: Sun, 12 Feb 2023 23:55:39 +0300 Subject: [PATCH 06/10] Fix large folders parsing --- .../services/gui/modules/file_browser.c | 41 +++++--- .../gui/modules/file_browser_worker.c | 94 ++++++++++++++++++- 2 files changed, 119 insertions(+), 16 deletions(-) diff --git a/applications/services/gui/modules/file_browser.c b/applications/services/gui/modules/file_browser.c index 1fdfc7c9ad..2b8f2a2711 100644 --- a/applications/services/gui/modules/file_browser.c +++ b/applications/services/gui/modules/file_browser.c @@ -161,8 +161,12 @@ static bool file_browser_view_input_callback(InputEvent* event, void* context); static void browser_folder_open_cb(void* context, uint32_t item_cnt, int32_t file_idx, bool is_root); static void browser_list_load_cb(void* context, uint32_t list_load_offset); -static void - browser_list_item_cb(void* context, FuriString* item_path, uint32_t idx, bool is_folder, bool is_last); +static void browser_list_item_cb( + void* context, + FuriString* item_path, + uint32_t idx, + bool is_folder, + bool is_last); static void browser_long_load_cb(void* context); static void file_browser_scroll_timer_callback(void* context) { @@ -416,8 +420,12 @@ static void browser_list_load_cb(void* context, uint32_t list_load_offset) { BrowserItem_t_clear(&back_item); } -static void - browser_list_item_cb(void* context, FuriString* item_path, uint32_t idx, bool is_folder, bool is_last) { +static void browser_list_item_cb( + void* context, + FuriString* item_path, + uint32_t idx, + bool is_folder, + bool is_last) { furi_assert(context); FileBrowser* browser = (FileBrowser*)context; @@ -470,16 +478,21 @@ static void browser->view, FileBrowserModel * model, { - FuriString* selected = NULL; - if(model->item_idx > 0) { - selected = furi_string_alloc_set(items_array_get(model->items, model->item_idx)->path); - } - items_array_sort(model->items); - if(selected) { - for(uint32_t i = 0; i < model->item_cnt; i++) { - if(!furi_string_cmp(items_array_get(model->items, i)->path, selected)) { - model->item_idx = i; - break; + if(model->item_cnt < 430) { + FuriString* selected = NULL; + if(model->item_idx > 0) { + selected = furi_string_alloc_set( + items_array_get(model->items, model->item_idx)->path); + } + + items_array_sort(model->items); + + if(selected != NULL) { + for(uint32_t i = 0; i < model->item_cnt; i++) { + if(!furi_string_cmp(items_array_get(model->items, i)->path, selected)) { + model->item_idx = i; + break; + } } } } diff --git a/applications/services/gui/modules/file_browser_worker.c b/applications/services/gui/modules/file_browser_worker.c index 5955d8714c..faf307d558 100644 --- a/applications/services/gui/modules/file_browser_worker.c +++ b/applications/services/gui/modules/file_browser_worker.c @@ -189,6 +189,87 @@ static bool browser_folder_init( return state; } +static bool browser_folder_load_chunked( + BrowserWorker* browser, + FuriString* path, + uint32_t offset, + uint32_t count) { + FileInfo file_info; + + Storage* storage = furi_record_open(RECORD_STORAGE); + File* directory = storage_file_alloc(storage); + + char name_temp[FILE_NAME_LEN_MAX]; + FuriString* name_str; + name_str = furi_string_alloc(); + + uint32_t items_cnt = 0; + + do { + if(!storage_dir_open(directory, furi_string_get_cstr(path))) { + break; + } + + items_cnt = 0; + while(items_cnt < offset) { + if(!storage_dir_read(directory, &file_info, name_temp, FILE_NAME_LEN_MAX)) { + break; + } + if(storage_file_get_error(directory) == FSE_OK) { + furi_string_set(name_str, name_temp); + if(browser_filter_by_name(browser, name_str, (file_info.flags & FSF_DIRECTORY))) { + items_cnt++; + } + } else { + break; + } + } + if(items_cnt != offset) { + break; + } + + if(browser->list_load_cb) { + browser->list_load_cb(browser->cb_ctx, offset); + } + + items_cnt = 0; + while(items_cnt < count) { + if(!storage_dir_read(directory, &file_info, name_temp, FILE_NAME_LEN_MAX)) { + break; + } + if(storage_file_get_error(directory) == FSE_OK) { + furi_string_set(name_str, name_temp); + if(browser_filter_by_name(browser, name_str, (file_info.flags & FSF_DIRECTORY))) { + furi_string_printf(name_str, "%s/%s", furi_string_get_cstr(path), name_temp); + if(browser->list_item_cb) { + browser->list_item_cb( + browser->cb_ctx, + name_str, + items_cnt, + (file_info.flags & FSF_DIRECTORY), + false); + } + items_cnt++; + } + } else { + break; + } + } + if(browser->list_item_cb) { + browser->list_item_cb(browser->cb_ctx, NULL, 0, false, true); + } + } while(0); + + furi_string_free(name_str); + + storage_dir_close(directory); + storage_file_free(directory); + + furi_record_close(RECORD_STORAGE); + + return (items_cnt == count); +} + static bool browser_folder_load(BrowserWorker* browser, FuriString* path, uint32_t offset, uint32_t count) { FileInfo file_info; @@ -246,7 +327,11 @@ static bool furi_string_printf(name_str, "%s/%s", furi_string_get_cstr(path), name_temp); if(browser->list_item_cb) { browser->list_item_cb( - browser->cb_ctx, name_str, items_cnt, (file_info.flags & FSF_DIRECTORY), false); + browser->cb_ctx, + name_str, + items_cnt, + (file_info.flags & FSF_DIRECTORY), + false); } items_cnt++; } @@ -361,7 +446,12 @@ static int32_t browser_worker(void* context) { if(flags & WorkerEvtLoad) { FURI_LOG_D( TAG, "Load offset: %lu cnt: %lu", browser->load_offset, browser->load_count); - browser_folder_load(browser, path, browser->load_offset, browser->load_count); + if(items_cnt > 430) { + browser_folder_load_chunked( + browser, path, browser->load_offset, browser->load_count); + } else { + browser_folder_load(browser, path, browser->load_offset, browser->load_count); + } } if(flags & WorkerEvtStop) { From d247eb43de7996cec90467ca05f6409276e82885 Mon Sep 17 00:00:00 2001 From: MX <10697207+xMasterX@users.noreply.github.com> Date: Sun, 12 Feb 2023 23:58:16 +0300 Subject: [PATCH 07/10] Fbt format --- applications/main/archive/helpers/archive_browser.c | 8 ++++++-- .../main/subghz/views/subghz_frequency_analyzer.c | 13 +++++++------ 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/applications/main/archive/helpers/archive_browser.c b/applications/main/archive/helpers/archive_browser.c index b37c550bdc..97a3496f64 100644 --- a/applications/main/archive/helpers/archive_browser.c +++ b/applications/main/archive/helpers/archive_browser.c @@ -57,8 +57,12 @@ static void archive_list_load_cb(void* context, uint32_t list_load_offset) { false); } -static void - archive_list_item_cb(void* context, FuriString* item_path, uint32_t idx, bool is_folder, bool is_last) { +static void archive_list_item_cb( + void* context, + FuriString* item_path, + uint32_t idx, + bool is_folder, + bool is_last) { furi_assert(context); UNUSED(idx); ArchiveBrowserView* browser = (ArchiveBrowserView*)context; diff --git a/applications/main/subghz/views/subghz_frequency_analyzer.c b/applications/main/subghz/views/subghz_frequency_analyzer.c index 24f24c39d6..ce2e34297a 100644 --- a/applications/main/subghz/views/subghz_frequency_analyzer.c +++ b/applications/main/subghz/views/subghz_frequency_analyzer.c @@ -21,12 +21,13 @@ #define MAX_HISTORY 4 static const uint32_t subghz_frequency_list[] = { - 300000000, 302757000, 303875000, 304250000, 307000000, 307500000, 307800000, 309000000, - 310000000, 312000000, 312100000, 313000000, 313850000, 314000000, 314350000, 314980000, - 315000000, 318000000, 330000000, 345000000, 348000000, 350000000, 387000000, 390000000, - 418000000, 433075000, 433220000, 433420000, 433657070, 433889000, 433920000, 434075000, - 434176948, 434390000, 434420000, 434775000, 438900000, 440175000, 464000000, 467750000, 779000000, - 868350000, 868400000, 868800000, 868950000, 906400000, 915000000, 925000000, 928000000}; + 300000000, 302757000, 303875000, 304250000, 307000000, 307500000, 307800000, + 309000000, 310000000, 312000000, 312100000, 313000000, 313850000, 314000000, + 314350000, 314980000, 315000000, 318000000, 330000000, 345000000, 348000000, + 350000000, 387000000, 390000000, 418000000, 433075000, 433220000, 433420000, + 433657070, 433889000, 433920000, 434075000, 434176948, 434390000, 434420000, + 434775000, 438900000, 440175000, 464000000, 467750000, 779000000, 868350000, + 868400000, 868800000, 868950000, 906400000, 915000000, 925000000, 928000000}; typedef enum { SubGhzFrequencyAnalyzerStatusIDLE, From 6c4334e7cb6a5185c6c991e72693f6dfe3ab5ada Mon Sep 17 00:00:00 2001 From: MX <10697207+xMasterX@users.noreply.github.com> Date: Mon, 13 Feb 2023 00:41:50 +0300 Subject: [PATCH 08/10] Rename functions and cleanup a bit --- .../gui/modules/file_browser_worker.c | 36 +++---------------- 1 file changed, 4 insertions(+), 32 deletions(-) diff --git a/applications/services/gui/modules/file_browser_worker.c b/applications/services/gui/modules/file_browser_worker.c index faf307d558..8e56ab2734 100644 --- a/applications/services/gui/modules/file_browser_worker.c +++ b/applications/services/gui/modules/file_browser_worker.c @@ -189,6 +189,7 @@ static bool browser_folder_init( return state; } +// Load files list by chunks, like it was originally, not compatible with sorting, sorting needs to be disabled to use this static bool browser_folder_load_chunked( BrowserWorker* browser, FuriString* path, @@ -270,8 +271,8 @@ static bool browser_folder_load_chunked( return (items_cnt == count); } -static bool - browser_folder_load(BrowserWorker* browser, FuriString* path, uint32_t offset, uint32_t count) { +// Load all files at once, may cause memory overflow so need to limit that to about 400 files +static bool browser_folder_load_full(BrowserWorker* browser, FuriString* path) { FileInfo file_info; Storage* storage = furi_record_open(RECORD_STORAGE); @@ -288,35 +289,6 @@ static bool if(!storage_dir_open(directory, furi_string_get_cstr(path))) { break; } - - // items_cnt = 0; - // while(items_cnt < offset) { - // if(!storage_dir_read(directory, &file_info, name_temp, FILE_NAME_LEN_MAX)) { - // break; - // } - // if(storage_file_get_error(directory) == FSE_OK) { - // furi_string_set(name_str, name_temp); - // if(browser_filter_by_name(browser, name_str, (file_info.flags & FSF_DIRECTORY))) { - // items_cnt++; - // } - // } else { - // break; - // } - // } - // if(items_cnt != offset) { - // break; - // } - - // ROGUE MASTER MOMENT - // this used to load the file list in chunks, which makes sense - // but then RM made it sort the files, still in chunks... - // so while scrolling, it loads more files and sorts them... - // chances are, the new files are higher in the sorted list... - // so the files keep shifting around while scrolling... - // now this does something intelligent: loads and sorts all in one go. - // might take a few milliseconds longer, but atleast it works - UNUSED(offset); - UNUSED(count); if(browser->list_load_cb) { browser->list_load_cb(browser->cb_ctx, 0); } @@ -450,7 +422,7 @@ static int32_t browser_worker(void* context) { browser_folder_load_chunked( browser, path, browser->load_offset, browser->load_count); } else { - browser_folder_load(browser, path, browser->load_offset, browser->load_count); + browser_folder_load_full(browser, path); } } From 3747f95d5a4d83d7cf5b67caf17bb68f897daf84 Mon Sep 17 00:00:00 2001 From: MX <10697207+xMasterX@users.noreply.github.com> Date: Mon, 13 Feb 2023 00:43:58 +0300 Subject: [PATCH 09/10] Fix external cc1101 module issues SubGHz HAL fixes, by @Quen0n --- .../targets/f7/furi_hal/furi_hal_subghz.c | 39 +++++++++++-------- 1 file changed, 22 insertions(+), 17 deletions(-) diff --git a/firmware/targets/f7/furi_hal/furi_hal_subghz.c b/firmware/targets/f7/furi_hal/furi_hal_subghz.c index 688ec4ba41..20b8d0839b 100644 --- a/firmware/targets/f7/furi_hal/furi_hal_subghz.c +++ b/firmware/targets/f7/furi_hal/furi_hal_subghz.c @@ -800,6 +800,7 @@ bool furi_hal_subghz_start_async_tx(FuriHalSubGhzAsyncTxCallback callback, void* GpioSpeedLow, GpioAltFn1TIM2); } else { + //Signal generation with mem-to-mem DMA furi_hal_gpio_write(furi_hal_subghz.cc1101_g0_pin, true); furi_hal_gpio_init( furi_hal_subghz.cc1101_g0_pin, GpioModeOutputPushPull, GpioPullNo, GpioSpeedVeryHigh); @@ -863,24 +864,28 @@ bool furi_hal_subghz_start_async_tx(FuriHalSubGhzAsyncTxCallback callback, void* LL_TIM_SetCounter(TIM2, 0); LL_TIM_EnableCounter(TIM2); - //Signal generation for external module - - // Start debug (and speaker) - furi_hal_subghz_start_debug(); - - const GpioPin* gpio = furi_hal_subghz.cc1101_g0_pin; + // Start debug + if(furi_hal_subghz_start_debug() || furi_hal_subghz.radio_type == SubGhzRadioExternal) { + const GpioPin* gpio = furi_hal_subghz.cc1101_g0_pin; + //Preparing bit mask + //Debug pin is may be only PORTB! (PB0, PB1, .., PB15) + furi_hal_subghz_debug_gpio_buff[0] = 0; + furi_hal_subghz_debug_gpio_buff[1] = 0; + + //Mirror pin (for example, speaker) + if(furi_hal_subghz.async_mirror_pin != NULL) { + furi_hal_subghz_debug_gpio_buff[0] |= (uint32_t)furi_hal_subghz.async_mirror_pin->pin + << GPIO_NUMBER; + furi_hal_subghz_debug_gpio_buff[1] |= furi_hal_subghz.async_mirror_pin->pin; + gpio = furi_hal_subghz.async_mirror_pin; + } - if((furi_hal_subghz.async_mirror_pin != NULL) && - (furi_hal_subghz.radio_type == SubGhzRadioInternal)) { - gpio = furi_hal_subghz.async_mirror_pin; - } - if(((furi_hal_subghz.async_mirror_pin != NULL) && - (furi_hal_subghz.radio_type == SubGhzRadioInternal)) || - (furi_hal_subghz.radio_type == SubGhzRadioExternal)) { - furi_hal_subghz_debug_gpio_buff[0] = - ((uint32_t)gpio->pin << GPIO_NUMBER) | - ((uint32_t)furi_hal_subghz.async_mirror_pin->pin << GPIO_NUMBER); - furi_hal_subghz_debug_gpio_buff[1] = gpio->pin | furi_hal_subghz.async_mirror_pin->pin; + //G0 singnal generation for external radio + if(furi_hal_subghz.radio_type == SubGhzRadioExternal) { + furi_hal_subghz_debug_gpio_buff[0] |= (uint32_t)furi_hal_subghz.cc1101_g0_pin->pin + << GPIO_NUMBER; + furi_hal_subghz_debug_gpio_buff[1] |= furi_hal_subghz.cc1101_g0_pin->pin; + } dma_config.MemoryOrM2MDstAddress = (uint32_t)furi_hal_subghz_debug_gpio_buff; dma_config.PeriphOrM2MSrcAddress = (uint32_t) & (gpio->port->BSRR); From 8608ba01aa5b5578332582d7e8903228ddb77493 Mon Sep 17 00:00:00 2001 From: MX <10697207+xMasterX@users.noreply.github.com> Date: Mon, 13 Feb 2023 00:53:40 +0300 Subject: [PATCH 10/10] Update changelog --- CHANGELOG.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b8e4070bda..f502da8202 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,8 @@ ### New changes -* iButton: **Temp Fix of non working emulation on Metakom and Cyfral protocols** -* Archive and FileBrowser: **Sort files and folders alphabetically.** Added a "Internal" tab to the Browser (only in DEBUG mode), other misc changes (by @ClaraCrazy and @Willy-JL | PR #327) -* SubGHz: Custom modulation for lrs pagers and added frequency 467.75 to default list (by @jbohack | PR #328) -* SubGHz: **Small fixes in SubGHz HAL** +* Archive and FileBrowser: Fixed #332 (large folders parse issue) +* Archive and FileBrowser: Fixed navigation issues and improved performance (by @Willy-JL | PR #333) +* SubGHz -> HAL: **Fixed external CC1101 module issues** (transmission now works correctly) (fixed issue #331) +* SubGHz: Use 17 (1W) pin for subghz debug mode #### [🎲 Download latest extra apps pack](https://download-directory.github.io/?url=https://github.com/xMasterX/unleashed-extra-pack/tree/main/apps)