mirror of
https://github.com/richonguzman/LoRa_APRS_iGate.git
synced 2026-03-16 10:14:46 +01:00
Op ntp server
This commit is contained in:
parent
1abaa299e0
commit
2a86cdb0d8
|
|
@ -52,6 +52,7 @@ ____________________________________________________
|
|||
|
||||
# Timeline (Versions):
|
||||
|
||||
- 2025-10-11 User defined NTP server added.
|
||||
- 2025-10-10 Changed Wiki into a pdf manual.
|
||||
- 2025-09-26 Heltec Wireless Bridge support added.
|
||||
- 2025-09-09 MQTT added (pub+sub), Status defined by Op now and many fixes more.
|
||||
|
|
|
|||
|
|
@ -101,6 +101,7 @@
|
|||
"rfOnly": true
|
||||
},
|
||||
"ntp": {
|
||||
"server": "pool.ntp.org",
|
||||
"gmtCorrection": 0.0
|
||||
},
|
||||
"other": {
|
||||
|
|
|
|||
|
|
@ -1990,6 +1990,21 @@
|
|||
</small>
|
||||
</div>
|
||||
<div class="col-lg-9 col-sm-12">
|
||||
<div class="col-12">
|
||||
<label
|
||||
for="ntp.server"
|
||||
class="form-label"
|
||||
>NTP Server hostname</label
|
||||
>
|
||||
<div class="input-group">
|
||||
<input
|
||||
type="text"
|
||||
name="ntp.server"
|
||||
id="ntp.server"
|
||||
class="form-control"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<label
|
||||
for="ntp.gmtCorrection"
|
||||
|
|
|
|||
|
|
@ -241,6 +241,7 @@ function loadSettings(settings) {
|
|||
document.getElementById("remoteManagement.rfOnly").checked = settings.remoteManagement.rfOnly;
|
||||
|
||||
// NTP
|
||||
document.getElementById("ntp.server").value = settings.ntp.server;
|
||||
document.getElementById("ntp.gmtCorrection").value = settings.ntp.gmtCorrection;
|
||||
|
||||
// Experimental
|
||||
|
|
|
|||
|
|
@ -140,6 +140,7 @@ public:
|
|||
|
||||
class NTP {
|
||||
public:
|
||||
String server;
|
||||
float gmtCorrection;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -67,8 +67,8 @@ ___________________________________________________________________*/
|
|||
#endif
|
||||
|
||||
|
||||
String versionDate = "2025-09-26";
|
||||
String versionNumber = "3.1.2.1";
|
||||
String versionDate = "2025-10-11";
|
||||
String versionNumber = "3.1.3";
|
||||
Configuration Config;
|
||||
WiFiClient aprsIsClient;
|
||||
WiFiClient mqttClient;
|
||||
|
|
|
|||
|
|
@ -140,6 +140,7 @@ bool Configuration::writeFile() {
|
|||
data["remoteManagement"]["managers"] = remoteManagement.managers;
|
||||
data["remoteManagement"]["rfOnly"] = remoteManagement.rfOnly;
|
||||
|
||||
data["ntp"]["server"] = ntp.server;
|
||||
data["ntp"]["gmtCorrection"] = ntp.gmtCorrection;
|
||||
|
||||
data["other"]["rebootMode"] = rebootMode;
|
||||
|
|
@ -345,7 +346,9 @@ bool Configuration::readFile() {
|
|||
remoteManagement.managers = data["remoteManagement"]["managers"] | "";
|
||||
remoteManagement.rfOnly = data["remoteManagement"]["rfOnly"] | true;
|
||||
|
||||
if (!data["ntp"].containsKey("gmtCorrection")) needsRewrite = true;
|
||||
if (!data["ntp"].containsKey("server") ||
|
||||
!data["ntp"].containsKey("gmtCorrection")) needsRewrite = true;
|
||||
ntp.server = data["ntp"]["server"] | "pool.ntp.org";
|
||||
ntp.gmtCorrection = data["ntp"]["gmtCorrection"] | 0.0;
|
||||
|
||||
if (!data["other"].containsKey("rebootMode") ||
|
||||
|
|
@ -371,7 +374,7 @@ bool Configuration::readFile() {
|
|||
if (needsRewrite) {
|
||||
Serial.println("Config JSON incomplete, rewriting...");
|
||||
writeFile();
|
||||
delay(500);
|
||||
delay(1000);
|
||||
ESP.restart();
|
||||
}
|
||||
Serial.println("Config read successfuly");
|
||||
|
|
@ -482,6 +485,7 @@ void Configuration::setDefaultValues() {
|
|||
remoteManagement.managers = "";
|
||||
remoteManagement.rfOnly = true;
|
||||
|
||||
ntp.server = "pool.ntp.org";
|
||||
ntp.gmtCorrection = 0.0;
|
||||
|
||||
rebootMode = false;
|
||||
|
|
@ -506,7 +510,7 @@ Configuration::Configuration() {
|
|||
if (!exists) {
|
||||
setDefaultValues();
|
||||
writeFile();
|
||||
delay(500);
|
||||
delay(1000);
|
||||
ESP.restart();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@
|
|||
extern Configuration Config;
|
||||
|
||||
WiFiUDP ntpUDP;
|
||||
NTPClient timeClient(ntpUDP, "pool.ntp.org", 0, 15 * 60 * 1000); // Update interval 15 min
|
||||
NTPClient timeClient(ntpUDP, Config.ntp.server.c_str(), 0, 15 * 60 * 1000); // Update interval 15 min
|
||||
|
||||
|
||||
namespace NTP_Utils {
|
||||
|
|
|
|||
|
|
@ -281,6 +281,7 @@ namespace WEB_Utils {
|
|||
Config.remoteManagement.managers = getParamStringSafe("remoteManagement.managers", Config.remoteManagement.managers);
|
||||
Config.remoteManagement.rfOnly = request->hasParam("remoteManagement.rfOnly", true);
|
||||
|
||||
Config.ntp.server = getParamStringSafe("ntp.server", Config.ntp.server);
|
||||
Config.ntp.gmtCorrection = getParamFloatSafe("ntp.gmtCorrection", Config.ntp.gmtCorrection);
|
||||
|
||||
Config.rememberStationTime = getParamIntSafe("other.rememberStationTime", Config.rememberStationTime);
|
||||
|
|
|
|||
Loading…
Reference in a new issue