Hi,
A few things about this project :
This application, being part of a home automation project, uses a 4x20 LCD mounted on a 3D printed wall plate which will be mounted in place of a wall switch. A rotary encoder (shown in blue) will be used to scroll through all available house circuits and send commands to switch them on/off. This is an alphanumeric display with no graphics. Later on I might consider a graphics display, maybe OLED.
The circuit description (eg “Main bedroom light”) – and hence each of the menu items to be toggled, is stored on an external EEPROM.
There are around 100 different such items (circuits). The system also receives status information for each circuit, which should be shown on the LCD as well.
I have developed functions for :
findCircuitDescription (byte ID); // which searches the external EEPROM (I2C) and finds the description of each the 100 circuits
sendCommand (byte ID, byte targetState); // which sends a command to turn on or off a particular circuit based on its ID
The findCircuitDescription() function stores the description text in a char description[25] global variable.
The current state of each circuit is stored in a global array in RAM currentState[100] which is continually updated by feedback from the various devices.
All devices talk to each other via RS485 bus.
The Arduino above is based on an atmega1284p CPU and I am using the Mightycore. This way I have 128kb of program space to play with .
I ve been looking into already available Menu libraries for LCD displays but no one i could find (so far) supports dynamic creation of menu items. In my case the menu options must be based on description stored in EEPROM as explained earlier and not created at compile time.
Can anyone suggest an easy way to approach this matter?
Thanks!