0 votes
in WeatherStationClassic by (550 points)
I see in the code that various values get updated every 10 minutes or so, and I see functions that create each of the screens that scroll by.

One thing I've not figured out is how the display code updates the time while displaying the drawDateTime frame.

It's almost as if it's calling the drawDateTime function repeatedly during the few seconds it displays each card, if thats the case where is that configured? Ie could we control how long each screen displays before moving on to the next?

1 Answer

0 votes
by (9.1k points)
selected by
 
Best answer

You can control how long a frame stays and how fast it moves by calling the methods ui.setTimePerFrame(..) and ui.setTimePerTransition(..) with appropriate values. There are more interesting settings in OledDisplayUI.h:
https://github.com/squix78/esp8266-oled-ssd1306/blob/master/OLEDDisplayUi.h

And yes, all drawing functions are constantly called when they are displayed. When we are in transition between two different frames we draw even both frames constantly.

The 10 minutes ticker update just fetches data from the internet and synchronizes the time. Depending on the demo you are using the time is either synchronized from Google  (simple demo) or by using a network time protocol (NTP) server (DST demo). The DST demo is much more precise and also can deal with changes in the day light saving time (DST).

Counting up the second is done constantly by comparing the last synchronization with the CPUs internal cycle/milli second counter and calculated from there. You can find the code for this here: 
https://github.com/squix78/esp8266-weather-station/blob/master/src/TimeClient.cpp#L99

Welcome to ThingPulse Q&A, where you can ask questions and receive answers from other members of the community.

https://thingpulse.com

...