I am looking for some feedback regarding how to manage a large amount of code I have that is for the settings of the device and how it’s used. For example, The devices itself is modular, so the user must change settings or preferences to make it work for their application. Some examples are the users preferred temperature unit(C or F) or a “High Temp” warning value, etc. Some setting are related to the LCD display(contrast, or invert) So then I need to pass a delegate to the Contrast and invert Methods of the LCD.
After some trial and error and research I finally arrived at and implemented “Type-Safe Enum Class” pattern to handle all the settings. I’m somewhat happy with the solution, but it’s a lot of code to manage. I’ve tried to use as much abstraction and DI as possible.
The settings must persist in EEPROM and are loaded on boot through the settings class. This is a little fragile as there are wear-leveling and circular buffers tightly connected to the settings which is stored in EEPROM. After writing this out, I may need to do some refactoring and some more “single responsibility principle”
Anyway, are there any other patterns or ways to accomplish this? What are you doing for these situations?