[Logo] TCC discussion forum
  [Search] Search   [Recent Topics] Recent Topics   [Hottest Topics] Hottest Topics   [Top Downloads] Top Downloads   [Groups] Back to home page 
[Register] Register /  [Login] Login 


This forum is read only and new users cannot register, please ask all new questions either using GitHub discussions, or in Arduino forum tagging @davetcc.

Update LCD display only when "Menu" is inactive RSS feed
Forum Index » tcMenu Arduinio library
Author Message
jacobez


Joined: Mar 21, 2021
Messages: 10
Offline
Hi Dave,
Thanks for the library & assistance you provide to all.

I am new to this library and have spent quite a bit of time on trying to understand it, but am missing something.
I have an Arduino Mega, 20x4 LCD on i2C and 3 buttons with pull-up logic and some menu items running. I've also implemented the eeprom storage and it all works well.

The menu now displays and I've been able to take over the display and show display some system parameters from sensors on the LCD on the display as explained in the "takeOverDisplay" example. My challenge is that when I schedule the "Display Sensors function" that should update the display only when the menu is inactivated, the display is distorted with a mix of the sensor display and the menu.

How do I test if the menu is active and ensure that the "Display Sensors function" does not run while the menu is open?

Thanks in advance for your assistance.
Regards,
Jaco
davetcc


Joined: Jan 19, 2019
Messages: 686
Offline
My challenge is that when I schedule the "Display Sensors function" that should update the display only when the menu is inactivated, the display is distorted with a mix of the sensor display and the menu.


It sounds like you're updating the display outside of the rendering callback. You must never draw to the display outside of that callback because you'd otherwise risk multiple commands being sent to the LCD at once.

How do I test if the menu is active and ensure that the "Display Sensors function" does not run while the menu is open?


The best way to do that is invert the logic, put all the drawing code for this only in the take over display callback, and the sensor function just stores this state into a variable somewhere (that would then be read by your drawing code).
jacobez


Joined: Mar 21, 2021
Messages: 10
Offline
Thanks Dave, I understand and shall try accordingly.
 
Forum Index » tcMenu Arduinio library
Go to:   
Mobile view
Powered by JForum 2.7.0 © 2020 JForum Team • Maintained by Andowson Chang and Ulf Dittmer

This site uses cookies to analyse traffic, serve ads by Google AdSense (non-personalized in EEA/UK), and to record consent. We also embed Twitter, Youtube and Disqus content on some pages, these companies have their own privacy policies.

Our privacy policy applies to all pages on our site

Should you need further guidance on how to proceed: External link for information about cookie management.