Central Heating controller using the real time clock, PHY module for internet, 1-wire interface for temperature sensors, a system log and a configuration file

Dependencies:   net 1-wire lpc1768 crypto clock web fram log

/media/uploads/andrewboyson/heating.sch

/media/uploads/andrewboyson/heating.brd

/media/uploads/andrewboyson/eagle.epf

Revision:
106:41ed3ea0bbba
Parent:
103:15583327fcdd
--- a/settings/settings.c	Tue Feb 23 20:35:07 2021 +0000
+++ b/settings/settings.c	Fri Apr 23 08:36:42 2021 +0000
@@ -85,6 +85,35 @@
 static int iHttp;
 static int iTftp;
 
+//Values
+static int iValuesServerName;
+void SetValuesServerName(char* value) { FramWrite(iValuesServerName, DNS_MAX_LABEL_LENGTH, value); }
+void GetValuesServerName(char* value) { FramRead (iValuesServerName, DNS_MAX_LABEL_LENGTH, value); value[DNS_MAX_LABEL_LENGTH] = 0; }
+
+static int iValuesFileName;
+void SetValuesFileName(char* value) { FramWrite(iValuesFileName, DNS_MAX_LABEL_LENGTH, value); }
+void GetValuesFileName(char* value) { FramRead (iValuesFileName, DNS_MAX_LABEL_LENGTH, value); value[DNS_MAX_LABEL_LENGTH] = 0; }
+
+static int iValuesWriteSize;
+void SetValuesWriteSize(int* pValue) { FramWrite(iValuesWriteSize, 4, pValue); }
+void GetValuesWriteSize(int* pValue) { FramRead (iValuesWriteSize, 4, pValue); }
+
+static int iValuesReadInterval;
+void SetValuesReadInterval(int* pValue) { FramWrite(iValuesReadInterval, 4, pValue); }
+void GetValuesReadInterval(int* pValue) { FramRead (iValuesReadInterval, 4, pValue); }
+
+static int iValuesStartTime;
+void SetValuesStartTime(int64_t* pValue) { FramWrite(iValuesStartTime, 8, pValue); }
+void GetValuesStartTime(int64_t* pValue) { FramRead (iValuesStartTime, 8, pValue); }
+
+static int iValuesCount;
+void SetValuesCount(int* pValue) { FramWrite(iValuesCount, 4, pValue); }
+void GetValuesCount(int* pValue) { FramRead (iValuesCount, 4, pValue); }
+
+static int iValuesData;
+void GetValuesData(int index, char* pValue) { FramRead (iValuesData +     index, 1, pValue); }
+void SetValuesData(int count, void* pValue) { FramWrite(iValuesData + 8 * count, 8, pValue); }
+
 //Clock settings
 void SetClockSlewDivisor      (int  value) { ClkGovSlewDivisor       = value; FramWrite(iClkGovSlewDivisor,       4, &ClkGovSlewDivisor      ); }
 void SetClockSlewMaxMs        (int  value) { ClkGovSlewChangeMaxMs   = value; FramWrite(iClkGovSlewMaxMs,         4, &ClkGovSlewChangeMaxMs  ); }
@@ -146,8 +175,6 @@
 void ChgTraceHttp      () {       WebTrace        =       !WebTrace       ; FramWrite(iHttp,       1,       &WebTrace       ); }
 void ChgTraceTftp      () {      TftpTrace        =      !TftpTrace       ; FramWrite(iTftp,       1,      &TftpTrace       ); }
 
-
-
 static int iServerName;
 static int iInitialInterval;
 static int iNormalInterval;
@@ -181,6 +208,7 @@
 {
     int address;
     int32_t def4;
+    int64_t def8;
     char b;
     
     def4 =       10; address = FramLoad( 4, &ClkGovSlewDivisor,       &def4);    if (address < 0) return -1; iClkGovSlewDivisor       = address;
@@ -230,5 +258,24 @@
     address = FramLoad( 1, &b, NULL);       WebTrace         = b; if (address < 0) return -1; iHttp        = address;
     address = FramLoad( 1, &b, NULL);      TftpTrace         = b; if (address < 0) return -1; iTftp        = address;
 
+    address = FramAllocate(DNS_MAX_LABEL_LENGTH); if (address < 0) return -1; iValuesServerName   = address;
+    FramAllocate(1); //Spare
+    address = FramAllocate(DNS_MAX_LABEL_LENGTH); if (address < 0) return -1; iValuesFileName     = address;
+    FramAllocate(1); //Spare
+    address = FramAllocate(                   4); if (address < 0) return -1; iValuesWriteSize    = address;
+    address = FramAllocate(                   4); if (address < 0) return -1; iValuesReadInterval = address;
+    address = FramAllocate(                   8); if (address < 0) return -1; iValuesStartTime    = address;
+    address = FramAllocate(                   4); if (address < 0) return -1; iValuesCount        = address;
+    address = FramAllocate(                   1); if (address < 0) return -1; iValuesData         = address;
+    if (FramEmpty)
+    {
+        b    =   0; FramWrite(iValuesServerName  , 1, &b   );
+        b    =   0; FramWrite(iValuesFileName    , 1, &b   );
+        def4 = 100; FramWrite(iValuesWriteSize   , 4, &def4);
+        def4 =  15; FramWrite(iValuesReadInterval, 4, &def4);
+        def8 =   0; FramWrite(iValuesStartTime   , 8, &def8);
+        def4 =   0; FramWrite(iValuesCount       , 4, &def4);
+    }
     return 0;
+    
 }