rdefeo 1 год назад
Родитель
Сommit
09230aab5f
17 измененных файлов с 116 добавлено и 150 удалено
  1. 1 1
      actions/action.c
  2. 4 4
      actions/action_i.h
  3. 1 1
      actions/action_ir.c
  4. 17 9
      actions/action_qpl.c
  5. 5 14
      actions/action_rfid.c
  6. 7 7
      actions/action_subghz.c
  7. 0 16
      flipper.h
  8. 29 26
      item.c
  9. 9 3
      item.h
  10. 11 10
      quac.c
  11. 4 5
      quac.h
  12. 4 3
      quac_settings.c
  13. 20 37
      scenes/scene_items.c
  14. 0 6
      scenes/scene_settings.c
  15. 1 4
      scenes/scenes.h
  16. 1 3
      views/action_menu.c
  17. 2 1
      views/action_menu.h

+ 1 - 1
actions/action.c

@@ -4,7 +4,7 @@
 #include "action_i.h"
 
 void action_tx(void* context, Item* item, FuriString* error) {
-    FURI_LOG_I(TAG, "action_run: %s : %s", furi_string_get_cstr(item->name), item->ext);
+    // FURI_LOG_I(TAG, "action_run: %s : %s", furi_string_get_cstr(item->name), item->ext);
 
     if(!strcmp(item->ext, ".sub")) {
         action_subghz_tx(context, item->path, error);

+ 4 - 4
actions/action_i.h

@@ -5,7 +5,7 @@
 
 #define ACTION_SET_ERROR(_msg_fmt, ...) furi_string_printf(error, _msg_fmt, ##__VA_ARGS__)
 
-void action_subghz_tx(void* context, FuriString* action_path, FuriString* error);
-void action_rfid_tx(void* context, FuriString* action_path, FuriString* error);
-void action_ir_tx(void* context, FuriString* action_path, FuriString* error);
-void action_qpl_tx(void* context, FuriString* action_path, FuriString* error);
+void action_subghz_tx(void* context, const FuriString* action_path, FuriString* error);
+void action_rfid_tx(void* context, const FuriString* action_path, FuriString* error);
+void action_ir_tx(void* context, const FuriString* action_path, FuriString* error);
+void action_qpl_tx(void* context, const FuriString* action_path, FuriString* error);

+ 1 - 1
actions/action_ir.c

@@ -29,7 +29,7 @@ InfraredSignal* infrared_signal_alloc() {
     return signal;
 }
 
-void action_ir_tx(void* context, FuriString* action_path, FuriString* error) {
+void action_ir_tx(void* context, const FuriString* action_path, FuriString* error) {
     UNUSED(action_path);
     UNUSED(error);
     UNUSED(context);

+ 17 - 9
actions/action_qpl.c

@@ -11,22 +11,28 @@
 #include "quac.h"
 
 /** Open the Playlist file and then transmit each action
+ * 
  * Each line of the playlist file is one of:
  *   <file_path>
  *      Full SD card path, or relative path to action to be transmitted. Must be
  *      one of the supported filetypes (.sub, .rfid, [.ir coming soon])
- *   pause <ms> - NOT IMPLEMENTED
+ * 
+ *      If an .rfid file has a space followed by a number, that will be the
+ *      duration for that RFID transmission. All other .rfid files will use
+ *      the value specified in the Settings
+ * 
+ *   pause <ms>
  *      Pauses the playback for 'ms' milliseconds.
  * 
  * Blank lines, and comments (start with '#') are ignored. Whitespace is trimmed.
  * 
- * Not yet Implemented:
- * - For RFID files, if they have a space followed by a number after their name,
- *   that number will be the duration of that RFID tx
 */
-void action_qpl_tx(void* context, FuriString* action_path, FuriString* error) {
+void action_qpl_tx(void* context, const FuriString* action_path, FuriString* error) {
     App* app = context;
 
+    // Save the current RFID Duration, in case it is changed during playback
+    uint32_t orig_rfid_duration = app->settings.rfid_duration;
+
     FuriString* buffer;
     buffer = furi_string_alloc();
 
@@ -34,7 +40,7 @@ void action_qpl_tx(void* context, FuriString* action_path, FuriString* error) {
     if(file_stream_open(file, furi_string_get_cstr(action_path), FSAM_READ, FSOM_OPEN_EXISTING)) {
         while(stream_read_line(file, buffer)) {
             furi_string_trim(buffer); // remove '\n\r' line endings, cleanup spaces
-            FURI_LOG_I(TAG, "line: %s", furi_string_get_cstr(buffer));
+            // FURI_LOG_I(TAG, "line: %s", furi_string_get_cstr(buffer));
 
             // Skip blank lines
             if(furi_string_size(buffer) == 0) {
@@ -100,7 +106,7 @@ void action_qpl_tx(void* context, FuriString* action_path, FuriString* error) {
                     // FURI_LOG_I(TAG, "RFID file with duration");
                     if(sscanf(furi_string_get_cstr(buffer), "%lu", &rfid_duration) == 1) {
                         FURI_LOG_I(TAG, "RFID duration = %lu", rfid_duration);
-                        // TODO: Need to get the duration to the action_rfid_tx command...
+                        app->settings.rfid_duration = rfid_duration;
                     }
                 }
 
@@ -128,10 +134,12 @@ void action_qpl_tx(void* context, FuriString* action_path, FuriString* error) {
             path_extract_extension(buffer, ext, MAX_EXT_LEN);
             if(!strcmp(ext, ".sub")) {
                 action_subghz_tx(context, buffer, error);
-            } else if(!strcmp(ext, ".ir")) {
-                action_ir_tx(context, buffer, error);
             } else if(!strcmp(ext, ".rfid")) {
                 action_rfid_tx(context, buffer, error);
+                // Reset our default duration back - in case it was changed during playback
+                app->settings.rfid_duration = orig_rfid_duration;
+            } else if(!strcmp(ext, ".ir")) {
+                action_ir_tx(context, buffer, error);
             } else if(!strcmp(ext, ".qpl")) {
                 ACTION_SET_ERROR("Playlist: Can't call playlist from playlist");
             } else {

+ 5 - 14
actions/action_rfid.c

@@ -13,22 +13,17 @@
 #include "quac.h"
 
 // lifted from flipperzero-firmware/applications/main/lfrfid/lfrfid_cli.c
-void action_rfid_tx(void* context, FuriString* action_path, FuriString* error) {
+void action_rfid_tx(void* context, const FuriString* action_path, FuriString* error) {
     UNUSED(error);
 
     App* app = context;
-    FuriString* file_name = action_path;
+    const FuriString* file_name = action_path;
 
     FlipperFormat* fff_data_file = flipper_format_file_alloc(app->storage);
     FuriString* temp_str;
     temp_str = furi_string_alloc();
     uint32_t temp_data32;
 
-    FuriString* protocol_name;
-    FuriString* data_text;
-    protocol_name = furi_string_alloc();
-    data_text = furi_string_alloc();
-
     ProtocolDict* dict = protocol_dict_alloc(lfrfid_protocols, LFRFIDProtocolMax);
     ProtocolId protocol;
     size_t data_size = protocol_dict_get_max_data_size(dict);
@@ -54,13 +49,13 @@ void action_rfid_tx(void* context, FuriString* action_path, FuriString* error) {
         }
 
         // read and check the protocol field
-        if(!flipper_format_read_string(fff_data_file, "Key type", protocol_name)) {
+        if(!flipper_format_read_string(fff_data_file, "Key type", temp_str)) {
             ACTION_SET_ERROR("RFID: Error reading protocol");
             break;
         }
-        protocol = protocol_dict_get_protocol_by_name(dict, furi_string_get_cstr(protocol_name));
+        protocol = protocol_dict_get_protocol_by_name(dict, furi_string_get_cstr(temp_str));
         if(protocol == PROTOCOL_NO) {
-            ACTION_SET_ERROR("RFID: Unknown protocol: %s", furi_string_get_cstr(protocol_name));
+            ACTION_SET_ERROR("RFID: Unknown protocol: %s", furi_string_get_cstr(temp_str));
             break;
         }
 
@@ -110,11 +105,7 @@ void action_rfid_tx(void* context, FuriString* action_path, FuriString* error) {
     }
 
     furi_string_free(temp_str);
-    furi_string_free(protocol_name);
-    furi_string_free(data_text);
     free(data);
-
     protocol_dict_free(dict);
-
     flipper_format_free(fff_data_file);
 }

+ 7 - 7
actions/action_subghz.c

@@ -31,9 +31,9 @@ static FuriHalSubGhzPreset action_subghz_get_preset_name(const char* preset_name
 }
 
 // Lifted from flipperzero-firmware/applications/main/subghz/subghz_cli.c
-void action_subghz_tx(void* context, FuriString* action_path, FuriString* error) {
+void action_subghz_tx(void* context, const FuriString* action_path, FuriString* error) {
     App* app = context;
-    FuriString* file_name = action_path;
+    const char* file_name = furi_string_get_cstr(action_path);
     uint32_t repeat = 1; //
     // uint32_t device_ind = 0; // 0 - CC1101_INT, 1 - CC1101_EXT
 
@@ -76,9 +76,9 @@ void action_subghz_tx(void* context, FuriString* action_path, FuriString* error)
             // device_ind = 0;
         }
 
-        if(!flipper_format_file_open_existing(fff_data_file, furi_string_get_cstr(file_name))) {
-            FURI_LOG_E(TAG, "Error opening %s", furi_string_get_cstr(file_name));
-            ACTION_SET_ERROR("SUBGHZ: Error opening %s", furi_string_get_cstr(file_name));
+        if(!flipper_format_file_open_existing(fff_data_file, file_name)) {
+            FURI_LOG_E(TAG, "Error opening %s", file_name);
+            ACTION_SET_ERROR("SUBGHZ: Error opening %s", file_name);
             break;
         }
 
@@ -169,7 +169,7 @@ void action_subghz_tx(void* context, FuriString* action_path, FuriString* error)
         if(!strcmp(furi_string_get_cstr(temp_str), "RAW")) {
             FURI_LOG_I(TAG, "Protocol = RAW");
             subghz_protocol_raw_gen_fff_data(
-                fff_data_raw, furi_string_get_cstr(file_name), subghz_devices_get_name(device));
+                fff_data_raw, file_name, subghz_devices_get_name(device));
             transmitter =
                 subghz_transmitter_alloc_init(environment, furi_string_get_cstr(temp_str));
             if(transmitter == NULL) {
@@ -219,7 +219,7 @@ void action_subghz_tx(void* context, FuriString* action_path, FuriString* error)
         FURI_LOG_I(
             TAG,
             "Listening at %s. Frequency=%lu, Protocol=%s",
-            furi_string_get_cstr(file_name),
+            file_name,
             frequency,
             furi_string_get_cstr(temp_str));
         do {

+ 0 - 16
flipper.h

@@ -1,16 +0,0 @@
-#pragma once
-
-#include <furi.h>
-
-#include <gui/gui.h>
-#include <gui/view_dispatcher.h>
-#include <gui/scene_manager.h>
-#include <gui/modules/menu.h>
-#include <gui/modules/submenu.h>
-#include <gui/modules/button_menu.h>
-#include <gui/modules/dialog_ex.h>
-
-#include <storage/storage.h>
-#include <notification/notification_messages.h>
-
-#define TAG "Quac" // log statement id

+ 29 - 26
item.c

@@ -10,25 +10,26 @@
 
 ARRAY_DEF(FileArray, FuriString*, FURI_STRING_OPLIST);
 
-ItemsView* item_get_items_view_from_path(void* context, FuriString* input_path) {
+ItemsView* item_get_items_view_from_path(void* context, const FuriString* input_path) {
     App* app = context;
 
     // Handle the app start condition
+    FuriString* in_path;
     if(input_path == NULL) {
-        input_path = furi_string_alloc_set_str(QUAC_DATA_PATH);
+        in_path = furi_string_alloc_set_str(QUAC_DATA_PATH);
+    } else {
+        in_path = furi_string_alloc_set(input_path);
     }
-    const char* cpath = furi_string_get_cstr(input_path);
+    const char* cpath = furi_string_get_cstr(in_path);
 
-    FURI_LOG_I(TAG, "Getting items from: %s", cpath);
+    FURI_LOG_I(TAG, "Reading items from path: %s", cpath);
     ItemsView* iview = malloc(sizeof(ItemsView));
-    iview->path = furi_string_alloc_set(input_path);
+    iview->path = furi_string_alloc_set(in_path);
 
     iview->name = furi_string_alloc();
     if(app->depth == 0) {
-        FURI_LOG_I(TAG, "Depth is ZERO!");
         furi_string_set_str(iview->name, QUAC_NAME);
     } else {
-        FURI_LOG_I(TAG, "Depth is %d", app->depth);
         path_extract_basename(cpath, iview->name);
         item_prettify_name(iview->name);
     }
@@ -43,17 +44,17 @@ ItemsView* item_get_items_view_from_path(void* context, FuriString* input_path)
     FuriString* filename_tmp;
     filename_tmp = furi_string_alloc();
 
-    // FURI_LOG_I(TAG, "About to walk the dir");
+    // Walk the directory and store all file names in sorted order
     if(dir_walk_open(dir_walk, cpath)) {
         while(dir_walk_read(dir_walk, path, NULL) == DirWalkOK) {
-            FURI_LOG_I(TAG, "> dir_walk: %s", furi_string_get_cstr(path));
+            // FURI_LOG_I(TAG, "> dir_walk: %s", furi_string_get_cstr(path));
             const char* cpath = furi_string_get_cstr(path);
 
             // Skip "hidden" files
             path_extract_filename(path, filename_tmp, false);
             char first_char = furi_string_get_char(filename_tmp, 0);
             if(first_char == '.') {
-                FURI_LOG_I(TAG, ">> skipping hidden file: %s", furi_string_get_cstr(filename_tmp));
+                // FURI_LOG_I(TAG, ">> skipping hidden file: %s", furi_string_get_cstr(filename_tmp));
                 continue;
             }
 
@@ -78,6 +79,7 @@ ItemsView* item_get_items_view_from_path(void* context, FuriString* input_path)
     furi_string_free(filename_tmp);
     furi_string_free(path);
 
+    // Generate our Item list
     FileArray_it_t iter;
     ItemArray_init(iview->items);
     for(FileArray_it(iter, flist); !FileArray_end_p(iter); FileArray_next(iter)) {
@@ -89,20 +91,7 @@ ItemsView* item_get_items_view_from_path(void* context, FuriString* input_path)
         // Action files have extensions, so item->ext starts with '.'
         item->ext[0] = 0;
         path_extract_extension(path, item->ext, MAX_EXT_LEN);
-        // FURI_LOG_I(TAG, ". EXT = %s", item->ext);
-        if(item->ext[0] == '.') {
-            // TODO: hack alert - make a helper fn here, or something
-            if(item->ext[1] == 's')
-                item->type = Item_SubGhz;
-            else if(item->ext[1] == 'r')
-                item->type = Item_RFID;
-            else if(item->ext[1] == 'q')
-                item->type = Item_Playlist;
-            else if(item->ext[1] == 'i')
-                item->type = Item_IR;
-        } else {
-            item->type = Item_Group;
-        }
+        item->type = item_get_item_type_from_extension(item->ext);
 
         item->name = furi_string_alloc();
         path_extract_filename_no_ext(found_path, item->name);
@@ -114,6 +103,7 @@ ItemsView* item_get_items_view_from_path(void* context, FuriString* input_path)
         // FURI_LOG_I(TAG, "Path: %s", furi_string_get_cstr(item->path));
     }
 
+    furi_string_free(in_path);
     FileArray_clear(flist);
     dir_walk_free(dir_walk);
 
@@ -121,7 +111,6 @@ ItemsView* item_get_items_view_from_path(void* context, FuriString* input_path)
 }
 
 void item_items_view_free(ItemsView* items_view) {
-    FURI_LOG_I(TAG, "item_items_view_free - begin");
     furi_string_free(items_view->name);
     furi_string_free(items_view->path);
     ItemArray_it_t iter;
@@ -131,7 +120,6 @@ void item_items_view_free(ItemsView* items_view) {
     }
     ItemArray_clear(items_view->items);
     free(items_view);
-    FURI_LOG_I(TAG, "item_items_view_free - end");
 }
 
 void item_prettify_name(FuriString* name) {
@@ -148,4 +136,19 @@ void item_prettify_name(FuriString* name) {
     }
     furi_string_replace_str(name, "_", " ", 0);
     // FURI_LOG_I(TAG, "... %s", furi_string_get_cstr(name));
+}
+
+ItemType item_get_item_type_from_extension(const char* ext) {
+    ItemType type = Item_Group;
+
+    if(!strcmp(ext, ".sub")) {
+        type = Item_SubGhz;
+    } else if(!strcmp(ext, ".rfid")) {
+        type = Item_RFID;
+    } else if(!strcmp(ext, ".ir")) {
+        type = Item_IR;
+    } else if(!strcmp(ext, ".qpl")) {
+        type = Item_Playlist;
+    }
+    return type;
 }

+ 9 - 3
item.h

@@ -15,7 +15,8 @@ typedef enum {
     Item_IR,
     Item_Playlist,
     Item_Group,
-    Item_Settings
+    Item_Settings,
+    Item_count
 } ItemType;
 
 typedef struct Item {
@@ -41,7 +42,7 @@ typedef struct ItemsView {
  * @param   path    FuriString*
  * @return  ItemsView*
 */
-ItemsView* item_get_items_view_from_path(void* context, FuriString* path);
+ItemsView* item_get_items_view_from_path(void* context, const FuriString* path);
 
 /** Free ItemsView
  * @param   items_view
@@ -52,4 +53,9 @@ void item_items_view_free(ItemsView* items_view);
  * as well as replace all '_' with ' '.
  * @param   name    FuriString*
 */
-void item_prettify_name(FuriString* name);
+void item_prettify_name(FuriString* name);
+
+/** Return the ItemType enum for the given extension
+ * @param   ext     File extension
+*/
+ItemType item_get_item_type_from_extension(const char* ext);

+ 11 - 10
quac.c

@@ -3,7 +3,6 @@
 #include <gui/gui.h>
 #include <gui/view_dispatcher.h>
 #include <gui/scene_manager.h>
-#include <gui/modules/button_menu.h>
 #include <gui/modules/dialog_ex.h>
 #include <gui/modules/variable_item_list.h>
 
@@ -30,14 +29,12 @@ App* app_alloc() {
     view_dispatcher_set_navigation_event_callback(app->view_dispatcher, app_back_event_callback);
 
     // Create our UI elements
-    app->btn_menu = button_menu_alloc();
-    view_dispatcher_add_view(
-        app->view_dispatcher, Q_ButtonMenu, button_menu_get_view(app->btn_menu));
-
+    // Main interface
     app->action_menu = action_menu_alloc();
     view_dispatcher_add_view(
         app->view_dispatcher, Q_ActionMenu, action_menu_get_view(app->action_menu));
 
+    // App settings
     app->vil_settings = variable_item_list_alloc();
     view_dispatcher_add_view(
         app->view_dispatcher, Q_Settings, variable_item_list_get_view(app->vil_settings));
@@ -51,12 +48,10 @@ App* app_alloc() {
     // Notifications - for LED light access
     app->notifications = furi_record_open(RECORD_NOTIFICATION);
 
-    // initialize device items list
+    // data member initialize
     app->depth = 0;
     app->selected_item = -1;
 
-    app->items_view = item_get_items_view_from_path(app, NULL);
-
     return app;
 }
 
@@ -65,10 +60,13 @@ void app_free(App* app) {
 
     item_items_view_free(app->items_view);
 
-    view_dispatcher_remove_view(app->view_dispatcher, Q_ButtonMenu);
+    view_dispatcher_remove_view(app->view_dispatcher, Q_ActionMenu);
+    view_dispatcher_remove_view(app->view_dispatcher, Q_Settings);
+    view_dispatcher_remove_view(app->view_dispatcher, Q_Dialog);
 
-    button_menu_free(app->btn_menu);
     action_menu_free(app->action_menu);
+    variable_item_list_free(app->vil_settings);
+    dialog_ex_free(app->dialog);
 
     scene_manager_free(app->scene_manager);
     view_dispatcher_free(app->view_dispatcher);
@@ -89,6 +87,9 @@ int32_t quac_app(void* p) {
     App* app = app_alloc();
     quac_load_settings(app);
 
+    // Read items at our root
+    app->items_view = item_get_items_view_from_path(app, NULL);
+
     Gui* gui = furi_record_open(RECORD_GUI);
     view_dispatcher_attach_to_gui(app->view_dispatcher, gui, ViewDispatcherTypeFullscreen);
     scene_manager_next_scene(app->scene_manager, Q_Scene_Items);

+ 4 - 5
quac.h

@@ -2,7 +2,6 @@
 
 #include <gui/scene_manager.h>
 #include <gui/view_dispatcher.h>
-#include <gui/modules/button_menu.h>
 #include <gui/modules/dialog_ex.h>
 #include <gui/modules/variable_item_list.h>
 
@@ -26,16 +25,16 @@ typedef enum { QUAC_APP_PORTRAIT, QUAC_APP_LANDSCAPE } QuacAppLayout;
 typedef struct App {
     SceneManager* scene_manager;
     ViewDispatcher* view_dispatcher;
-    ButtonMenu* btn_menu;
-    DialogEx* dialog;
-    VariableItemList* vil_settings;
+
     ActionMenu* action_menu;
+    VariableItemList* vil_settings;
+    DialogEx* dialog;
 
     Storage* storage;
     NotificationApp* notifications;
 
-    int depth;
     ItemsView* items_view;
+    int depth;
     int selected_item;
 
     struct {

+ 4 - 3
quac_settings.c

@@ -3,8 +3,8 @@
 #include <flipper_format/flipper_format.h>
 
 // Quac Settings File Info
-// TODO: Fix this path to use existing #defs for /ext, etc
-#define QUAC_SETTINGS_FILENAME "/ext/apps_data/quac/.quac.conf"
+// "/ext/apps_data/quac/.quac.conf"
+#define QUAC_SETTINGS_FILENAME QUAC_DATA_PATH "/.quac.conf"
 #define QUAC_SETTINGS_FILE_TYPE "Quac Settings File"
 #define QUAC_SETTINGS_FILE_VERSION 1
 
@@ -21,7 +21,7 @@ void quac_load_settings(App* app) {
     temp_str = furi_string_alloc();
     uint32_t temp_data32 = 0;
 
-    FURI_LOG_I(TAG, "SETTINGS: Reading settings file");
+    FURI_LOG_I(TAG, "SETTINGS: Reading: %s", QUAC_SETTINGS_FILENAME);
     bool successful = false;
     do {
         if(!flipper_format_file_open_existing(fff_settings, QUAC_SETTINGS_FILENAME)) {
@@ -88,6 +88,7 @@ void quac_save_settings(App* app) {
     FlipperFormat* fff_settings = flipper_format_file_alloc(app->storage);
     uint32_t temp_data32;
 
+    FURI_LOG_I(TAG, "SETTINGS: Saving");
     bool successful = false;
     do {
         if(!flipper_format_file_open_always(fff_settings, QUAC_SETTINGS_FILENAME)) {

+ 20 - 37
scenes/scene_items.c

@@ -2,7 +2,6 @@
 
 #include <gui/view_dispatcher.h>
 #include <gui/scene_manager.h>
-#include <gui/modules/button_menu.h>
 #include <gui/modules/dialog_ex.h>
 
 #include <notification/notification_messages.h>
@@ -15,6 +14,15 @@
 
 #include <lib/toolbox/path.h>
 
+static const ActionMenuItemType ItemToMenuItem[] = {
+    [Item_SubGhz] = ActionMenuItemTypeSubGHz,
+    [Item_RFID] = ActionMenuItemTypeRFID,
+    [Item_IR] = ActionMenuItemTypeIR,
+    [Item_Playlist] = ActionMenuItemTypePlaylist,
+    [Item_Group] = ActionMenuItemTypeGroup,
+    [Item_Settings] = ActionMenuItemTypeSettings,
+};
+
 void scene_items_item_callback(void* context, int32_t index, InputType type) {
     App* app = context;
 
@@ -40,11 +48,10 @@ void scene_items_on_enter(void* context) {
     action_menu_set_show_headers(menu, app->settings.show_headers);
 
     ItemsView* items_view = app->items_view;
-    FURI_LOG_I(TAG, "items on_enter: [%d] %s", app->depth, furi_string_get_cstr(items_view->path));
-    furi_delay_ms(500);
+    FURI_LOG_I(
+        TAG, "Generating scene: [depth=%d] %s", app->depth, furi_string_get_cstr(items_view->path));
 
-    const char* header = furi_string_get_cstr(items_view->name);
-    action_menu_set_header(menu, header);
+    action_menu_set_header(menu, furi_string_get_cstr(items_view->name));
 
     size_t item_view_size = ItemArray_size(items_view->items);
     if(item_view_size > 0) {
@@ -53,27 +60,7 @@ void scene_items_on_enter(void* context) {
         for(ItemArray_it(iter, items_view->items); !ItemArray_end_p(iter);
             ItemArray_next(iter), ++index) {
             const char* label = furi_string_get_cstr(ItemArray_cref(iter)->name);
-            ActionMenuItemType type;
-            // TODO: Fix this with an array/map
-            switch(ItemArray_cref(iter)->type) {
-            case Item_Group:
-                type = ActionMenuItemTypeGroup;
-                break;
-            case Item_Playlist:
-                type = ActionMenuItemTypePlaylist;
-                break;
-            case Item_SubGhz:
-                type = ActionMenuItemTypeSubGHz;
-                break;
-            case Item_RFID:
-                type = ActionMenuItemTypeRFID;
-                break;
-            case Item_IR:
-                type = ActionMenuItemTypeIR;
-                break;
-            default:
-                type = ActionMenuItemTypeGroup; // TODO: Does this ever get hit?
-            }
+            ActionMenuItemType type = ItemToMenuItem[ItemArray_cref(iter)->type];
             action_menu_add_item(menu, label, index, scene_items_item_callback, type, app);
         }
     } else {
@@ -98,13 +85,12 @@ bool scene_items_on_event(void* context, SceneManagerEvent event) {
     App* app = context;
     bool consumed = false;
 
-    FURI_LOG_I(TAG, "device on_event");
     switch(event.type) {
     case SceneManagerEventTypeCustom:
         if(event.event == Event_ButtonPressed) {
             consumed = true;
-            furi_delay_ms(100);
-            FURI_LOG_I(TAG, "button pressed is %d", app->selected_item);
+            // furi_delay_ms(100);
+            // FURI_LOG_I(TAG, "button pressed is %d", app->selected_item);
             if(app->selected_item < (int)ItemArray_size(app->items_view->items)) {
                 Item* item = ItemArray_get(app->items_view->items, app->selected_item);
                 if(item->type == Item_Group) {
@@ -141,16 +127,16 @@ bool scene_items_on_event(void* context, SceneManagerEvent event) {
                     notification_message(app->notifications, &sequence_blink_stop);
                 }
             } else {
-                FURI_LOG_I(TAG, "Selected Settings!");
+                // FURI_LOG_I(TAG, "Selected Settings!");
                 // TODO: Do we need to free this current items_view??
                 scene_manager_next_scene(app->scene_manager, Q_Scene_Settings);
             }
         }
         break;
     case SceneManagerEventTypeBack:
-        FURI_LOG_I(TAG, "Back button pressed!");
+        // FURI_LOG_I(TAG, "Back button pressed!");
         consumed = false; // Ensure Back event continues to propagate
-        if(app->depth >= 0) {
+        if(app->depth > 0) {
             // take our current ItemsView path, and go back up a level
             FuriString* parent_path;
             parent_path = furi_string_alloc();
@@ -163,22 +149,19 @@ bool scene_items_on_event(void* context, SceneManagerEvent event) {
 
             furi_string_free(parent_path);
         } else {
-            FURI_LOG_W(TAG, "At the root level!");
+            // FURI_LOG_I(TAG, "At the root level!");
         }
         break;
     default:
         FURI_LOG_I(TAG, "Custom event not handled");
         break;
     }
-    FURI_LOG_I(TAG, "Generic event not handled");
+    // FURI_LOG_I(TAG, "Generic event not handled");
     return consumed;
 }
 
 void scene_items_on_exit(void* context) {
     App* app = context;
-
     ActionMenu* menu = app->action_menu;
     action_menu_reset(menu);
-
-    FURI_LOG_I(TAG, "on_exit. depth = %d", app->depth);
 }

+ 0 - 6
scenes/scene_settings.c

@@ -48,7 +48,6 @@ static const uint32_t rfid_duration_value[V_RFID_DURATION_COUNT] = {
 static void scene_settings_layout_changed(VariableItem* item) {
     App* app = variable_item_get_context(item);
     uint8_t index = variable_item_get_current_value_index(item);
-
     variable_item_set_current_value_text(item, layout_text[index]);
     app->settings.layout = layout_value[index];
 }
@@ -78,33 +77,28 @@ static void scene_settings_rfid_duration_changed(VariableItem* item) {
 void scene_settings_on_enter(void* context) {
     App* app = context;
 
-    FURI_LOG_I(TAG, "Settings _on_enter");
     VariableItemList* vil = app->vil_settings;
     variable_item_list_reset(vil);
 
     VariableItem* item;
     uint8_t value_index;
 
-    FURI_LOG_I(TAG, "setting up Layout");
     item = variable_item_list_add(vil, "Layout", 2, scene_settings_layout_changed, app);
     value_index = value_index_uint32(app->settings.layout, layout_value, 2);
     variable_item_set_current_value_index(item, value_index);
     variable_item_set_current_value_text(item, layout_text[value_index]);
 
-    FURI_LOG_I(TAG, "setting up Show Icons");
     item = variable_item_list_add(vil, "Show Icons", 2, scene_settings_show_icons_changed, app);
     value_index = value_index_uint32(app->settings.show_icons, show_icons_value, 2);
     variable_item_set_current_value_index(item, value_index);
     variable_item_set_current_value_text(item, show_icons_text[value_index]);
 
-    FURI_LOG_I(TAG, "setting up Show Headers");
     item =
         variable_item_list_add(vil, "Show Headers", 2, scene_settings_show_headers_changed, app);
     value_index = value_index_uint32(app->settings.show_headers, show_headers_value, 2);
     variable_item_set_current_value_index(item, value_index);
     variable_item_set_current_value_text(item, show_headers_text[value_index]);
 
-    FURI_LOG_I(TAG, "setting up RFID Duration");
     item = variable_item_list_add(
         vil, "RFID Duration", V_RFID_DURATION_COUNT, scene_settings_rfid_duration_changed, app);
     value_index = value_index_uint32(

+ 1 - 4
scenes/scenes.h

@@ -3,12 +3,9 @@
 typedef enum { Q_Scene_Items, Q_Scene_Settings, Q_Scene_count } appScenes;
 
 typedef enum {
-    Q_ButtonMenu, // used on selected device, to show buttons/groups
-    Q_Dialog, // shows errors
     Q_ActionMenu, // new UI,
     Q_Settings, // Variable Item List for settings
-    Q_FileBrowser, // TODO: UNUSED!
-    Q_TextInput // TODO: UNUSED
+    Q_Dialog, // TODO: shows errors
 } appView;
 
 typedef enum { Event_DeviceSelected, Event_ButtonPressed } AppCustomEvents;

+ 1 - 3
views/action_menu.c

@@ -31,7 +31,6 @@ static const Icon* ActionMenuIcons[] = {
 
 struct ActionMenuItem {
     const char* label;
-    IconAnimation* icon;
     uint32_t index;
     ActionMenuItemCallback callback;
     ActionMenuItemType type;
@@ -266,9 +265,8 @@ static void action_menu_process_down(ActionMenu* action_menu) {
 
 static void action_menu_process_ok(ActionMenu* action_menu, InputType type) {
     furi_assert(action_menu);
-    // UNUSED(type);
 
-    FURI_LOG_I("AM", "OK pressed! %d: %s", type, input_get_type_name(type));
+    // FURI_LOG_I("AM", "OK pressed! %d: %s", type, input_get_type_name(type));
     ActionMenuItem* item = NULL;
 
     with_view_model(

+ 2 - 1
views/action_menu.h

@@ -16,7 +16,7 @@ typedef struct ActionMenuItem ActionMenuItem;
 /** Callback for any button menu actions */
 typedef void (*ActionMenuItemCallback)(void* context, int32_t index, InputType type);
 
-/** Type of button. Difference in drawing buttons. */
+/** Type of UI element */
 typedef enum {
     ActionMenuItemTypeSubGHz,
     ActionMenuItemTypeRFID,
@@ -24,6 +24,7 @@ typedef enum {
     ActionMenuItemTypePlaylist,
     ActionMenuItemTypeGroup,
     ActionMenuItemTypeSettings,
+    ActionMenuItemType_count
 } ActionMenuItemType;
 
 typedef enum {