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

Time is received but not set when using NTP source #29

Closed
simonachmueller opened this issue Jun 26, 2022 · 3 comments
Closed

Time is received but not set when using NTP source #29

simonachmueller opened this issue Jun 26, 2022 · 3 comments

Comments

@simonachmueller
Copy link
Contributor

simonachmueller commented Jun 26, 2022

I want to use NTP server as date/time source for my ESP32/WiFi telescope (it's connected to my home router and have internet access).
I got it working with a small fix provided here #28

It seems to be a problem or misconfiguration.
Here is a verbose log from today, 26th of June:

MSG: Setup, HAL initalize
MSG: Setup, start system service task (rate 10ms priority 7)... success    
MSG: Setup, start input sense polling task (rate 1ms priority 7)... success
MSG: NV, correct key found
MSG: Axis1, start monitor task (rate 5000us priority 1)... success
MSG: Axis1, reverting settings to Config.h defaults
MSG: Axis1, stepsPerMeasure=220015.79, reverse=ON
MSG: Axis1, backlash takeup frequency set to 0.10°/s
MSG: Axis1, adding any home and/or limit senses
MSG: StepDir1, pins step=18, dir=0, en=12
MSG: StepDir1, start task to move motor... success
MSG: StepDir1, init model TMC2130 SPI u-step mode 16X (goto mode OFF)
MSG: TmcDriver, init RSENSE=0.13
MSG: SoftSpi, init MOSI=13, SCK=14, CS=23, MISO=4
MSG: StepDir1, TMC Ihold=150mA, Irun=300mA, Igoto=300mA
MSG: StepDir1, TMC standstill automatic current calibration
MSG: StepDir1, sequencer homes every 1 step(s)
MSG: Axis2, start monitor task (rate 5000us priority 1)... success
MSG: Axis2, reverting settings to Config.h defaults
MSG: Axis2, stepsPerMeasure=220015.79, reverse=ON
MSG: Axis2, backlash takeup frequency set to 0.10°/s
MSG: Axis2, adding any home and/or limit senses
MSG: StepDir2, pins step=27, dir=26, en=SHARED
MSG: StepDir2, start task to move motor... success
MSG: StepDir2, init model TMC2130 SPI u-step mode 16X (goto mode OFF)
MSG: TmcDriver, init RSENSE=0.13
MSG: SoftSpi, init MOSI=13, SCK=14, CS=5, MISO=4
MSG: StepDir2, TMC Ihold=150mA, Irun=300mA, Igoto=300mA
MSG: StepDir2, TMC standstill automatic current calibration
MSG: StepDir2, sequencer homes every 1 step(s)
MSG: Mount, site get Latitude/Longitude from NV
MSG: TLS, start NTP monitor task (rate 5 min priority 7)... success
MSG: Site, falling back to Date/Time from NV
MSG: Mount, site start sidereal timer task (rate 10ms priority 0)... success
MSG: Mount, type GEM
MSG: Mount, reset at home and in standby
MSG: Mount, limits start monitor task (rate 100ms priority 2)... success
MSG: Mount, start guide monitor task (rate 2500us priority 3)... success
MSG: Mount, library allocated 204 catalog records
MSG: Mount, PEC allocated buffer 600 bytes
MSG: Mount, PEC start monitor task (rate 10ms priority 3)... success
MSG: Mount, start tracking monitor task (rate 1000ms priority 6)... success
MSG: Setup, start command channel A task (priority 5)... success
MSG: Setup, start command channel PIP1 task (priority 5)... success
MSG: Setup, start command channel PIP2 task (priority 5)... success
MSG: Setup, start command channel PIP3 task (priority 5)... success
MSG: Setup, start command channel IP task (priority 5)... success
MSG: Setup, start command channel Local task (priority 5)... success
MSG: WiFi, Master Pwd  = password
MSG: WiFi, AP Enable   = 0
MSG: WiFi, AP Fallback = 1
MSG: WiFi, AP SSID     = OnStepX
MSG: WiFi, AP PWD      = password
MSG: WiFi, AP CH       = 7
MSG: WiFi, AP IP       = 192.168.0.1
MSG: WiFi, AP GATEWAY  = 192.168.0.1
MSG: WiFi, AP SN       = 255.255.255.0
MSG: WiFi, Sta Enable  = 1
MSG: WiFi, Station#    = 1
MSG: WiFi, Sta DHCP En = 0
MSG: WiFi, Sta SSID    = XXXXX
MSG: WiFi, Sta PWD     = XXXXX
MSG: WiFi, Sta IP      = XXXX
MSG: WiFi, Sta GATEWAY = 192.168.1.1
MSG: WiFi, Sta SN      = 255.255.255.0
MSG: WiFi, Sta TARGET  = 192.168.0.1
MSG: WiFi, starting Station
MSG: WiFi, initialized
MSG: WiFi, started IP commandServer on port 9996
MSG: WiFi, started IP commandServer on port 9997
MSG: WiFi, started IP commandServer on port 9998
MSG: WiFi, started IP commandServer on port 9999
MSG: TLS, transmit NTP Request
MSG: TLS, receive NTP Response
1656257544
MSG: TLS, next NTP query in 24 hours
MSG: cmdA = GC, reply = 06/24/22#

I added some debug to read what comes from NTP server, and 1656257544 is a Unix timestamp in seconds which seems to be correct (it's Sunday, 26 June 2022 15:32:24, you can check with https://www.epochconverter.com/).
But after it receives time, I request the date from the controller with :GC# command, and it responses 24th of June, last time I set date/time from the mobile app.

It seems like NTP does not set controller time. I tried to compare code with the GPS source, but everything looks good for me.
Could you please check what could be a problem?

@simonachmueller
Copy link
Contributor Author

Ah, I think I see the problem, it's around MSG: Site, falling back to Date/Time from NV
In the Site.cpp, you have a special task gpsCheck to wait for GPS, but not such for NTP. Let me check if I can come up with something for that.

@simonachmueller
Copy link
Contributor Author

I fixed it, added task in the Site.cpp to wait until the NTP time location source is ready. Quite a copy paste from the GPS logic, maybe you can came across a better/generic solution for that.

@simonachmueller
Copy link
Contributor Author

I'll close the issue as it solved for me.

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

1 participant