Skip to content

Commit

Permalink
BugFix: Response callback were not registered if started without WiFi…
Browse files Browse the repository at this point in the history
… connection
  • Loading branch information
gmag11 committed Nov 25, 2020
1 parent d650558 commit 29b8b2a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
4 changes: 2 additions & 2 deletions library.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "ESPNtpClient",
"frameworks": "arduino",
"version": "0.0.2",
"version": "0.0.3",
"keywords": "time, date, hour, minute, second, day, week, month, year, RTC, NTP, millisecond",
"platforms": ["espressif32", "espressif8266"],
"description": "High accuracy NTP client library",
Expand All @@ -16,6 +16,6 @@
"type": "git",
"url": "https://github.com/gmag11/ESPNtpClient.git"
},
"examples": "examples/*/*.ino"
"examples": ["examples/basicExample/basicExample.ino", "examples/advancedExample/advancedExample.ino"]
}

2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=ESPNTPClient
version=0.0.2
version=0.0.3
author=German Martin
maintainer=German Martin
sentence=High accuracy NTP client library
Expand Down
8 changes: 7 additions & 1 deletion src/ESPNtpClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ void NTPClient::processPacket (struct pbuf* packet) {
} else {
actualInterval = longInterval;
}
DEBUGLOG ("Iinterval set to = %d", actualInterval);
DEBUGLOG ("Sync frequency set low");
DEBUGLOG ("Successful NTP sync at %s", getTimeDateString (getLastNTPSync ()));
if (!firstSync.tv_sec) {
Expand Down Expand Up @@ -321,6 +322,8 @@ void NTPClient::getTime () {
}
if (ntpServerIPAddress == INADDR_NONE) {
DEBUGLOG ("IP address unset. Aborting");
actualInterval = shortInterval;
DEBUGLOG ("Set interval to = %d", actualInterval);
if (onSyncEvent)
onSyncEvent (invalidAddress, 0, 0);
return;
Expand Down Expand Up @@ -463,13 +466,15 @@ bool NTPClient::setInterval (int interval) {
DEBUGLOG ("Sync interval set to %d s", interval);
if (syncStatus () == syncd) {
actualInterval = longInterval;
DEBUGLOG ("Set interval to = %d", actualInterval);
}
}
return true;
} else {
longInterval = MIN_NTP_INTERVAL * 1000;
if (syncStatus () == syncd) {
actualInterval = longInterval;
DEBUGLOG ("Set interval to = %d", actualInterval);
}
DEBUGLOG ("Too low value. Sync interval set to minimum: %d s", MIN_NTP_INTERVAL);
return false;
Expand All @@ -487,7 +492,8 @@ bool NTPClient::setInterval (int shortInterval, int longInterval) {

} else {
actualInterval = this->longInterval;
}
}
DEBUGLOG ("Interval set to = %d", actualInterval);
DEBUGLOG ("Short sync interval set to %d s\n", shortInterval);
DEBUGLOG ("Long sync interval set to %d s\n", longInterval);
return true;
Expand Down

0 comments on commit 29b8b2a

Please sign in to comment.