New Arduino library: MenuSystem

Let me see if I understand.

You're adding a 'SetupItem' to the menu in order to use the menusystem interface to change values? The example I can think of is a menu item for setting a clock format to be 12 hour or 24 hour.

If my understanding is right, I don't think 'SetupItem' is needed. The handler for an arbitrary 'MenuItem' can perform the required action. The benefit of the 'SetupItem' is that it stores the setting value automatically, but this is also a downside - it results in the menusystem also being responsible for settings.

I'm also reluctant to add more classes. The arduino doesn't have a huge amount of memory, and generic libraries should be small so more of that memory can be used by the client application.

The interface change in your example also isn't ideal: it would break existing code. That said, I think the 'MenuItem' might be better off if the handler function pointer was passed in the constructor.

Anyway, I don't want to demoralise you. Perhaps I've misunderstood and there is a good use case for this. I've not convinced myself completely that this is a bad idea (Right now I'm thinking of a 'ToggleMenuItem' that when toggled sends the new value to the callback function...but I'm also wondering if a Settings library should really handle this...hmmm).