texadactyl / rpi_clock

Raspberry Pi Clock & Weather display
GNU General Public License v3.0
13 stars 8 forks source link

Screen update rate? SLEEP_TIME_MSEC default value of 60000 is too large #14

Closed vacumcollapse closed 1 year ago

vacumcollapse commented 1 year ago

Hi - rpi3 bullseye with adafruit screen syncing a local ntp server. Pi is syncing to ntp server accurately, confirmed by watch -n 0.1 date and timedatectl timesync-status but rpi_clock screen display updates time far less frequency - varies between 2s and 48s every minute, not seemingly dependent on ntp minpoll settings. Is there a way to set/reduce/manipulate the screen display refresh so it more accurately tracks the ntp system time? thanks

texadactyl commented 1 year ago

@vacumcollapse

Thanks. Very interesting. Have not tried this on an adafruit product yet. Never had this symptom on the garbage TFT screen I bought at Amazon. Also, this is not an issue when running with a desktop window display (FLAG_WINDOWED = True).

I need to have another look at the source code. If you see anything, please let me know. I'll be free soon for investigation.

texadactyl commented 1 year ago

@vacumcollapse

Please supply the configuration file that you are using with OWM_API_KEY value masked. Thanks.

I added a seconds field by changing FORMAT_TIME to %%I:%%M:%%S

Also, to see if this is hardware related, please try the FLAG_WINDOWED = True case with a connected HDMI display. Same behaviour?

vacumcollapse commented 1 year ago

Hi - thanks for looking into this - cool program btw. Current .cfg attached with details #'d out etc.

Tried it with windowed=true (and big screen via hdmi) and still same behaviour - see screenshot from vnc feed - the time update is ~48s late compared to the system clock.

Does the FORMAT_TIME update need me to reclone or update, or can i just change that in the .cfg?

rpi_clock.txt

vacumcollapse commented 1 year ago

rpi_clock.txt

vacumcollapse commented 1 year ago

Confirm with the addtion of :%%S in FORMAT_TIME it shows seconds, but they don't update....

vacumcollapse commented 1 year ago

Some progress: I noticed the update was happening exactly 60s apart. In the .cfg, changing SLEEP_TIME_MSEC interval from 60000msec down to 1000msec results in the time updating every 1s onscreen, and the time is aligned to the NTP server derived system time. However, does this mean it is updating weather every 1s also, which may be a bit much? thx

texadactyl commented 1 year ago

"happening exactly 60s apart" That is the expected behaviour with the default config file. Your change to 1000 msecs gave the expected change in behaviour i.e. 1-second tick. I updated 60000 to 3000 and saw a 3-second tick. What value to use? (-:

It's working on both HDMI and your adafruit device as expected now? BTW, which adafruit product are you using? URL, please, if possible.

So, what do you think I should change the SLEEP_TIME_MSEC default value to?

vacumcollapse commented 1 year ago

Well, for an NTP display (use case I was trying to achieve) i'd like it down to 100msec as i have a GPS PPS based NTP server that i know is accurate to a few usec jitter. But does that timer also control frequency of the OWM web lookup because that doesn't need to be any more regular than e.g. 5mins... I'm not experienced so couldn't immediately untangle which countdown timer was controlling that lookup

texadactyl commented 1 year ago

I'm going to go with a default value of 3000 i.e. a 3-second tick. I'll highlight this variable in a new CONFIGURATION.md file which will explain all of the parameters. The operator can experiment as they wish.

vacumcollapse commented 1 year ago

Thanks. Happy NYE

texadactyl commented 1 year ago

Yeah, Happy Occidental New Year!

texadactyl commented 1 year ago

@vacumcollapse

This one? https://learn.adafruit.com/adafruit-pitft-3-dot-5-touch-screen-for-raspberry-pi

vacumcollapse commented 1 year ago

Screen was this one https://www.adafruit.com/product/2441

  1. Straightforward fresh install of RPIos from the online installer (correcting for the fkms problem with bullseye and older hdmi screens)
  2. I followed the adafruit FBCP install notes and code for the right screen: sudo python3 adafruit-pitft.py --display=35r --rotation=90 --install-type=fbcp but changed the 90 to 270
  3. On your prep notes, I skipped all of it up to "Install RPI Clock" section and it booted up just fine

I believe that was it - it worked first time, and this is all I think i did.

texadactyl commented 1 year ago

Yes, that's the one I had guessed. Have to get the hardware now from Digi-key but that's ok. I can follow the "Easy Install". I'll rewrite the preparation notes.

Thanks.