Skip to content

Commit b2d282f

Browse files
committed
Update nfc_playlist_scene_emulation.c
- Makes it so the items file path is no longer stored and instead called when needed - Removes a reset function which is not required - Moves a setting declaration to within a if statement so that its only created when its needed - Removes some blank spaces
1 parent 8d64cd1 commit b2d282f

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

scenes/nfc_playlist_scene_emulation.c

+3-7
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,8 @@ int32_t nfc_playlist_emulation_task(void* context) {
1313

1414
Storage* storage = furi_record_open(RECORD_STORAGE);
1515
Stream* stream = file_stream_alloc(storage);
16-
bool skip_delay = false;
1716

18-
popup_reset(nfc_playlist->popup);
1917
popup_set_context(nfc_playlist->popup, nfc_playlist);
20-
2118
view_dispatcher_switch_to_view(nfc_playlist->view_dispatcher, NfcPlaylistView_Popup);
2219

2320
if(nfc_playlist->settings.playlist_length == 0) {
@@ -33,9 +30,9 @@ int32_t nfc_playlist_emulation_task(void* context) {
3330

3431
bool delay_setting_on = nfc_playlist->settings.emulate_delay > 0;
3532
bool delay_active = false;
33+
bool skip_delay = false;
3634

3735
while(stream_read_line(stream, line) && EmulationState == NfcPlaylistEmulationState_Emulating) {
38-
3936
furi_string_trim(line);
4037

4138
if(furi_string_empty(line)) {
@@ -62,7 +59,6 @@ int32_t nfc_playlist_emulation_task(void* context) {
6259

6360
if(EmulationState != NfcPlaylistEmulationState_Emulating) {break;}
6461

65-
char* file_path = (char*)furi_string_get_cstr(line);
6662
path_extract_filename(line, tmp_file_name, false);
6763
path_extract_ext_str(line, tmp_file_ext);
6864

@@ -82,7 +78,7 @@ int32_t nfc_playlist_emulation_task(void* context) {
8278
furi_delay_ms(50);
8379
time_counter_ms -= 50;
8480
};
85-
} else if(!storage_file_exists(storage, file_path)) {
81+
} else if(!storage_file_exists(storage, furi_string_get_cstr(line))) {
8682
if(nfc_playlist->settings.skip_error) {
8783
skip_delay = true;
8884
continue;
@@ -99,7 +95,7 @@ int32_t nfc_playlist_emulation_task(void* context) {
9995
} else {
10096
furi_string_printf(tmp_header_str, "Emulating:\n%s", furi_string_get_cstr(tmp_file_name));
10197
popup_set_header(nfc_playlist->popup, furi_string_get_cstr(tmp_header_str), 64, 10, AlignCenter, AlignTop);
102-
nfc_playlist_emulation_worker_set_nfc_data(nfc_playlist->nfc_playlist_emulation_worker, file_path);
98+
nfc_playlist_emulation_worker_set_nfc_data(nfc_playlist->nfc_playlist_emulation_worker, (char*)furi_string_get_cstr(line));
10399
nfc_playlist_emulation_worker_start(nfc_playlist->nfc_playlist_emulation_worker);
104100
start_blink(nfc_playlist, NfcPlaylistLedState_Normal);
105101
while(nfc_playlist_emulation_worker_is_emulating(nfc_playlist->nfc_playlist_emulation_worker) && time_counter_ms > 0 && EmulationState == NfcPlaylistEmulationState_Emulating) {

0 commit comments

Comments
 (0)