A GPS disciplined clock

Dependencies:   net lpc1768 crypto clock web log

Revision:
88:2c72beb1debe
Parent:
73:9e4842daf3ae
Child:
98:52506c675c82
--- a/settings/settings.c	Thu Feb 20 15:25:34 2020 +0000
+++ b/settings/settings.c	Wed Feb 26 11:05:11 2020 +0000
@@ -35,6 +35,7 @@
 #include        "tcp.h"
 #include        "web.h"
 #include       "tftp.h"
+#include        "rtc.h"
 
 #define GPREG4 (*((volatile unsigned *) 0x40024054))
 #define ALMON  (*((volatile unsigned *) 0x40024078))
@@ -166,6 +167,14 @@
                DnsSendRequestsViaIp4 = false;
     NtpClientQuerySendRequestsViaIp4 = false;
               TftpSendRequestsViaIp4 = true;
+              
+    if (RtcPowerLost()) 
+    {
+        GPREG4 = 0;
+        ALMON  = 0;
+        ALYEAR = 0;
+        ALDOM  = 0;
+    }
     
     NetTraceHost[1] =  ALYEAR & 0xFF;               //Little endian so low byte
     NetTraceHost[0] = (ALMON << 4) + (ALYEAR >> 8); //high byte