LCD best coding practices

Hi all,
I've done some searching on this but couldn't find anything that really addressed this issue, so I'm hoping someone here has some advice or can point me in the right direction.

I'm working on a music sequencer project and have decided to use an lcd. I have it breadboarded and have installed and am using the newLiquidcrystal library via a 74hc595 shift register. Everything is up and running well on the hardware side.

My question is related to understanding how to best write the code for controlling the LCD. In my sketch there are alot of times that I want to write a bunch of data to the LCD (like switching to a new menu or something where the entire display will change), but then once the data has been written, it is pretty much static. It doesn't need to be constantly updated (rewritten) each time through the loop. Ideally there would be a way to indicate that something within the loop should only occur once.

I have used flags in a number of places to get certain code blocks to only execute when a variable changes, but all of the flags need to be global, and there are alot of places where it looks like I will have to create flags, basically one flag each for everyhting that I don' want the display to be constantly updating. This seems both very inefficient and like it is contrary to good coding practices. (I am pretty new to coding but am trying to learn how to do things "the right way")

It seems, (from my newbie point of view) that controlling LCD updates would be a fairly common concern amongst programmers, but I haven't been able to find any code, or even any discussion about how to achieve this.

Anybody here have some insight on this or some links you could direct me to?

Thanks in advance.

Hello,

It's not easy to provide some recommendation for your question. I think there is no best practise for this problem as whole.
Your idea with flags is not bad and yes they are consume memory, but you can use bit field as a flag register (instead of int as many people doing it by this way). Single byte provides room for 8 bit flags. Its setting and reading is very effective in asm after translation.

Example of use by me: We have LCD with 4 rows, then I can use 1 flag for rewriting whole row - I need 4 bits.
OR
I can use separate flags for separate values on the screen.

One recommendation: due to limited MCU's program memory space, it is better to rewrite larger part also with static data on LCD than to include many conditions in the program and waste space, if a final look is not disturbed . It is up to you to find compromise between.

...but couldn't find anything that really addressed this issue...

I can't agree, sorry. One thing which you can do, is to study the code of other people which they share it on the internet to find ideas "how to" and learn. There are a lot of inspiration on the net.