Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Timezone not working? Also some other things I noticed #13

Open
DynaMight1124 opened this issue Oct 2, 2023 · 32 comments
Open

Timezone not working? Also some other things I noticed #13

DynaMight1124 opened this issue Oct 2, 2023 · 32 comments
Assignees

Comments

@DynaMight1124
Copy link

Hi

Thanks for the code. I loved the design of the clock but the wifi and NTP really brought it together.

I've built the clock and everything is working, however initially I was struggling to get the correct time, obviously I was manually setting to 12:00 and plugging in, but the correct time was never set. After some troubleshooting, I determined it was setting the correct minutes but not the correct hour.

I played around last weekend, it was just after 3pm but when I set my timezone (I'm in the UK so set GMT0BST,M3.5.0/1,M10.5.0) it would set 1pm plus whatever minute it was. I started to play around with other timezones like 2 hours on but the only one I could get working was <+03>-3. I left the clock running all last week, it did drift about 7 mins over the week so need to play with the steps a little. Thats a task for another day.

I saw you released an update, so just flashed that, unfortunately it doesnt fix the NTP issue but funnily enough the timezone <+03>-3 doesnt work as I am playing around at 4pm this weekend so I needed to use <+04>-4 to get the correct hour. The serial monitor doesnt print out what it thinks the current time is so I am not sure exactly what time the clock thinks it is, it is possible to print the time each minute when it updates? could help others diagnose similar issues.

A few other things I noticed, in the HTML code for the main page, settings and wifi settings its called Holow, not Hollow. Just a typo obviously.

Also on my clock, I originally noticed when it was finding the correct time on initial boot it was fairly quiet but the minute updates were very loud, almost sounded like old 3D printers before the silent stepper drivers. I noticed there was a 'fast rotate' for when it starts and a slow/normal for the minute updates. Only difference seemed to be int dt = 1 & 20 with 1 being fast. I changed both to 1 and the noise was massively reduced on minute updates.

Thanks

@HennieLP HennieLP self-assigned this Oct 3, 2023
@HennieLP
Copy link
Collaborator

HennieLP commented Oct 3, 2023

6bdbe6b
Fixed The Typo Thanks for leting me Know

8629731
Clock now prints the time when it updates

test(1).zip
This is an test script Which doesn't move the Clock just Prints The Current time it Thinks it is every Second

@DynaMight1124
Copy link
Author

Hi

Thank you, the Holow typo is also in the firmware.ino too.

I've updated the latest version and it does print the time now, I can confirm that it is getting the correct time. Its currently 10:16am and its reporting the correct time, however its still not properly moving the hour hand. If I reset it now, it'll move the minute to 16 and the time is set to 12:16.

I've tried setting it to GMT0 and the serial print correctly states 9:16 (using the above example) and the minute hand moves to 16 but doesnt move the hour hand so stays at 12:16 still. Obviously I know the hands are not independent so I assume the normal action would be to keep going around clockwise until it hits the correct time

I tried <+01>-1, it reports the correct time (10:16) in serial, interestingly it sets 1:16 on the clock itself. So I tried <+02>-2 and that reported 11:16am, which would be correct if I lived in that timezone. It set the clock to 2:16.

I'm no coder so not really sure whats going!! If its working fine for others, then only thing I can think of is that I need to flip the rotation so maybe something is happening with that code?

Quick info, I'm in the UK. We have daylight savings so winter = GMT0 and summer = BST with is GMT+1. We're still in BST.

Thanks

@d4rk50ul1
Copy link
Contributor

Hi @HennieLP , i'm having the same issue. finished my clock yesterday, uploaded the .ino code (latest) and checked on the SErial monitor, (this is my timezone <-05>5 Bogota, Colombia, Latin America). However, the clock is kind of not showing the right time.
Let's say right now it shows that it is 11:35 am but the clock shows 7:35.

@Creo2005
Copy link

The same problem.
Time zone from https://sites.google.com/a/usapiens.com/opnode/time-zones
Kyiv, Ukraine EET-2EEST,M3.5.0/3,M10.5.0/4
not working properly.
At this moment time is 20:50
Set 12, and power On,
clock show time 14:50

@HennieLP
Copy link
Collaborator

Asking if i understand the problem corectly the Clock Prints The Corect time via Serial But the clock shows The Wrong Time?

@DynaMight1124
Copy link
Author

Yeah for me, serial was reporting the correct time but the clock was moving to the correct minute but incorrect hour. It seems like its not calculating the time correctly and taking the time zone too literal.

From the 2 examples above:
<-05>5 Bogota, Colombia, Latin America is minus 5 hours, if you start the clock at 12, take away 5 hours you get 7. Which matches the above example
EET-2EEST,M3.5.0/3,M10.5.0/4 is plus 2 hours, start at 12, plus 2 hours and you get 2. Again matches the example.

I was also encountering the same issue, when I first set it, it was 3pm and I had to set GMT+3 to get the correct time, which obviously moved the hour hand 3 hours but setting my correct timezone (GMT0BST,M3.5.0/1,M10.5.0) only moved 1 hour as BST is plus 1 hour.

@HennieLP
Copy link
Collaborator

Added Check If NTP Server Responds With Vaild Response

@HennieLP
Copy link
Collaborator

HennieLP commented Oct 19, 2023

I created a development branch in which I rewrote the time calculation.
Now it should work as expected

If it dosent work as Expected Please Let me Know

@d4rk50ul1
Copy link
Contributor

Hi @HennieLP , my case it stays in an infinite loop on line 626
Serial.println("NTP Server Was not reachable!! Restart Clock to Retry");

@HennieLP
Copy link
Collaborator

Added That The Clock automatically Retrys After 60 seconds pleas Try Again

@d4rk50ul1
Copy link
Contributor

d4rk50ul1 commented Oct 22, 2023

didn't work so i commented couple lines and added 1 according to time.h documentation. all of this inside updateTime() function
//time(&now); // read the current time
//localtime_r(&now, &tm); // update the structure tm with the current time
getLocalTime(&tm);

@HennieLP
Copy link
Collaborator

if this

Added That The Clock automatically Retrys After 60 seconds pleas Try Again

dosent work than the clock cant conect to the NTP server does your clock have an Active Internet conection ? or is your Own Ntp Server runing corectly ?

@HennieLP
Copy link
Collaborator

the clock is cheking if its past the Year 2000 to verify its result from the NTP Libary

@d4rk50ul1
Copy link
Contributor

if this

Added That The Clock automatically Retrys After 60 seconds pleas Try Again

dosent work than the clock cant conect to the NTP server does your clock have an Active Internet conection ? or is your Own Ntp Server runing corectly ?

It gets ip address normally. As i mentioned, i replaced the time function and curiously now it works. Perhaps in my case there is something not working with the way you structured the sentences in updateTime.
I'm using a wemos d1 lite.

@HennieLP
Copy link
Collaborator

HennieLP commented Oct 22, 2023

is your clock in an difernet network than your phone/pc ?

@d4rk50ul1
Copy link
Contributor

It is on the same network. I'm also able to set it up over a pc browser now in case i need to modify anything.

@HennieLP
Copy link
Collaborator

what NTP server are you using ?

@d4rk50ul1
Copy link
Contributor

co.ntp.pool.org

@HennieLP
Copy link
Collaborator

please try co.pool.ntp.org

@HennieLP
Copy link
Collaborator

HennieLP commented Oct 22, 2023

co.ntp.pool.org is not a NTP server

@d4rk50ul1
Copy link
Contributor

My mistake, it was a typo on my response. I used co.ntp.pool.org. As i mentioned, after changing the two lines in UpdateTime function, it worked.

@HennieLP
Copy link
Collaborator

curently Trying With getLocalTime(&tm); you can actualy Remove The NTP Client Libary beacuse it isnt used

@HennieLP
Copy link
Collaborator

changed it in The Dev Branche Thanks for the Help!

@HennieLP
Copy link
Collaborator

if you whant i can even undo your code Change and you can make A Pull Request so that you are Listet As Contributor

@nikzin96
Copy link
Owner

I updated my clock today to the dev branch version of yesterday and it worked fine. Thanks Hennie for all the improvements in the last weeks :). If the dev branch is working correctly, should we push a new release version or at least commit it to the main.

@d4rk50ul1
Copy link
Contributor

@HennieLP @nikzin96 Hey both! Coming back to ask you a question, is there any way i can see the html setup after initial configuration? Reason is that i would like to be able to edit my clock wifi data and even factory reset it without having to reflash. Hope it's feasible. I'm really not good at coding so haven't tried. Additionally something I've seen is that no matter if i reflash it, it keeps the memory of previous wifi info, reason why I would like to create a sort of factory reset.

Thanks in advance for any help !!!!

@HennieLP
Copy link
Collaborator

If you open the ip of the clock a page Shud appear where you can change the WiFi and other Settings

@d4rk50ul1
Copy link
Contributor

Tried but doesn't work. I had to change the code to dinamically delete the server object on the initwifi function when you're already connected to wifi so that it launches the server normally.

@valbuz
Copy link

valbuz commented Apr 17, 2024

hi
For me i have the same problem with the correct time.
I'm testing with your test script and in the serial monitor i have the correct time!
I set the same timezone/settings in the Web form, hit save and after i while i disconnect the esp set the all pointers to 12 o'clock and put the power again.
sometimes the pointers goes around and around all the time... sometimes it stop's with the correct minute, but never with the correct hour.
In the serial monitor i see all minute the correct time. i.e. 8:14 (20:14)
I don't know whats wromg here. :-(

@HennieLP
Copy link
Collaborator

Did you already try the dev branche if not please do so and let me know if it fixed your problem

@valbuz
Copy link

valbuz commented May 2, 2024

Hi
Thanks, with the dev branche it works!
What are the differents?

@HennieLP
Copy link
Collaborator

HennieLP commented May 2, 2024

  • Complete Rewrite of the Hand Calculation
  • Added Hostname
  • Added Factory reset
  • and other minor fixes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants