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

turnOffResetLogic() -- allow partial reset #207

Open
vzahradnik opened this issue Nov 17, 2023 · 3 comments
Open

turnOffResetLogic() -- allow partial reset #207

vzahradnik opened this issue Nov 17, 2023 · 3 comments
Labels
awaiting-feedback enhancement New feature or request

Comments

@vzahradnik
Copy link
Collaborator

Is your feature request related to a problem? Please describe.
In the current implementation, TcMenu resets menu after 30 seconds of inactivity. If a user is in some nested menu, after waking up the display, he is presented with the top menu once again. This is not always what we want, yet we would like to use the reset callback to implement our logic.

Please add an option to keep the menu reset logic enabled but without resetting the menu hierarchy to the top level. So that users can react to the event - like turn off a display - and restore the display later.

Currently, I'm calling the code renderer.turnOffResetLogic(); and implement my own custom logic.

@davetcc davetcc added the enhancement New feature or request label Nov 21, 2023
@davetcc davetcc added this to the 4.2.0 milestone Nov 21, 2023
davetcc added a commit that referenced this issue Nov 26, 2023
@davetcc
Copy link
Collaborator

davetcc commented Nov 26, 2023

@vzahradnik Can you please try the following when you get a moment:

    /**
     * Indicates to the renderer that you want reset notification, but you do not want any changes to be made to
     * the position in the menu, instead of the default behaviour to reset to the root menu.
     * @param ticks the number of seconds before calling the reset handler
     */
    void resetNotifiesOnly(uint16_t ticks) {
        resetValInTicks = (ticks & RENDERER_MAXIMUM_TICK_MASK) | RENDERER_RESET_NOTIFY_ONLY;
    }

@vzahradnik
Copy link
Collaborator Author

Reset functionality is partially OK. Menu hierarchy stays intact and stays at the latest nested screen. However, I was not able to get the notification about menu reset.

Here is the code I put together:

renderer.resetNotifiesOnly(10); // 10 seconds

renderer.setResetCallback([] {
    Log.noticeln("Menu was reset");
});

I'm just assuming that I should use the same callback as with the full menu reset.

@davetcc davetcc removed this from the 4.2.0 milestone Mar 9, 2024
@vzahradnik
Copy link
Collaborator Author

I can confirm the issue persists with the latest TcMenu release. The resetNotifiesOnly does not trigger anything. I temporarily use the following code.

    // TcMenu Bug: renderer.resetNotifiesOnly(storeManager.getDisplay().getDisplayIdleTimeout() * 60);
    renderer.setResetIntervalTimeSeconds(storeManager.getDisplay().getDisplayIdleTimeout() * 60);
    renderer.setResetCallback([](){
        if (storeManager.getDisplay().shouldTurnOffDisplayWhenInactive() && displayManager.isTurnedOn()) {
            Log.traceln(F(TC_I18N_DISPLAY_INACTIVITY_TURN_OFF));
            displayManager.turnOff();
        }
    });

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting-feedback enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants