Montecri/GNSSTimeServer

Use "timelib.h"

Closed this issue · 10 comments

cheise commented

https://github.com/Montecri/GPSTimeServer/blob/5a0cee3bb3972d495a00e4791f701c804b7f2d9c/src/main.cpp#L653

Why don't you let "timelib.h" calculate it for you?

timestamp = now() + seventyYears;

so you don't need all the code for the time calculation.

Sounds good. Will work on this today. Thank you!

Hi @mmarkin !

Believe you replaced:

timestamp = numberOfSecondsSince1900Epoch(year(t), month(t), day(t), hour(t), minute(t), second(t));

with:

timestamp = CalculateNTP(year(t), month(t), day(t), hour(t), minute(t), second(t));

On Dual Display tree.

@cheise above is proposing what appears to be a more concise and elegant solution.

I've updated the main tree with the suggestion, tested and appear to work ok.

Would like to implement that on the Dual Display tree?

Thank you!

cheise commented

In Germany we say: "You can't see the tree for the trees"
or "why make it complicated when it's easy" I hope the translation is correct. Best Regards

Hi guys!

I remember I added >3000 to debug a specific situation (for which, of course, I don't recall) and forgot to remove it.

Went over the code so many times to make it work with my hardware and specific needs that, at some point, it kind of becomes fuzzy. Unless it's a code-breaking bug you don't see the opportunities anymore. But I was certain that people online would find these and help fix them.

Like my ugly display code, fixed by @mmarkin, and these fixed by @cheise

Thank you all!

  • Cristiano

Fixed as of today.

cheise commented

I ported the code to RP2040 Raspberry Pico, the non wifi variant. That's when I noticed the problems. I have built a lightweight network based GPS NTP device, not WiFi based. Your code helped me a lot to understand many things. Great work from you :)

It looks like that:

NTP-Server

Very nice!

Have you posted your port on Github or something?

If you want we can created a RP2040 branch for it, like I did for Mitch Dual Display and PIR version, so he can maintain it.

Regards,

  • Cristiano
cheise commented

Under https://github.com/cheise/PICO_GPS_TimeServer_PLUS you can see my newest public code. Now it has support for the newer TinyGPSPlus libary ;) This Version is for the i2c Display what you use, too. Functionaly the same, without the "reset / WiFi" Button, i use the "run" pin on RPI Pico for resetting the board with a Button.