Open Ales-Svoboda opened 2 months ago
IMHO, I think that this should be quite straightforward to do using a MenuManagerObserver. You'd only add the extra observer or commit hook if the option was enabled. See:
@vzahradnik In our FW we created a button (menuItem) in the menu for manual data saving. Would you remind me why we didn't use the menuEditEnded()
method for automatic saving?
I am sure there was a reason. However I can't tell it with certainty. I will update this ticket once I get back to working with our hardware to check it out.
Description
Currently, in TCMenu, it is possible to call a callback method when a parameter value is changed, but this method is called every time the value changes. For example, if changing a value from 1 to 100, the callback is invoked 99 times. It would be preferable to save the settings only once after the user has completed the parameter change. Although frequent saving can reduce flash memory lifespan, parameter changes are typically infrequent in many applications. Therefore, an option to enable automatic saving upon completion of a parameter change should be configurable globally for the entire TCMenu.
Steps to Reproduce
Expected Behavior
Actual Behavior
Proposed Solution
By implementing these changes, TCMenu will provide a more efficient and user-friendly way to handle parameter changes and save settings, improving both usability and the lifespan of flash memory.