Просмотр исходного кода

Merge nfc_playlist from https://github.com/acegoal07/FlipperZero_NFC_Playlist

# Conflicts:
#	nfc_playlist/scenes/nfc_playlist_scene_emulation.c
Willy-JL 1 год назад
Родитель
Сommit
72e61b1dff
1 измененных файлов с 7 добавлено и 9 удалено
  1. 7 9
      nfc_playlist/scenes/nfc_playlist_scene_emulation.c

+ 7 - 9
nfc_playlist/scenes/nfc_playlist_scene_emulation.c

@@ -13,11 +13,8 @@ int32_t nfc_playlist_emulation_task(void* context) {
 
     Storage* storage = furi_record_open(RECORD_STORAGE);
     Stream* stream = file_stream_alloc(storage);
-    bool skip_delay = false;
 
-    popup_reset(nfc_playlist->popup);
     popup_set_context(nfc_playlist->popup, nfc_playlist);
-
     view_dispatcher_switch_to_view(nfc_playlist->view_dispatcher, NfcPlaylistView_Popup);
 
     if(nfc_playlist->settings.playlist_length == 0) {
@@ -43,12 +40,13 @@ int32_t nfc_playlist_emulation_task(void* context) {
 
         bool delay_setting_on = nfc_playlist->settings.emulate_delay > 0;
         bool delay_active = false;
+        bool skip_delay = false;
 
         while(stream_read_line(stream, line) &&
               EmulationState == NfcPlaylistEmulationState_Emulating) {
-            char* file_path = (char*)furi_string_get_cstr(line);
+            furi_string_trim(line);
 
-            if(strspn(file_path, " \t\n\r") == strlen(file_path)) {
+            if(furi_string_empty(line)) {
                 continue;
             }
 
@@ -89,8 +87,7 @@ int32_t nfc_playlist_emulation_task(void* context) {
             int time_counter_ms =
                 (options_emulate_timeout[nfc_playlist->settings.emulate_timeout] * 1000);
 
-            int ext_check = furi_string_cmpi_str(tmp_file_ext, ".nfc");
-            if(ext_check != 0 && ext_check != 10) {
+            if(furi_string_cmpi_str(tmp_file_ext, ".nfc") != 0) {
                 if(nfc_playlist->settings.skip_error) {
                     skip_delay = true;
                     continue;
@@ -120,7 +117,7 @@ int32_t nfc_playlist_emulation_task(void* context) {
                     furi_delay_ms(50);
                     time_counter_ms -= 50;
                 };
-            } else if(!storage_file_exists(storage, file_path)) {
+            } else if(!storage_file_exists(storage, furi_string_get_cstr(line))) {
                 if(nfc_playlist->settings.skip_error) {
                     skip_delay = true;
                     continue;
@@ -161,7 +158,8 @@ int32_t nfc_playlist_emulation_task(void* context) {
                     AlignCenter,
                     AlignTop);
                 nfc_playlist_emulation_worker_set_nfc_data(
-                    nfc_playlist->nfc_playlist_emulation_worker, file_path);
+                    nfc_playlist->nfc_playlist_emulation_worker,
+                    (char*)furi_string_get_cstr(line));
                 nfc_playlist_emulation_worker_start(nfc_playlist->nfc_playlist_emulation_worker);
                 start_blink(nfc_playlist, NfcPlaylistLedState_Normal);
                 while(nfc_playlist_emulation_worker_is_emulating(