New GLCD code for displaying 6 values on one screen

I'm currently developing a heat pump monitor system with a GLCD and I need to be able to display quite a lot of data on a single screen for it to be useful, as well as configure the screen to fit different setups.

After spending a while getting used to the capabilities of the GLCD, I made a fairly tidy display but then found it was painful to reconfigure the layout, chose different parameters and so on. I wanted to create a single table that allowed me to chose which node, which value (power1, power2, Vrms, temp, humidity) etc, where it should be displayed, what units to use etc. rather than change the code in a million places.

So, I present my new 6 panel GLCD sketch.

GLCD

I realise this might be a bit cluttered and show a lot of information - perhaps too much for some. I find it takes a short while to get used to it.

https://github.com/cybergibbons/HomeEnergyMonitor/blob/master/HomeEnergy...

It has the following features:

  • Easy to configure which pane displays which value for a given node ID - deals with emonTH and emonTX values
  • Can calculate energy for 3 different power readings
  • Displays alternating daily MIN/MAX for temperature readings
  • Can display temperature, power, energy, voltage and percentage units
  • Allows display of numbers and strings aligned left, right, centre and on the number/unit division (which allows neat display of numbers that change from W to KW)
  • Uses a monospaced font to make calculating position of text easier
  • Has configurable timeouts for nodes - if no signal is received then label flashes "TIMED OUT"
  • Displays time
  • Has a small flashing circle to show system is still running (very dumb, but protects against hangs and memory issues)
  • Stores strings in flash to reduce RAM usage
  • Currently uses ~55% of flash and 82% of RAM - hopefully be enough headroom to add additional functionality.

There are a few bits and bobs I don't like about the code - mainly having to maintain an index for the string table outside of the string table. 

Here is an example of a row in the configuration:


  {POWER_ID, NODE_EMONTX, VALUE_EMONTX_POWER1, X0_Y0, UNIT_POWER, I_LABEL_POWER, 30},

POWER_ID is the node ID of the EMONTX. 

NODE_EMONTX tells us this is a normal EMONTX. Supports EMONTH as well

VALUE_EMONTX_POWER1 says we want to show the power1 value

X0_Y0 is the top left panel.

UNIT_POWER says to use W/KW units.

I_LABEL_POWER uses the string in the table represented by this index ("POWER").

30 is the timeout in s - i.e. we can miss several readings before it shows