Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Indicate when waiting for a keypress #18

Open
nelgin opened this issue Mar 21, 2023 · 2 comments
Open

Indicate when waiting for a keypress #18

nelgin opened this issue Mar 21, 2023 · 2 comments

Comments

@nelgin
Copy link

nelgin commented Mar 21, 2023

When trying to use recovery_menu without the benefit of a display, it would be nice to know if the device has finished a task (dumped logs, dumped roms, loaded network etc). I made a small enhancement to waitButtonInput to flash yellow when it's waiting for a key. It might be good to have it flash red if an operation failed.

Add the following as the first line in the waitButtonInput function in ios_mcp/source/menu.c

    setNotificationLED(NOTIF_LED_ORANGE|NOTIF_LED_ORANGE_BLINKING);

Then before the return, turn it purple again

   setNotificationLED(NOTIF_LED_BLUE|NOTIF_LED_RED);

Hope this helps those working in the dark.

@filipe-maia
Copy link

I'm facing the same problem. This would be a nice addition.

@filipe-maia
Copy link

filipe-maia commented May 23, 2023

Hi,

Thank you @nelgin .

I've changed "setNotificationLED" to "SMC_SetNotificationLED", the end result on the function is:

/**
 * Wait for the user to press a button.
 */
void waitButtonInput(void)
{
    SMC_SetNotificationLED(NOTIF_LED_ORANGE|NOTIF_LED_ORANGE_BLINKING);
    gfx_set_font_color(COLOR_PRIMARY);
    gfx_draw_rect_filled(8, SCREEN_HEIGHT - (16 + 8 + 2), SCREEN_WIDTH - 8 * 2, 2, COLOR_SECONDARY);

    gfx_draw_rect_filled(16 - 1, SCREEN_HEIGHT - CHAR_SIZE_DRC_Y - 4,
        SCREEN_WIDTH - 16, CHAR_SIZE_DRC_Y + 2,
        COLOR_BACKGROUND);
    gfx_print(16, SCREEN_HEIGHT - CHAR_SIZE_DRC_Y - 4, 0, "Press EJECT or POWER to proceed...");

    uint8_t cur_flag = 0;
    uint8_t flag = 0;

    while (1) {
        SMC_ReadSystemEventFlag(&flag);
        if (cur_flag != flag) {
            if ((flag & SYSTEM_EVENT_FLAG_EJECT_BUTTON) || (flag & SYSTEM_EVENT_FLAG_POWER_BUTTON)) {
                SMC_SetNotificationLED(NOTIF_LED_BLUE|NOTIF_LED_RED);
                return;
            }

            cur_flag = flag;
        }
    }
}

I've attached the built files (they also contain the changes of issue 19).
recovery_menu.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants