From 061f53cd3c9493bfff34a370d087281fe495ca22 Mon Sep 17 00:00:00 2001 From: Skorpionm <85568270+Skorpionm@users.noreply.github.com> Date: Thu, 6 Oct 2022 18:43:17 +0400 Subject: [PATCH] [FL-2849] SubGhz: read RAW auto generation of names (#1772) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * SubGhz: read RAW auto auto generation of names depending on the date of the entry * SubGhz: name generation modification RAW-YYYYMMDD-HHMMSS * SubGhz: replace m-string with FuriString Co-authored-by: あく --- .../main/subghz/scenes/subghz_scene_save_name.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/applications/main/subghz/scenes/subghz_scene_save_name.c b/applications/main/subghz/scenes/subghz_scene_save_name.c index b9bb3636..dfcb6586 100644 --- a/applications/main/subghz/scenes/subghz_scene_save_name.c +++ b/applications/main/subghz/scenes/subghz_scene_save_name.c @@ -13,6 +13,20 @@ void subghz_scene_save_name_text_input_callback(void* context) { view_dispatcher_send_custom_event(subghz->view_dispatcher, SubGhzCustomEventSceneSaveName); } +void subghz_scene_save_name_get_timefilename(FuriString* name) { + FuriHalRtcDateTime datetime = {0}; + furi_hal_rtc_get_datetime(&datetime); + furi_string_printf( + name, + "RAW-%.4d%.2d%.2d-%.2d%.2d%.2d", + datetime.year, + datetime.month, + datetime.day, + datetime.hour, + datetime.minute, + datetime.second); +} + void subghz_scene_save_name_on_enter(void* context) { SubGhz* subghz = context; @@ -41,9 +55,8 @@ void subghz_scene_save_name_on_enter(void* context) { if(scene_manager_get_scene_state(subghz->scene_manager, SubGhzSceneReadRAW) == SubGhzCustomEventManagerSetRAW) { dev_name_empty = true; - subghz_get_next_name_file(subghz, SUBGHZ_MAX_LEN_NAME); + subghz_scene_save_name_get_timefilename(file_name); } - path_extract_filename(subghz->file_path, file_name, true); } furi_string_set(subghz->file_path, dir_name); }