turnOffResetLogic() -- allow partial reset
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.
@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;
}
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.
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();
}
});