Skip to content

Commit

Permalink
Moved stored variable
Browse files Browse the repository at this point in the history
  • Loading branch information
acegoal07 committed Apr 14, 2024
1 parent 9bdc60a commit 67d8655
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
1 change: 1 addition & 0 deletions nfc_playlist.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ static const bool default_emulate_led_indicator = true;

#define PLAYLIST_LOCATION "/ext/apps_data/nfc_playlist/"
#define PLAYLIST_DIR "/ext/apps_data/nfc_playlist"
#define PLAYLIST_VIEW_MAX_SIZE 1000

typedef enum NfcPlaylistLedState {
NfcPlaylistLedState_Normal,
Expand Down
6 changes: 2 additions & 4 deletions scenes/nfc_playlist_scene_nfc_select.c
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
#include "../nfc_playlist.h"

#define MAX_PLAYLIST_SIZE 1000

void nfc_playlist_nfc_select_menu_callback(void* context) {
NfcPlaylist* nfc_playlist = context;

Storage* storage = furi_record_open(RECORD_STORAGE);
File* file = storage_file_alloc(storage);

if (storage_file_open(file, furi_string_get_cstr(nfc_playlist->settings.file_path), FSAM_READ_WRITE, FSOM_OPEN_EXISTING)) {
uint8_t buffer[MAX_PLAYLIST_SIZE];
uint16_t read_count = storage_file_read(file, buffer, MAX_PLAYLIST_SIZE);
uint8_t buffer[PLAYLIST_VIEW_MAX_SIZE];
uint16_t read_count = storage_file_read(file, buffer, PLAYLIST_VIEW_MAX_SIZE);
FuriString* playlist_content = furi_string_alloc();

for(uint16_t i = 0; i < read_count; i++) {
Expand Down
6 changes: 2 additions & 4 deletions scenes/nfc_playlist_scene_view_playlist_content.c
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
#include "../nfc_playlist.h"

#define MAX_PLAYLIST_SIZE 1000

void nfc_playlist_view_playlist_content_scene_on_enter(void* context) {
NfcPlaylist* nfc_playlist = context;

Storage* storage = furi_record_open(RECORD_STORAGE);
File* file = storage_file_alloc(storage);

if (storage_file_open(file, furi_string_get_cstr(nfc_playlist->settings.file_path), FSAM_READ, FSOM_OPEN_EXISTING)) {
uint8_t buffer[MAX_PLAYLIST_SIZE];
uint16_t read_count = storage_file_read(file, buffer, MAX_PLAYLIST_SIZE);
uint8_t buffer[PLAYLIST_VIEW_MAX_SIZE];
uint16_t read_count = storage_file_read(file, buffer, PLAYLIST_VIEW_MAX_SIZE);
FuriString* playlist_content = furi_string_alloc();

for(uint16_t i = 0; i < read_count; i++) {
Expand Down

0 comments on commit 67d8655

Please sign in to comment.