Releases: Damien0505/LEDmatrixClock
v3.6.0.1 - NTP server configuration addition
I have added the ability for the user to configure the NTP server used by the clock.
While I understand that this clock does not display high accuracy time, having my own stratum 1 NTP server, I wanted to pull the time locally.
Only three files modified, settings.h, TimeNTP.cpp and LEDmatrixClock.cpp.
Here's a summary of exactly what changed in each:
Settings.h — Added the global variable declaration with a sensible default:
cppString ntpServer = "pool.ntp.org";
TimeNTP.cpp — Replaced the hardcoded static const char ntpServerName[] with an extern reference to the new variable, and updated the two places it was used (hostByName() and Serial.print()) to use ntpServer.c_str().
LEDmatrixClock.cpp — Four changes:
Web form HTML (webChangeForm1) — Added a new "NTP Time Server" fieldset with a text input (name='ntpServer', value='%NTPSVR%') between the OWM config and the weather display options sections.
handleConfigure() — Added form.replace(F("%NTPSVR%"), ntpServer) to populate the field when the page loads.
handleSaveConfig() — Reads the ntpServer arg, trims it, falls back to pool.ntp.org if empty, and if the value actually changed, calls timeNTPsetup() so the new server takes effect immediately without a reboot.
writeConfiguration() / readConfiguration() — Saves and loads ntpServer= in conf.txt so the setting persists across reboots.