diff --git a/App/app/action.c b/App/app/action.c index 7fa17f02..5ed05887 100644 --- a/App/app/action.c +++ b/App/app/action.c @@ -28,6 +28,9 @@ #ifdef ENABLE_FMRADIO #include "app/fm.h" #endif +#ifdef ENABLE_FEAT_F4HWN_OVERLAY_APPS + #include "apps/app_overlay.h" +#endif #include "app/scanner.h" #include "audio.h" #ifdef ENABLE_FMRADIO @@ -468,13 +471,8 @@ void ACTION_Handle(KEY_Code_t Key, bool bKeyPressed, bool bKeyHeld) void ACTION_FM(void) { #ifdef ENABLE_FEAT_F4HWN_OVERLAY_APPS - /* Overlay apps replace the resident FM screen with the FM overlay app, so - this launcher is inert. Every external entry point - the assignable - side-key, the F+0 key, the boot-state resume - funnels through here, and - gFmRadioMode is only ever set from inside this function, so returning - early keeps the resident screen from ever opening. fm.c still links - against ACTION_FM; its own EXIT-path calls are unreachable because the - resident screen never opens. */ + if (APP_LaunchOverlayByName("Broadcast FM") != APP_OK) + gBeepToPlay = BEEP_500HZ_60MS_DOUBLE_BEEP_OPTIONAL; return; #else if (gCurrentFunction != FUNCTION_TRANSMIT && gCurrentFunction != FUNCTION_MONITOR) diff --git a/App/apps/app_overlay.c b/App/apps/app_overlay.c index 4291e6da..650de0f8 100644 --- a/App/apps/app_overlay.c +++ b/App/apps/app_overlay.c @@ -633,6 +633,19 @@ uint8_t APP_ValidateSlot(uint8_t slot, app_header_t *out_header) return APP_OK; } +uint8_t APP_LaunchOverlayByName(const char *name) +{ + app_header_t h; + + for (uint8_t slot = 0; slot < APP_SLOT_COUNT; slot++) { + if (APP_ValidateSlot(slot, &h) == APP_OK && + strncmp(h.name, name, APP_NAME_LEN) == 0) + return APP_LaunchOverlay(slot); + } + + return APP_ERR_MAGIC; +} + uint8_t APP_SlotInfo(uint8_t slot, app_header_t *out_header) { if (slot >= APP_SLOT_COUNT) diff --git a/App/apps/app_overlay.h b/App/apps/app_overlay.h index 676b1b9d..12465168 100644 --- a/App/apps/app_overlay.h +++ b/App/apps/app_overlay.h @@ -103,6 +103,9 @@ uint8_t APP_ValidateSlot(uint8_t slot, app_header_t *out_header); * Returns when the app exits; the internal flash is never touched. */ uint8_t APP_LaunchOverlay(uint8_t slot); +/* Find the first valid app with this exact header name and launch it. */ +uint8_t APP_LaunchOverlayByName(const char *name); + /* Host-tool slot management (external flash only, never brick-critical). */ uint8_t APP_SlotInfo(uint8_t slot, app_header_t *out_header); uint8_t APP_SlotErase(uint8_t slot);