|
@@ -10,26 +10,26 @@ typedef enum {
|
|
|
|
|
|
|
|
void nfc_playlist_settings_menu_callback(void* context, uint32_t index) {
|
|
void nfc_playlist_settings_menu_callback(void* context, uint32_t index) {
|
|
|
NfcPlaylist* nfc_playlist = context;
|
|
NfcPlaylist* nfc_playlist = context;
|
|
|
|
|
+ FuriString* temp_str = furi_string_alloc();
|
|
|
if (index == NfcPlaylistSettings_Reset) {
|
|
if (index == NfcPlaylistSettings_Reset) {
|
|
|
nfc_playlist->settings.emulate_timeout = default_emulate_timeout;
|
|
nfc_playlist->settings.emulate_timeout = default_emulate_timeout;
|
|
|
VariableItem* emulation_timeout_settings = variable_item_list_get(nfc_playlist->variable_item_list, NfcPlaylistSettings_Timeout);
|
|
VariableItem* emulation_timeout_settings = variable_item_list_get(nfc_playlist->variable_item_list, NfcPlaylistSettings_Timeout);
|
|
|
variable_item_set_current_value_index(emulation_timeout_settings, nfc_playlist->settings.emulate_timeout);
|
|
variable_item_set_current_value_index(emulation_timeout_settings, nfc_playlist->settings.emulate_timeout);
|
|
|
- char emulation_timeout_settings_text[3];
|
|
|
|
|
- snprintf(emulation_timeout_settings_text, 3, "%ds", options_emulate_timeout[nfc_playlist->settings.emulate_timeout]);
|
|
|
|
|
- variable_item_set_current_value_text(emulation_timeout_settings, (char*)emulation_timeout_settings_text);
|
|
|
|
|
|
|
+ furi_string_printf(temp_str, "%ds", options_emulate_timeout[nfc_playlist->settings.emulate_timeout]);
|
|
|
|
|
+ variable_item_set_current_value_text(emulation_timeout_settings, furi_string_get_cstr(temp_str));
|
|
|
|
|
|
|
|
nfc_playlist->settings.emulate_delay = default_emulate_delay;
|
|
nfc_playlist->settings.emulate_delay = default_emulate_delay;
|
|
|
VariableItem* emulation_delay_settings = variable_item_list_get(nfc_playlist->variable_item_list, NfcPlaylistSettings_Delay);
|
|
VariableItem* emulation_delay_settings = variable_item_list_get(nfc_playlist->variable_item_list, NfcPlaylistSettings_Delay);
|
|
|
variable_item_set_current_value_index(emulation_delay_settings, nfc_playlist->settings.emulate_delay);
|
|
variable_item_set_current_value_index(emulation_delay_settings, nfc_playlist->settings.emulate_delay);
|
|
|
- char emulation_delay_settings_text[3];
|
|
|
|
|
- snprintf(emulation_delay_settings_text, 3, "%ds", options_emulate_delay[nfc_playlist->settings.emulate_delay]);
|
|
|
|
|
- variable_item_set_current_value_text(emulation_delay_settings, (char*)emulation_delay_settings_text);
|
|
|
|
|
|
|
+ furi_string_printf(temp_str, "%ds", options_emulate_delay[nfc_playlist->settings.emulate_delay]);
|
|
|
|
|
+ variable_item_set_current_value_text(emulation_delay_settings, furi_string_get_cstr(temp_str));
|
|
|
|
|
|
|
|
nfc_playlist->settings.emulate_led_indicator = default_emulate_led_indicator;
|
|
nfc_playlist->settings.emulate_led_indicator = default_emulate_led_indicator;
|
|
|
VariableItem* emulation_led_indicator_settings = variable_item_list_get(nfc_playlist->variable_item_list, NfcPlaylistSettings_LedIndicator);
|
|
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_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");
|
|
variable_item_set_current_value_text(emulation_led_indicator_settings, nfc_playlist->settings.emulate_led_indicator ? "ON" : "OFF");
|
|
|
}
|
|
}
|
|
|
|
|
+ furi_string_free(temp_str);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
void nfc_playlist_settings_options_change_callback(VariableItem* item) {
|
|
void nfc_playlist_settings_options_change_callback(VariableItem* item) {
|
|
@@ -37,20 +37,18 @@ void nfc_playlist_settings_options_change_callback(VariableItem* item) {
|
|
|
|
|
|
|
|
uint8_t current_option = variable_item_list_get_selected_item_index(nfc_playlist->variable_item_list);
|
|
uint8_t current_option = variable_item_list_get_selected_item_index(nfc_playlist->variable_item_list);
|
|
|
uint8_t option_value_index = variable_item_get_current_value_index(item);
|
|
uint8_t option_value_index = variable_item_get_current_value_index(item);
|
|
|
-
|
|
|
|
|
|
|
+ FuriString* temp_str = furi_string_alloc();
|
|
|
switch(current_option) {
|
|
switch(current_option) {
|
|
|
case NfcPlaylistSettings_Timeout: {
|
|
case NfcPlaylistSettings_Timeout: {
|
|
|
nfc_playlist->settings.emulate_timeout = option_value_index;
|
|
nfc_playlist->settings.emulate_timeout = option_value_index;
|
|
|
- char emulate_timeout_text[3];
|
|
|
|
|
- snprintf(emulate_timeout_text, 3, "%ds", options_emulate_timeout[option_value_index]);
|
|
|
|
|
- variable_item_set_current_value_text(item, (char*)emulate_timeout_text);
|
|
|
|
|
|
|
+ furi_string_printf(temp_str, "%ds", options_emulate_timeout[nfc_playlist->settings.emulate_timeout]);
|
|
|
|
|
+ variable_item_set_current_value_text(item, furi_string_get_cstr(temp_str));
|
|
|
break;
|
|
break;
|
|
|
}
|
|
}
|
|
|
case NfcPlaylistSettings_Delay: {
|
|
case NfcPlaylistSettings_Delay: {
|
|
|
nfc_playlist->settings.emulate_delay = option_value_index;
|
|
nfc_playlist->settings.emulate_delay = option_value_index;
|
|
|
- char emulate_delay_text[3];
|
|
|
|
|
- snprintf(emulate_delay_text, 3, "%ds", options_emulate_delay[option_value_index]);
|
|
|
|
|
- variable_item_set_current_value_text(item, (char*)emulate_delay_text);
|
|
|
|
|
|
|
+ furi_string_printf(temp_str, "%ds", options_emulate_delay[nfc_playlist->settings.emulate_delay]);
|
|
|
|
|
+ variable_item_set_current_value_text(item, furi_string_get_cstr(temp_str));
|
|
|
break;
|
|
break;
|
|
|
}
|
|
}
|
|
|
case NfcPlaylistSettings_LedIndicator:
|
|
case NfcPlaylistSettings_LedIndicator:
|
|
@@ -60,10 +58,12 @@ void nfc_playlist_settings_options_change_callback(VariableItem* item) {
|
|
|
default:
|
|
default:
|
|
|
break;
|
|
break;
|
|
|
}
|
|
}
|
|
|
|
|
+ furi_string_free(temp_str);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
void nfc_playlist_settings_scene_on_enter(void* context) {
|
|
void nfc_playlist_settings_scene_on_enter(void* context) {
|
|
|
NfcPlaylist* nfc_playlist = context;
|
|
NfcPlaylist* nfc_playlist = context;
|
|
|
|
|
+ FuriString* temp_str = furi_string_alloc();
|
|
|
|
|
|
|
|
variable_item_list_set_header(nfc_playlist->variable_item_list, "Settings");
|
|
variable_item_list_set_header(nfc_playlist->variable_item_list, "Settings");
|
|
|
|
|
|
|
@@ -74,9 +74,8 @@ void nfc_playlist_settings_scene_on_enter(void* context) {
|
|
|
nfc_playlist_settings_options_change_callback,
|
|
nfc_playlist_settings_options_change_callback,
|
|
|
nfc_playlist);
|
|
nfc_playlist);
|
|
|
variable_item_set_current_value_index(emulation_timeout_settings, nfc_playlist->settings.emulate_timeout);
|
|
variable_item_set_current_value_index(emulation_timeout_settings, nfc_playlist->settings.emulate_timeout);
|
|
|
- char emulation_timeout_settings_text[3];
|
|
|
|
|
- snprintf(emulation_timeout_settings_text, 3, "%ds", options_emulate_timeout[nfc_playlist->settings.emulate_timeout]);
|
|
|
|
|
- variable_item_set_current_value_text(emulation_timeout_settings, (char*)emulation_timeout_settings_text);
|
|
|
|
|
|
|
+ furi_string_printf(temp_str, "%ds", options_emulate_timeout[nfc_playlist->settings.emulate_timeout]);
|
|
|
|
|
+ variable_item_set_current_value_text(emulation_timeout_settings, furi_string_get_cstr(temp_str));
|
|
|
|
|
|
|
|
VariableItem* emulation_delay_settings = variable_item_list_add(
|
|
VariableItem* emulation_delay_settings = variable_item_list_add(
|
|
|
nfc_playlist->variable_item_list,
|
|
nfc_playlist->variable_item_list,
|
|
@@ -85,9 +84,8 @@ void nfc_playlist_settings_scene_on_enter(void* context) {
|
|
|
nfc_playlist_settings_options_change_callback,
|
|
nfc_playlist_settings_options_change_callback,
|
|
|
nfc_playlist);
|
|
nfc_playlist);
|
|
|
variable_item_set_current_value_index(emulation_delay_settings, nfc_playlist->settings.emulate_delay);
|
|
variable_item_set_current_value_index(emulation_delay_settings, nfc_playlist->settings.emulate_delay);
|
|
|
- char emulation_delay_settings_text[3];
|
|
|
|
|
- snprintf(emulation_delay_settings_text, 3, "%ds", options_emulate_delay[nfc_playlist->settings.emulate_delay]);
|
|
|
|
|
- variable_item_set_current_value_text(emulation_delay_settings, (char*)emulation_delay_settings_text);
|
|
|
|
|
|
|
+ furi_string_printf(temp_str, "%ds", options_emulate_delay[nfc_playlist->settings.emulate_delay]);
|
|
|
|
|
+ variable_item_set_current_value_text(emulation_delay_settings, furi_string_get_cstr(temp_str));
|
|
|
|
|
|
|
|
VariableItem* emulation_led_indicator_settings = variable_item_list_add(
|
|
VariableItem* emulation_led_indicator_settings = variable_item_list_add(
|
|
|
nfc_playlist->variable_item_list,
|
|
nfc_playlist->variable_item_list,
|
|
@@ -101,6 +99,8 @@ void nfc_playlist_settings_scene_on_enter(void* context) {
|
|
|
variable_item_list_add(nfc_playlist->variable_item_list, "Reset settings", 0, NULL, NULL);
|
|
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);
|
|
variable_item_list_set_enter_callback(nfc_playlist->variable_item_list, nfc_playlist_settings_menu_callback, nfc_playlist);
|
|
|
|
|
+
|
|
|
|
|
+ furi_string_free(temp_str);
|
|
|
|
|
|
|
|
view_dispatcher_switch_to_view(nfc_playlist->view_dispatcher, NfcPlaylistView_Settings);
|
|
view_dispatcher_switch_to_view(nfc_playlist->view_dispatcher, NfcPlaylistView_Settings);
|
|
|
}
|
|
}
|