diff --git a/src/core/display.cpp b/src/core/display.cpp index 341234ee95..6192ecbca7 100644 --- a/src/core/display.cpp +++ b/src/core/display.cpp @@ -533,7 +533,11 @@ int loopOptions( // handleSerialCommands(); // always use serial task for it #ifdef HAS_KEYBOARD - checkShortcutPress(); // shortctus to quickly start apps without navigating the menus + if (checkShortcutPress()) { + // Shortcut opened a submenu that drew over the screen; force full redraw + redraw = true; + drawMainBorder(); + } #endif if (menuType == MENU_TYPE_REGULAR) { diff --git a/src/core/mykeyboard.cpp b/src/core/mykeyboard.cpp index 3974e785e7..b4d254e328 100644 --- a/src/core/mykeyboard.cpp +++ b/src/core/mykeyboard.cpp @@ -253,13 +253,14 @@ keyStroke _getKeyPress() { ** location: mykeyboard.cpp ** runs a function called by the shortcut action **********************************************************************/ -void checkShortcutPress() { +bool checkShortcutPress() { static JsonDocument shortcutsJson; // parsed only once + bool executed = false; // lazy init if (shortcutsJson.size() == 0) { FS *fs; - if (!getFsStorage(fs)) return; + if (!getFsStorage(fs)) return false; File file = fs->open("/shortcuts.json", FILE_READ); if (!file) { log_e("Shortcuts Config file not found. Using default values"); @@ -270,13 +271,13 @@ void checkShortcutPress() { shortcuts["b"] = "loader open badusb"; shortcuts["w"] = "loader open webui"; shortcuts["f"] = "loader open files"; - return; + return false; } // else if (deserializeJson(shortcutsJson, file)) { log_e("Failed to parse shortcuts.json"); file.close(); - return; + return false; } file.close(); } @@ -293,9 +294,11 @@ void checkShortcutPress() { if (i == *shortcut_key) { // compare the 1st char of the key string // execute the associated action serialCli.parse(String(shortcut_value)); + executed = true; } } } + return executed; } /********************************************************************* diff --git a/src/core/mykeyboard.h b/src/core/mykeyboard.h index 749d86ebc6..42d1a6b39d 100644 --- a/src/core/mykeyboard.h +++ b/src/core/mykeyboard.h @@ -23,6 +23,6 @@ keyStroke _getKeyPress(); // This function must be implemented in the interface. // by using the flag HAS_KEYBOARD // Core functions, depends on the implementation of the funtions above in the interface.h -void checkShortcutPress(); +bool checkShortcutPress(); int checkNumberShortcutPress(); char checkLetterShortcutPress();