I’m grappling with ExtendedTimers. Here’s what I want to achieve:
On a timed basis, redraw the LCD display (multiple seconds apart). Periodically though, other things will occur that require the redraw to happen immediately.
So I was thinking, create a funciton that redraws the LCD, and call that both using a timer and as needed when the other events happen.
Here’s where I came unstuck. If I define my redraw function as:
public static void Display_Repaint()
how do I go about defining the ExtendedTimer function ?
DisplayUpdate = new ExtendedTimer(new TimerCallback(Display_Repaint), null, 2000, 1000);
If I do this, then an error is shown - basically I understand that system.threading.timercallback needs a parameter (and I’m unsure what that parameter actually is?)
If I change the redraw to be Display_Repaint(Object o) then in the two or three places I need to call the redraw, what “object” do I need to provide?
So if someone could explain the concept that is going on here, that would help greatly - what is the “object” and what can I (or what should I) use it for within the redraw function (if anything).
I guess one alternative I considered that might get me out of this predicament is to move to a pure “handler” scenario, where the timer fires more frequently and it looks for a global redraw flag and if set it calls the redraw function, and if the normal redraw interval has passed it also calls the redraw function. What are people’s thoughts on whether these are better approaches?