From 7ab5b04fffeb1ea887b25e0dc0196b03ca6b0aa2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Xose=20P=C3=A9rez?= Date: Sun, 9 Dec 2018 21:41:32 +0100 Subject: [PATCH] Option to report time even if no NTP sync (#1310) --- code/espurna/config/general.h | 4 ++++ code/espurna/ntp.ino | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/code/espurna/config/general.h b/code/espurna/config/general.h index 9089a14f..a955ee59 100644 --- a/code/espurna/config/general.h +++ b/code/espurna/config/general.h @@ -1088,6 +1088,10 @@ #define NTP_DST_REGION 0 // 0 for Europe, 1 for USA (defined in NtpClientLib) #endif +#ifndef NTP_WAIT_FOR_SYNC +#define NTP_WAIT_FOR_SYNC 1 // Do not report any datetime until NTP sync'ed +#endif + // ----------------------------------------------------------------------------- // ALEXA // ----------------------------------------------------------------------------- diff --git a/code/espurna/ntp.ino b/code/espurna/ntp.ino index e4949825..8eadb77c 100644 --- a/code/espurna/ntp.ino +++ b/code/espurna/ntp.ino @@ -128,7 +128,11 @@ void _ntpBackwards() { // ----------------------------------------------------------------------------- bool ntpSynced() { - return (NTP.getLastNTPSync() > 0); + #if NTP_WAIT_FOR_SYNC + return (NTP.getLastNTPSync() > 0); + #else + return true; + #endif } String ntpDateTime(time_t t) {