Skip to content

Commit

Permalink
Revert "Hide error setting"
Browse files Browse the repository at this point in the history
This reverts commit 5999573.
  • Loading branch information
acegoal07 committed Feb 20, 2024
1 parent de776b3 commit f036552
Show file tree
Hide file tree
Showing 6 changed files with 3 additions and 36 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ This app was design, built and tested using the <a href="https://github.com/Flip
- Emulate time (How long the NFC card will be emulated for)
- Delay time (How long the gap between the cards will be)
- LED indicator (Whether or not the LED's will be on)
- Hide error messages (Hides any errors about NFC files and just skips to the next one)
- Reset settings (Puts all the settings back to the defaults)

## Playlist editor
Expand Down
2 changes: 1 addition & 1 deletion application.fam
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ App(
fap_category="NFC",
fap_author="@acegoal07",
fap_weburl="https://github.com/acegoal07/FlipperZero_NFC_Playlist/tree/main",
fap_version="1.4",
fap_version="1.3",
fap_icon="assets/icon.png",
fap_private_libs=[
Lib(
Expand Down
1 change: 0 additions & 1 deletion nfc_playlist.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ static NfcPlaylist* nfc_playlist_alloc() {
nfc_playlist->settings.emulate_timeout = default_emulate_timeout;
nfc_playlist->settings.emulate_delay = default_emulate_delay;
nfc_playlist->settings.emulate_led_indicator = default_emulate_led_indicator;
nfc_playlist->settings.hide_error = default_hide_error;

nfc_playlist->notification = furi_record_open(RECORD_NOTIFICATION);
nfc_playlist->file_browser = file_browser_alloc(nfc_playlist->settings.file_path);
Expand Down
4 changes: 1 addition & 3 deletions nfc_playlist.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ typedef struct {
uint8_t emulate_timeout;
uint8_t emulate_delay;
bool emulate_led_indicator;
bool hide_error;
} NfcPlaylistSettings;

typedef struct {
Expand All @@ -63,5 +62,4 @@ static const int options_emulate_timeout[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11
static const int default_emulate_timeout = 4;
static const int options_emulate_delay[] = { 0, 1, 2, 3, 4, 5, 6 };
static const int default_emulate_delay = 0;
static const bool default_emulate_led_indicator = true;
static const bool default_hide_error = false;
static const bool default_emulate_led_indicator = true;
12 changes: 1 addition & 11 deletions scences/emulation.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#include "nfc_playlist.h"
#include "scences/emulation.h"

bool hiding_error = false;
NfcPlaylistEmulationState EmulationState = NfcPlaylistEmulationState_Stopped;

void nfc_playlist_emulation_scene_on_enter(void* context) {
Expand Down Expand Up @@ -71,7 +70,7 @@ int32_t nfc_playlist_emulation_task(void* context) {

if (strlen(file_path) <= 1) {continue;}

if (nfc_playlist->settings.emulate_delay > 0 && file_position > 0 && !hiding_error) {
if (nfc_playlist->settings.emulate_delay > 0 && file_position > 0) {
popup_set_header(nfc_playlist->popup, "Delaying", 64, 10, AlignCenter, AlignTop);
start_blink(nfc_playlist, NfcPlaylistLedState_Error);
int time_counter_delay_ms = (options_emulate_delay[nfc_playlist->settings.emulate_delay]*1000);
Expand All @@ -86,7 +85,6 @@ int32_t nfc_playlist_emulation_task(void* context) {
file_position++;
}

if (hiding_error) {hiding_error = false;}
if (EmulationState != NfcPlaylistEmulationState_Emulating) {break;}

char const* full_file_name = strchr(file_path, '/') != NULL ? &strrchr(file_path, '/')[1] : file_path;
Expand All @@ -97,10 +95,6 @@ int32_t nfc_playlist_emulation_task(void* context) {
int time_counter_ms = (options_emulate_timeout[nfc_playlist->settings.emulate_timeout]*1000);

if (storage_file_exists(storage, file_path) == false) {
if (nfc_playlist->settings.hide_error) {
hiding_error = true;
continue;
}
int popup_header_text_size = strlen(file_name) + 18;
char popup_header_text[popup_header_text_size];
snprintf(popup_header_text, popup_header_text_size, "%s\n%s", "ERROR not found:", file_name);
Expand All @@ -114,10 +108,6 @@ int32_t nfc_playlist_emulation_task(void* context) {
time_counter_ms -= 50;
}
} else if (strcasestr(file_ext, "nfc") == NULL) {
if (nfc_playlist->settings.hide_error) {
hiding_error = true;
continue;
}
int popup_header_text_size = strlen(file_name) + 21;
char popup_header_text[popup_header_text_size];
snprintf(popup_header_text, popup_header_text_size, "%s\n%s", "ERROR invalid file:", file_name);
Expand Down
19 changes: 0 additions & 19 deletions scences/settings.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ typedef enum {
NfcPlaylistSettings_Timeout,
NfcPlaylistSettings_Delay,
NfcPlaylistSettings_LedIndicator,
NfcPlaylistSettings_HideError,
NfcPlaylistSettings_Reset
} NfcPlaylistMenuSelection;

Expand All @@ -30,11 +29,6 @@ void nfc_playlist_settings_menu_callback(void* context, uint32_t index) {
VariableItem* emulation_led_indicator_settings = variable_item_list_get(nfc_playlist->variable_item_list, NfcPlaylistSettings_LedIndicator);
variable_item_set_current_value_index(emulation_led_indicator_settings, nfc_playlist->settings.emulate_led_indicator);
variable_item_set_current_value_text(emulation_led_indicator_settings, nfc_playlist->settings.emulate_led_indicator ? "ON" : "OFF");

nfc_playlist->settings.hide_error = default_hide_error;
VariableItem* hide_error_indicator_settings = variable_item_list_get(nfc_playlist->variable_item_list, NfcPlaylistSettings_HideError);
variable_item_set_current_value_index(hide_error_indicator_settings, nfc_playlist->settings.hide_error);
variable_item_set_current_value_text(hide_error_indicator_settings, nfc_playlist->settings.hide_error ? "ON" : "OFF");
}
}

Expand Down Expand Up @@ -63,10 +57,6 @@ void nfc_playlist_settings_options_change_callback(VariableItem* item) {
nfc_playlist->settings.emulate_led_indicator = option_value_index;
variable_item_set_current_value_text(item, nfc_playlist->settings.emulate_led_indicator ? "ON" : "OFF");
break;
case NfcPlaylistSettings_HideError:
nfc_playlist->settings.hide_error = option_value_index;
variable_item_set_current_value_text(item, nfc_playlist->settings.hide_error ? "ON" : "OFF");
break;
default:
break;
}
Expand Down Expand Up @@ -108,15 +98,6 @@ void nfc_playlist_settings_scene_on_enter(void* context) {
variable_item_set_current_value_index(emulation_led_indicator_settings, nfc_playlist->settings.emulate_led_indicator);
variable_item_set_current_value_text(emulation_led_indicator_settings, nfc_playlist->settings.emulate_led_indicator ? "ON" : "OFF");

VariableItem* hide_error_indicator_settings = variable_item_list_add(
nfc_playlist->variable_item_list,
"Hide error messages",
2,
nfc_playlist_settings_options_change_callback,
nfc_playlist);
variable_item_set_current_value_index(hide_error_indicator_settings, nfc_playlist->settings.hide_error);
variable_item_set_current_value_text(hide_error_indicator_settings, nfc_playlist->settings.hide_error ? "ON" : "OFF");

variable_item_list_add(nfc_playlist->variable_item_list, "Reset settings", 0, NULL, NULL);

variable_item_list_set_enter_callback(nfc_playlist->variable_item_list, nfc_playlist_settings_menu_callback, nfc_playlist);
Expand Down

0 comments on commit f036552

Please sign in to comment.