[FL-2849] SubGhz: read RAW auto generation of names (#1772)

* 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: あく <alleteam@gmail.com>
This commit is contained in:
Skorpionm 2022-10-06 18:43:17 +04:00 committed by GitHub
parent 61189c3c82
commit 061f53cd3c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -13,6 +13,20 @@ void subghz_scene_save_name_text_input_callback(void* context) {
view_dispatcher_send_custom_event(subghz->view_dispatcher, SubGhzCustomEventSceneSaveName); 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) { void subghz_scene_save_name_on_enter(void* context) {
SubGhz* subghz = 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) == if(scene_manager_get_scene_state(subghz->scene_manager, SubGhzSceneReadRAW) ==
SubGhzCustomEventManagerSetRAW) { SubGhzCustomEventManagerSetRAW) {
dev_name_empty = true; 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); furi_string_set(subghz->file_path, dir_name);
} }