Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: 1-wire clock crypto fram log lpc1768 net web wiz mbed
settings/settings.c@5:3579001bea1b, 2021-05-20 (annotated)
- Committer:
- andrewboyson
- Date:
- Thu May 20 14:34:51 2021 +0000
- Revision:
- 5:3579001bea1b
- Parent:
- 3:f1464bf461c1
Added ability for the user to prioritise hot water for showers by allowing a limit on the tank temperature below which the radiator pump stops
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
andrewboyson | 0:22b158d3c76f | 1 | #include <stdbool.h> |
andrewboyson | 0:22b158d3c76f | 2 | #include <stdlib.h> |
andrewboyson | 0:22b158d3c76f | 3 | #include <string.h> |
andrewboyson | 0:22b158d3c76f | 4 | |
andrewboyson | 0:22b158d3c76f | 5 | #include "clkgov.h" |
andrewboyson | 0:22b158d3c76f | 6 | #include "fram.h" |
andrewboyson | 0:22b158d3c76f | 7 | #include "log.h" |
andrewboyson | 0:22b158d3c76f | 8 | #include "net.h" |
andrewboyson | 0:22b158d3c76f | 9 | #include "link.h" |
andrewboyson | 0:22b158d3c76f | 10 | #include "dnsname.h" |
andrewboyson | 0:22b158d3c76f | 11 | #include "dnsquery.h" |
andrewboyson | 0:22b158d3c76f | 12 | #include "dnsreply.h" |
andrewboyson | 0:22b158d3c76f | 13 | #include "dnsserver.h" |
andrewboyson | 0:22b158d3c76f | 14 | #include "dnslabel.h" |
andrewboyson | 0:22b158d3c76f | 15 | #include "ntp.h" |
andrewboyson | 0:22b158d3c76f | 16 | #include "dhcp.h" |
andrewboyson | 0:22b158d3c76f | 17 | #include "ns.h" |
andrewboyson | 0:22b158d3c76f | 18 | #include "nr.h" |
andrewboyson | 0:22b158d3c76f | 19 | #include "ntpclient.h" |
andrewboyson | 0:22b158d3c76f | 20 | #include "1-wire.h" |
andrewboyson | 0:22b158d3c76f | 21 | #include "echo4.h" |
andrewboyson | 0:22b158d3c76f | 22 | #include "echo6.h" |
andrewboyson | 0:22b158d3c76f | 23 | #include "dest6.h" |
andrewboyson | 0:22b158d3c76f | 24 | #include "ra.h" |
andrewboyson | 0:22b158d3c76f | 25 | #include "rs.h" |
andrewboyson | 0:22b158d3c76f | 26 | #include "ar4.h" |
andrewboyson | 0:22b158d3c76f | 27 | #include "ar6.h" |
andrewboyson | 0:22b158d3c76f | 28 | #include "arp.h" |
andrewboyson | 0:22b158d3c76f | 29 | #include "ip4.h" |
andrewboyson | 0:22b158d3c76f | 30 | #include "ip6.h" |
andrewboyson | 0:22b158d3c76f | 31 | #include "udp.h" |
andrewboyson | 0:22b158d3c76f | 32 | #include "tcp.h" |
andrewboyson | 0:22b158d3c76f | 33 | #include "web.h" |
andrewboyson | 0:22b158d3c76f | 34 | #include "tftp.h" |
andrewboyson | 0:22b158d3c76f | 35 | #include "dns.h" |
andrewboyson | 0:22b158d3c76f | 36 | #include "led.h" |
andrewboyson | 3:f1464bf461c1 | 37 | #include "program.h" |
andrewboyson | 0:22b158d3c76f | 38 | #include "wiz.h" |
andrewboyson | 0:22b158d3c76f | 39 | #include "wiz-list.h" |
andrewboyson | 0:22b158d3c76f | 40 | #include "wiz-sched.h" |
andrewboyson | 0:22b158d3c76f | 41 | |
andrewboyson | 0:22b158d3c76f | 42 | static int iClkGovSlewDivisor ; |
andrewboyson | 0:22b158d3c76f | 43 | static int iClkGovSlewMaxMs ; |
andrewboyson | 0:22b158d3c76f | 44 | static int iClkGovPpbDivisor ; |
andrewboyson | 0:22b158d3c76f | 45 | static int iClkGovPpbChangeMax ; |
andrewboyson | 0:22b158d3c76f | 46 | static int iClkGovSyncedLimitNs ; |
andrewboyson | 0:22b158d3c76f | 47 | static int iClkGovSyncedLimitPpb ; |
andrewboyson | 0:22b158d3c76f | 48 | static int iClkGovSyncedHysterisNs ; |
andrewboyson | 0:22b158d3c76f | 49 | static int iClkGovSyncedHysterisPpb; |
andrewboyson | 0:22b158d3c76f | 50 | static int iClkGovMaxOffsetSecs ; |
andrewboyson | 0:22b158d3c76f | 51 | static int iClkGov; |
andrewboyson | 0:22b158d3c76f | 52 | |
andrewboyson | 0:22b158d3c76f | 53 | static int iOneWire; |
andrewboyson | 0:22b158d3c76f | 54 | |
andrewboyson | 0:22b158d3c76f | 55 | static int iDnsSendRequestsViaIp4 ; |
andrewboyson | 0:22b158d3c76f | 56 | static int iNtpSendRequestsViaIp4 ; |
andrewboyson | 0:22b158d3c76f | 57 | static int iTftpSendRequestsViaIp4; |
andrewboyson | 0:22b158d3c76f | 58 | |
andrewboyson | 0:22b158d3c76f | 59 | static int iNetHost; |
andrewboyson | 0:22b158d3c76f | 60 | static int iLogUart; |
andrewboyson | 0:22b158d3c76f | 61 | static int iNetStack; |
andrewboyson | 0:22b158d3c76f | 62 | static int iNetNewLine; |
andrewboyson | 0:22b158d3c76f | 63 | static int iNetVerbose; |
andrewboyson | 0:22b158d3c76f | 64 | static int iLink; |
andrewboyson | 0:22b158d3c76f | 65 | static int iDnsName; |
andrewboyson | 0:22b158d3c76f | 66 | static int iDnsQuery; |
andrewboyson | 0:22b158d3c76f | 67 | static int iDnsReply; |
andrewboyson | 0:22b158d3c76f | 68 | static int iDnsServer; |
andrewboyson | 0:22b158d3c76f | 69 | static int iNtp; |
andrewboyson | 0:22b158d3c76f | 70 | static int iDhcp; |
andrewboyson | 0:22b158d3c76f | 71 | static int iNsRecvSol; |
andrewboyson | 0:22b158d3c76f | 72 | static int iNsRecvAdv; |
andrewboyson | 0:22b158d3c76f | 73 | static int iNsSendSol; |
andrewboyson | 0:22b158d3c76f | 74 | static int iNr4; |
andrewboyson | 0:22b158d3c76f | 75 | static int iNr; |
andrewboyson | 0:22b158d3c76f | 76 | static int iNtpClient; |
andrewboyson | 0:22b158d3c76f | 77 | static int iEcho4; |
andrewboyson | 0:22b158d3c76f | 78 | static int iEcho6; |
andrewboyson | 0:22b158d3c76f | 79 | static int iDest6; |
andrewboyson | 0:22b158d3c76f | 80 | static int iRa; |
andrewboyson | 0:22b158d3c76f | 81 | static int iRs; |
andrewboyson | 0:22b158d3c76f | 82 | static int iAr4; |
andrewboyson | 0:22b158d3c76f | 83 | static int iAr6; |
andrewboyson | 0:22b158d3c76f | 84 | static int iArp; |
andrewboyson | 0:22b158d3c76f | 85 | static int iIp4; |
andrewboyson | 0:22b158d3c76f | 86 | static int iIp6; |
andrewboyson | 0:22b158d3c76f | 87 | static int iUdp; |
andrewboyson | 0:22b158d3c76f | 88 | static int iTcp; |
andrewboyson | 0:22b158d3c76f | 89 | static int iHttp; |
andrewboyson | 0:22b158d3c76f | 90 | static int iTftp; |
andrewboyson | 0:22b158d3c76f | 91 | |
andrewboyson | 0:22b158d3c76f | 92 | //Values |
andrewboyson | 0:22b158d3c76f | 93 | static int iValuesServerName; |
andrewboyson | 0:22b158d3c76f | 94 | void SetValuesServerName(char* value) { FramWrite(iValuesServerName, DNS_MAX_LABEL_LENGTH, value); } |
andrewboyson | 0:22b158d3c76f | 95 | void GetValuesServerName(char* value) { FramRead (iValuesServerName, DNS_MAX_LABEL_LENGTH, value); value[DNS_MAX_LABEL_LENGTH] = 0; } |
andrewboyson | 0:22b158d3c76f | 96 | |
andrewboyson | 0:22b158d3c76f | 97 | static int iValuesFileName; |
andrewboyson | 0:22b158d3c76f | 98 | void SetValuesFileName(char* value) { FramWrite(iValuesFileName, DNS_MAX_LABEL_LENGTH, value); } |
andrewboyson | 0:22b158d3c76f | 99 | void GetValuesFileName(char* value) { FramRead (iValuesFileName, DNS_MAX_LABEL_LENGTH, value); value[DNS_MAX_LABEL_LENGTH] = 0; } |
andrewboyson | 0:22b158d3c76f | 100 | |
andrewboyson | 0:22b158d3c76f | 101 | static int iValuesWriteSize; |
andrewboyson | 0:22b158d3c76f | 102 | void SetValuesWriteSize(int* pValue) { FramWrite(iValuesWriteSize, 4, pValue); } |
andrewboyson | 0:22b158d3c76f | 103 | void GetValuesWriteSize(int* pValue) { FramRead (iValuesWriteSize, 4, pValue); } |
andrewboyson | 0:22b158d3c76f | 104 | |
andrewboyson | 0:22b158d3c76f | 105 | static int iValuesReadInterval; |
andrewboyson | 0:22b158d3c76f | 106 | void SetValuesReadInterval(int* pValue) { FramWrite(iValuesReadInterval, 4, pValue); } |
andrewboyson | 0:22b158d3c76f | 107 | void GetValuesReadInterval(int* pValue) { FramRead (iValuesReadInterval, 4, pValue); } |
andrewboyson | 0:22b158d3c76f | 108 | |
andrewboyson | 0:22b158d3c76f | 109 | static int iValuesStartTime; |
andrewboyson | 0:22b158d3c76f | 110 | void SetValuesStartTime(int64_t* pValue) { FramWrite(iValuesStartTime, 8, pValue); } |
andrewboyson | 0:22b158d3c76f | 111 | void GetValuesStartTime(int64_t* pValue) { FramRead (iValuesStartTime, 8, pValue); } |
andrewboyson | 0:22b158d3c76f | 112 | |
andrewboyson | 0:22b158d3c76f | 113 | static int iValuesCount; |
andrewboyson | 0:22b158d3c76f | 114 | void SetValuesCount(int* pValue) { FramWrite(iValuesCount, 4, pValue); } |
andrewboyson | 0:22b158d3c76f | 115 | void GetValuesCount(int* pValue) { FramRead (iValuesCount, 4, pValue); } |
andrewboyson | 0:22b158d3c76f | 116 | |
andrewboyson | 0:22b158d3c76f | 117 | static int iValuesData; |
andrewboyson | 0:22b158d3c76f | 118 | void GetValuesData(int index, char* pValue) { FramRead (iValuesData + index, 1, pValue); } |
andrewboyson | 0:22b158d3c76f | 119 | void SetValuesData(int count, void* pValue) { FramWrite(iValuesData + 8 * count, 8, pValue); } |
andrewboyson | 0:22b158d3c76f | 120 | |
andrewboyson | 0:22b158d3c76f | 121 | //Wiz settings |
andrewboyson | 0:22b158d3c76f | 122 | static int iWizTrace; |
andrewboyson | 0:22b158d3c76f | 123 | static int iWizMacs [WIZ_LIST_MAX_ITEMS]; |
andrewboyson | 0:22b158d3c76f | 124 | static int iWizNames [WIZ_LIST_MAX_ITEMS]; |
andrewboyson | 0:22b158d3c76f | 125 | static int iWizRooms [WIZ_LIST_MAX_ITEMS]; |
andrewboyson | 0:22b158d3c76f | 126 | static int iWizSchedNames [WIZ_SCHED_MAX_ITEMS]; |
andrewboyson | 0:22b158d3c76f | 127 | static int iWizSchedOnDatums [WIZ_SCHED_MAX_ITEMS]; |
andrewboyson | 0:22b158d3c76f | 128 | static int iWizSchedOnMinutes [WIZ_SCHED_MAX_ITEMS]; |
andrewboyson | 0:22b158d3c76f | 129 | static int iWizSchedOffDatums [WIZ_SCHED_MAX_ITEMS]; |
andrewboyson | 0:22b158d3c76f | 130 | static int iWizSchedOffMinutes[WIZ_SCHED_MAX_ITEMS]; |
andrewboyson | 0:22b158d3c76f | 131 | |
andrewboyson | 0:22b158d3c76f | 132 | void ChgTraceWiz () { WizTrace = !WizTrace; FramWrite(iWizTrace, 1, &WizTrace); } |
andrewboyson | 0:22b158d3c76f | 133 | void SetWizListMac (int i, char* pMac ) { FramWrite(iWizMacs [i], 6, pMac ); } |
andrewboyson | 0:22b158d3c76f | 134 | void GetWizListMac (int i, char* pMac ) { FramRead (iWizMacs [i], 6, pMac ); } |
andrewboyson | 0:22b158d3c76f | 135 | void SetWizListName (int i, char* pText ) { FramWrite(iWizNames [i], WIZ_LIST_NAME_LENGTH, pText ); } |
andrewboyson | 0:22b158d3c76f | 136 | void GetWizListName (int i, char* pText ) { FramRead (iWizNames [i], WIZ_LIST_NAME_LENGTH, pText ); } |
andrewboyson | 0:22b158d3c76f | 137 | void SetWizListRoom (int i, char* pText ) { FramWrite(iWizRooms [i], WIZ_LIST_NAME_LENGTH, pText ); } |
andrewboyson | 0:22b158d3c76f | 138 | void GetWizListRoom (int i, char* pText ) { FramRead (iWizRooms [i], WIZ_LIST_NAME_LENGTH, pText ); } |
andrewboyson | 0:22b158d3c76f | 139 | void SetWizSchedName (int i, char* pText ) { FramWrite(iWizSchedNames [i], WIZ_LIST_NAME_LENGTH, pText ); } |
andrewboyson | 0:22b158d3c76f | 140 | void GetWizSchedName (int i, char* pText ) { FramRead (iWizSchedNames [i], WIZ_LIST_NAME_LENGTH, pText ); } |
andrewboyson | 0:22b158d3c76f | 141 | void SetWizSchedOnDatum (int i, char* pDatum ) { FramWrite(iWizSchedOnDatums [i], 1, pDatum ); } |
andrewboyson | 0:22b158d3c76f | 142 | void GetWizSchedOnDatum (int i, char* pDatum ) { FramRead (iWizSchedOnDatums [i], 1, pDatum ); } |
andrewboyson | 0:22b158d3c76f | 143 | void SetWizSchedOnMinutes (int i, int16_t* pMinutes) { FramWrite(iWizSchedOnMinutes [i], 2, pMinutes); } |
andrewboyson | 0:22b158d3c76f | 144 | void GetWizSchedOnMinutes (int i, int16_t* pMinutes) { FramRead (iWizSchedOnMinutes [i], 2, pMinutes); } |
andrewboyson | 0:22b158d3c76f | 145 | void SetWizSchedOffDatum (int i, char* pDatum ) { FramWrite(iWizSchedOffDatums [i], 1, pDatum ); } |
andrewboyson | 0:22b158d3c76f | 146 | void GetWizSchedOffDatum (int i, char* pDatum ) { FramRead (iWizSchedOffDatums [i], 1, pDatum ); } |
andrewboyson | 0:22b158d3c76f | 147 | void SetWizSchedOffMinutes(int i, int16_t* pMinutes) { FramWrite(iWizSchedOffMinutes[i], 2, pMinutes); } |
andrewboyson | 0:22b158d3c76f | 148 | void GetWizSchedOffMinutes(int i, int16_t* pMinutes) { FramRead (iWizSchedOffMinutes[i], 2, pMinutes); } |
andrewboyson | 0:22b158d3c76f | 149 | |
andrewboyson | 0:22b158d3c76f | 150 | //Clock settings |
andrewboyson | 0:22b158d3c76f | 151 | void SetClockSlewDivisor (int value) { ClkGovSlewDivisor = value; FramWrite(iClkGovSlewDivisor, 4, &ClkGovSlewDivisor ); } |
andrewboyson | 0:22b158d3c76f | 152 | void SetClockSlewMaxMs (int value) { ClkGovSlewChangeMaxMs = value; FramWrite(iClkGovSlewMaxMs, 4, &ClkGovSlewChangeMaxMs ); } |
andrewboyson | 0:22b158d3c76f | 153 | void SetClockPpbDivisor (int value) { ClkGovFreqDivisor = value; FramWrite(iClkGovPpbDivisor, 4, &ClkGovFreqDivisor ); } |
andrewboyson | 0:22b158d3c76f | 154 | void SetClockPpbChangeMax (int value) { ClkGovFreqChangeMaxPpb = value; FramWrite(iClkGovPpbChangeMax, 4, &ClkGovFreqChangeMaxPpb ); } |
andrewboyson | 0:22b158d3c76f | 155 | void SetClockSyncedLimitNs (int value) { ClkGovSlewSyncedLimNs = value; FramWrite(iClkGovSyncedLimitNs, 4, &ClkGovSlewSyncedLimNs ); } |
andrewboyson | 0:22b158d3c76f | 156 | void SetClockSyncedLimitPpb (int value) { ClkGovFreqSyncedLimPpb = value; FramWrite(iClkGovSyncedLimitPpb, 4, &ClkGovFreqSyncedLimPpb ); } |
andrewboyson | 0:22b158d3c76f | 157 | void SetClockSyncedHysterisNs (int value) { ClkGovSlewSyncedHysNs = value; FramWrite(iClkGovSyncedHysterisNs, 4, &ClkGovSlewSyncedHysNs ); } |
andrewboyson | 0:22b158d3c76f | 158 | void SetClockSyncedHysterisPpb(int value) { ClkGovFreqSyncedHysPpb = value; FramWrite(iClkGovSyncedHysterisPpb, 4, &ClkGovFreqSyncedHysPpb ); } |
andrewboyson | 0:22b158d3c76f | 159 | void SetClockMaxOffsetSecs (int value) { ClkGovSlewOffsetMaxSecs = value; FramWrite(iClkGovMaxOffsetSecs, 4, &ClkGovSlewOffsetMaxSecs); } |
andrewboyson | 0:22b158d3c76f | 160 | void ChgTraceSync () { ClkGovTrace = !ClkGovTrace ; FramWrite(iClkGov, 1, &ClkGovTrace ); } |
andrewboyson | 0:22b158d3c76f | 161 | |
andrewboyson | 0:22b158d3c76f | 162 | //Log settings |
andrewboyson | 0:22b158d3c76f | 163 | void ChgLogUart () { LogUart = !LogUart; FramWrite(iLogUart, 1, &LogUart ); } |
andrewboyson | 0:22b158d3c76f | 164 | |
andrewboyson | 0:22b158d3c76f | 165 | //Heating settings |
andrewboyson | 0:22b158d3c76f | 166 | void ChgTraceOneWire () { OneWireTrace = !OneWireTrace ; FramWrite(iOneWire, 1, &OneWireTrace ); } |
andrewboyson | 0:22b158d3c76f | 167 | |
andrewboyson | 0:22b158d3c76f | 168 | //Net settings |
andrewboyson | 0:22b158d3c76f | 169 | void ChgDnsSendRequestsViaIp4 () { DnsSendRequestsViaIp4 = !DnsSendRequestsViaIp4; FramWrite( iDnsSendRequestsViaIp4, 1, &DnsSendRequestsViaIp4); } |
andrewboyson | 0:22b158d3c76f | 170 | void ChgNtpSendRequestsViaIp4 () { NtpClientQuerySendRequestsViaIp4 = !NtpClientQuerySendRequestsViaIp4; FramWrite( iNtpSendRequestsViaIp4, 1, &NtpClientQuerySendRequestsViaIp4); } |
andrewboyson | 0:22b158d3c76f | 171 | void ChgTftpSendRequestsViaIp4 () { TftpSendRequestsViaIp4 = !TftpSendRequestsViaIp4; FramWrite(iTftpSendRequestsViaIp4, 1, &TftpSendRequestsViaIp4); } |
andrewboyson | 0:22b158d3c76f | 172 | |
andrewboyson | 0:22b158d3c76f | 173 | void SetTraceNetHost (char* text) |
andrewboyson | 0:22b158d3c76f | 174 | { |
andrewboyson | 0:22b158d3c76f | 175 | int value = strtol(text, NULL, 16); |
andrewboyson | 0:22b158d3c76f | 176 | NetTraceHost[1] = value & 0xFF; |
andrewboyson | 0:22b158d3c76f | 177 | NetTraceHost[0] = (value >> 8) & 0xFF; |
andrewboyson | 0:22b158d3c76f | 178 | FramWrite(iNetHost, 2, NetTraceHost); |
andrewboyson | 0:22b158d3c76f | 179 | } |
andrewboyson | 0:22b158d3c76f | 180 | void ChgTraceNetStack () { NetTraceStack = !NetTraceStack; FramWrite(iNetStack, 1, &NetTraceStack ); } |
andrewboyson | 0:22b158d3c76f | 181 | void ChgTraceNetNewLine() { NetTraceNewLine = !NetTraceNewLine; FramWrite(iNetNewLine, 1, &NetTraceNewLine); } |
andrewboyson | 0:22b158d3c76f | 182 | void ChgTraceNetVerbose() { NetTraceVerbose = !NetTraceVerbose; FramWrite(iNetVerbose, 1, &NetTraceVerbose); } |
andrewboyson | 0:22b158d3c76f | 183 | void ChgTraceLink () { LinkTrace = !LinkTrace; FramWrite(iLink, 1, &LinkTrace ); } |
andrewboyson | 0:22b158d3c76f | 184 | void ChgTraceDnsName () { DnsNameTrace = !DnsNameTrace; FramWrite(iDnsName, 1, &DnsNameTrace ); } |
andrewboyson | 0:22b158d3c76f | 185 | void ChgTraceDnsQuery () { DnsQueryTrace = !DnsQueryTrace; FramWrite(iDnsQuery, 1, &DnsQueryTrace ); } |
andrewboyson | 0:22b158d3c76f | 186 | void ChgTraceDnsReply () { DnsReplyTrace = !DnsReplyTrace; FramWrite(iDnsReply, 1, &DnsReplyTrace ); } |
andrewboyson | 0:22b158d3c76f | 187 | void ChgTraceDnsServer () { DnsServerTrace = !DnsServerTrace; FramWrite(iDnsServer, 1, &DnsServerTrace ); } |
andrewboyson | 0:22b158d3c76f | 188 | void ChgTraceNtp () { NtpTrace = !NtpTrace; FramWrite(iNtp, 1, &NtpTrace ); } |
andrewboyson | 0:22b158d3c76f | 189 | void ChgTraceDhcp () { DhcpTrace = !DhcpTrace; FramWrite(iDhcp, 1, &DhcpTrace ); } |
andrewboyson | 0:22b158d3c76f | 190 | void ChgTraceNsRecvSol () { NsTraceRecvSol = !NsTraceRecvSol; FramWrite(iNsRecvSol, 1, &NsTraceRecvSol); } |
andrewboyson | 0:22b158d3c76f | 191 | void ChgTraceNsRecvAdv () { NsTraceRecvAdv = !NsTraceRecvAdv; FramWrite(iNsRecvAdv, 1, &NsTraceRecvAdv); } |
andrewboyson | 0:22b158d3c76f | 192 | void ChgTraceNsSendSol () { NsTraceSendSol = !NsTraceSendSol; FramWrite(iNsSendSol, 1, &NsTraceSendSol); } |
andrewboyson | 0:22b158d3c76f | 193 | void ChgTraceNr4 () { Nr4Trace = !Nr4Trace ; FramWrite(iNr4, 1, &Nr4Trace ); } |
andrewboyson | 0:22b158d3c76f | 194 | void ChgTraceNr () { NrTrace = !NrTrace ; FramWrite(iNr, 1, &NrTrace ); } |
andrewboyson | 0:22b158d3c76f | 195 | void ChgTraceNtpClient () { NtpClientTrace = !NtpClientTrace ; FramWrite(iNtpClient, 1, &NtpClientTrace ); } |
andrewboyson | 0:22b158d3c76f | 196 | void ChgTraceEcho4 () { Echo4Trace = !Echo4Trace ; FramWrite(iEcho4, 1, &Echo4Trace ); } |
andrewboyson | 0:22b158d3c76f | 197 | void ChgTraceEcho6 () { Echo6Trace = !Echo6Trace ; FramWrite(iEcho6, 1, &Echo6Trace ); } |
andrewboyson | 0:22b158d3c76f | 198 | void ChgTraceDest6 () { Dest6Trace = !Dest6Trace ; FramWrite(iDest6, 1, &Dest6Trace ); } |
andrewboyson | 0:22b158d3c76f | 199 | void ChgTraceRa () { RaTrace = !RaTrace ; FramWrite(iRa, 1, &RaTrace ); } |
andrewboyson | 0:22b158d3c76f | 200 | void ChgTraceRs () { RsTrace = !RsTrace ; FramWrite(iRs, 1, &RsTrace ); } |
andrewboyson | 0:22b158d3c76f | 201 | void ChgTraceAr4 () { Ar4Trace = !Ar4Trace ; FramWrite(iAr4, 1, &Ar4Trace ); } |
andrewboyson | 0:22b158d3c76f | 202 | void ChgTraceAr6 () { Ar6Trace = !Ar6Trace ; FramWrite(iAr6, 1, &Ar6Trace ); } |
andrewboyson | 0:22b158d3c76f | 203 | void ChgTraceArp () { ArpTrace = !ArpTrace ; FramWrite(iArp, 1, &ArpTrace ); } |
andrewboyson | 0:22b158d3c76f | 204 | void ChgTraceIp4 () { Ip4Trace = !Ip4Trace ; FramWrite(iIp4, 1, &Ip4Trace ); } |
andrewboyson | 0:22b158d3c76f | 205 | void ChgTraceIp6 () { Ip6Trace = !Ip6Trace ; FramWrite(iIp6, 1, &Ip6Trace ); } |
andrewboyson | 0:22b158d3c76f | 206 | void ChgTraceUdp () { UdpTrace = !UdpTrace ; FramWrite(iUdp, 1, &UdpTrace ); } |
andrewboyson | 0:22b158d3c76f | 207 | void ChgTraceTcp () { TcpTrace = !TcpTrace ; FramWrite(iTcp, 1, &TcpTrace ); } |
andrewboyson | 0:22b158d3c76f | 208 | void ChgTraceHttp () { WebTrace = !WebTrace ; FramWrite(iHttp, 1, &WebTrace ); } |
andrewboyson | 0:22b158d3c76f | 209 | void ChgTraceTftp () { TftpTrace = !TftpTrace ; FramWrite(iTftp, 1, &TftpTrace ); } |
andrewboyson | 0:22b158d3c76f | 210 | |
andrewboyson | 0:22b158d3c76f | 211 | static int iServerName; |
andrewboyson | 0:22b158d3c76f | 212 | static int iInitialInterval; |
andrewboyson | 0:22b158d3c76f | 213 | static int iNormalInterval; |
andrewboyson | 0:22b158d3c76f | 214 | static int iRetryInterval; |
andrewboyson | 0:22b158d3c76f | 215 | static int iOffsetMs; |
andrewboyson | 0:22b158d3c76f | 216 | static int iMaxDelayMs; |
andrewboyson | 0:22b158d3c76f | 217 | |
andrewboyson | 0:22b158d3c76f | 218 | void SetNtpClientServerName ( char* value) { DnsLabelCopy(NtpClientQueryServerName, value); FramWrite(iServerName, DNS_MAX_LABEL_LENGTH, NtpClientQueryServerName ); } |
andrewboyson | 0:22b158d3c76f | 219 | void SetNtpClientInitialInterval ( int value) { NtpClientQueryInitialInterval = (int32_t)value ; FramWrite(iInitialInterval, 4, &NtpClientQueryInitialInterval ); } |
andrewboyson | 0:22b158d3c76f | 220 | void SetNtpClientNormalInterval ( int value) { NtpClientQueryNormalInterval = (int32_t)value ; FramWrite(iNormalInterval, 4, &NtpClientQueryNormalInterval ); } |
andrewboyson | 0:22b158d3c76f | 221 | void SetNtpClientRetryInterval ( int value) { NtpClientQueryRetryInterval = (int32_t)value ; FramWrite(iRetryInterval, 4, &NtpClientQueryRetryInterval ); } |
andrewboyson | 0:22b158d3c76f | 222 | void SetNtpClientOffsetMs ( int value) { NtpClientReplyOffsetMs = (int32_t)value ; FramWrite(iOffsetMs, 4, &NtpClientReplyOffsetMs ); } |
andrewboyson | 0:22b158d3c76f | 223 | void SetNtpClientMaxDelayMs ( int value) { NtpClientReplyMaxDelayMs = (int32_t)value ; FramWrite(iMaxDelayMs, 4, &NtpClientReplyMaxDelayMs ); } |
andrewboyson | 0:22b158d3c76f | 224 | |
andrewboyson | 3:f1464bf461c1 | 225 | static int iTankRom; |
andrewboyson | 3:f1464bf461c1 | 226 | static int iOutputRom; |
andrewboyson | 3:f1464bf461c1 | 227 | static int iReturnRom; |
andrewboyson | 3:f1464bf461c1 | 228 | static int iFullSpeedSecs; |
andrewboyson | 3:f1464bf461c1 | 229 | static int iTankSetPoint; |
andrewboyson | 3:f1464bf461c1 | 230 | static int iTankHysteresis; |
andrewboyson | 3:f1464bf461c1 | 231 | static int iRunOnDeltaT; |
andrewboyson | 3:f1464bf461c1 | 232 | static int iRunOnTime2s; |
andrewboyson | 3:f1464bf461c1 | 233 | static int iPumpSpeedCalling; |
andrewboyson | 3:f1464bf461c1 | 234 | static int iRampDownTime; |
andrewboyson | 3:f1464bf461c1 | 235 | static int iBoilerTarget; |
andrewboyson | 3:f1464bf461c1 | 236 | static int iMinSpeed; |
andrewboyson | 3:f1464bf461c1 | 237 | static int iMidSpeedPwm; |
andrewboyson | 3:f1464bf461c1 | 238 | static int iFullSpeedDeltaT; |
andrewboyson | 3:f1464bf461c1 | 239 | |
andrewboyson | 3:f1464bf461c1 | 240 | static int iWinter; |
andrewboyson | 3:f1464bf461c1 | 241 | static int iHallRom; |
andrewboyson | 3:f1464bf461c1 | 242 | static int iOverrideCancelHour; |
andrewboyson | 3:f1464bf461c1 | 243 | static int iOverrideCancelMinute; |
andrewboyson | 5:3579001bea1b | 244 | static int iHotWaterProtectTemp; |
andrewboyson | 5:3579001bea1b | 245 | static int iHotWaterProtectOn; |
andrewboyson | 3:f1464bf461c1 | 246 | static int iNightTemperature; |
andrewboyson | 3:f1464bf461c1 | 247 | static int iFrostTemperature; |
andrewboyson | 3:f1464bf461c1 | 248 | |
andrewboyson | 3:f1464bf461c1 | 249 | static int iProgramDay; |
andrewboyson | 3:f1464bf461c1 | 250 | static int iPrograms; |
andrewboyson | 3:f1464bf461c1 | 251 | static int iProgramNewDayHour; |
andrewboyson | 3:f1464bf461c1 | 252 | |
andrewboyson | 3:f1464bf461c1 | 253 | static int iHotWaterRom; |
andrewboyson | 3:f1464bf461c1 | 254 | |
andrewboyson | 3:f1464bf461c1 | 255 | void SetTankRom (char* value) { FramWrite(iTankRom, 8, value); } |
andrewboyson | 3:f1464bf461c1 | 256 | void GetTankRom (char* value) { FramRead (iTankRom, 8, value); } |
andrewboyson | 3:f1464bf461c1 | 257 | void SetOutputRom (char* value) { FramWrite(iOutputRom, 8, value); } |
andrewboyson | 3:f1464bf461c1 | 258 | void GetOutputRom (char* value) { FramRead (iOutputRom, 8, value); } |
andrewboyson | 3:f1464bf461c1 | 259 | void SetReturnRom (char* value) { FramWrite(iReturnRom, 8, value); } |
andrewboyson | 3:f1464bf461c1 | 260 | void GetReturnRom (char* value) { FramRead (iReturnRom, 8, value); } |
andrewboyson | 3:f1464bf461c1 | 261 | void SetBoilerFullSpeedSecs (int8_t* pValue) { FramWrite(iFullSpeedSecs, 1, pValue); } |
andrewboyson | 3:f1464bf461c1 | 262 | void GetBoilerFullSpeedSecs (int8_t* pValue) { FramRead (iFullSpeedSecs, 1, pValue); } |
andrewboyson | 3:f1464bf461c1 | 263 | void SetTankSetPoint (int8_t* pValue) { FramWrite(iTankSetPoint, 1, pValue); } |
andrewboyson | 3:f1464bf461c1 | 264 | void GetTankSetPoint (int8_t* pValue) { FramRead (iTankSetPoint, 1, pValue); } |
andrewboyson | 3:f1464bf461c1 | 265 | void SetTankHysteresis (int16_t* pValue) { FramWrite(iTankHysteresis, 2, pValue); } |
andrewboyson | 3:f1464bf461c1 | 266 | void GetTankHysteresis (int16_t* pValue) { FramRead (iTankHysteresis, 2, pValue); } |
andrewboyson | 3:f1464bf461c1 | 267 | void SetBoilerRunOnDeltaT (int16_t* pValue) { FramWrite(iRunOnDeltaT, 2, pValue); } |
andrewboyson | 3:f1464bf461c1 | 268 | void GetBoilerRunOnDeltaT (int16_t* pValue) { FramRead (iRunOnDeltaT, 2, pValue); } |
andrewboyson | 3:f1464bf461c1 | 269 | void SetBoilerRunOnTime2s (uint8_t* pValue) { FramWrite(iRunOnTime2s, 1, pValue); } |
andrewboyson | 3:f1464bf461c1 | 270 | void GetBoilerRunOnTime2s (uint8_t* pValue) { FramRead (iRunOnTime2s, 1, pValue); } |
andrewboyson | 3:f1464bf461c1 | 271 | void SetBoilerPumpSpeedCalling(int8_t* pValue) { FramWrite(iPumpSpeedCalling, 1, pValue); } |
andrewboyson | 3:f1464bf461c1 | 272 | void GetBoilerPumpSpeedCalling(int8_t* pValue) { FramRead (iPumpSpeedCalling, 1, pValue); } |
andrewboyson | 3:f1464bf461c1 | 273 | void SetBoilerRampDownTime (int8_t* pValue) { FramWrite(iRampDownTime, 1, pValue); } |
andrewboyson | 3:f1464bf461c1 | 274 | void GetBoilerRampDownTime (int8_t* pValue) { FramRead (iRampDownTime, 1, pValue); } |
andrewboyson | 3:f1464bf461c1 | 275 | void SetBoilerTarget (int8_t* pValue) { FramWrite(iBoilerTarget, 1, pValue); } |
andrewboyson | 3:f1464bf461c1 | 276 | void GetBoilerTarget (int8_t* pValue) { FramRead (iBoilerTarget, 1, pValue); } |
andrewboyson | 3:f1464bf461c1 | 277 | void SetBoilerMinSpeed (int8_t* pValue) { FramWrite(iMinSpeed, 1, pValue); } |
andrewboyson | 3:f1464bf461c1 | 278 | void GetBoilerMinSpeed (int8_t* pValue) { FramRead (iMinSpeed, 1, pValue); } |
andrewboyson | 3:f1464bf461c1 | 279 | void SetBoilerMidSpeedPwm (int8_t* pValue) { FramWrite(iMidSpeedPwm, 1, pValue); } |
andrewboyson | 3:f1464bf461c1 | 280 | void GetBoilerMidSpeedPwm (int8_t* pValue) { FramRead (iMidSpeedPwm, 1, pValue); } |
andrewboyson | 3:f1464bf461c1 | 281 | void SetBoilerFullSpeedDeltaT (int16_t* pValue) { FramWrite(iFullSpeedDeltaT, 2, pValue); } |
andrewboyson | 3:f1464bf461c1 | 282 | void GetBoilerFullSpeedDeltaT (int16_t* pValue) { FramRead (iFullSpeedDeltaT, 2, pValue); } |
andrewboyson | 3:f1464bf461c1 | 283 | void SetRadiatorWinter (char* pValue) { FramWrite(iWinter, 1, pValue); } |
andrewboyson | 3:f1464bf461c1 | 284 | void GetRadiatorWinter (char* pValue) { FramRead (iWinter, 1, pValue); } |
andrewboyson | 3:f1464bf461c1 | 285 | void SetHallRom (char* value) { FramWrite(iHallRom, 8, value); } |
andrewboyson | 3:f1464bf461c1 | 286 | void GetHallRom (char* value) { FramRead (iHallRom, 8, value); } |
andrewboyson | 3:f1464bf461c1 | 287 | void SetOverrideCancelHour (uint8_t* pValue) { FramWrite(iOverrideCancelHour, 1, pValue); } |
andrewboyson | 3:f1464bf461c1 | 288 | void GetOverrideCancelHour (uint8_t* pValue) { FramRead (iOverrideCancelHour, 1, pValue); } |
andrewboyson | 3:f1464bf461c1 | 289 | void SetOverrideCancelMinute (uint8_t* pValue) { FramWrite(iOverrideCancelMinute, 1, pValue); } |
andrewboyson | 3:f1464bf461c1 | 290 | void GetOverrideCancelMinute (uint8_t* pValue) { FramRead (iOverrideCancelMinute, 1, pValue); } |
andrewboyson | 5:3579001bea1b | 291 | void SetHotWaterProtectTemp (int8_t* pValue) { FramWrite(iHotWaterProtectTemp, 1, pValue); } |
andrewboyson | 5:3579001bea1b | 292 | void GetHotWaterProtectTemp (int8_t* pValue) { FramRead (iHotWaterProtectTemp, 1, pValue); } |
andrewboyson | 5:3579001bea1b | 293 | void SetHotWaterProtectOn (char* pValue) { FramWrite(iHotWaterProtectOn, 1, pValue); } |
andrewboyson | 5:3579001bea1b | 294 | void GetHotWaterProtectOn (char* pValue) { FramRead (iHotWaterProtectOn, 1, pValue); } |
andrewboyson | 3:f1464bf461c1 | 295 | void SetNightTemperature (int16_t* pValue) { FramWrite(iNightTemperature, 2, pValue); } |
andrewboyson | 3:f1464bf461c1 | 296 | void GetNightTemperature (int16_t* pValue) { FramRead (iNightTemperature, 2, pValue); } |
andrewboyson | 3:f1464bf461c1 | 297 | void SetFrostTemperature (int16_t* pValue) { FramWrite(iFrostTemperature, 2, pValue); } |
andrewboyson | 3:f1464bf461c1 | 298 | void GetFrostTemperature (int16_t* pValue) { FramRead (iFrostTemperature, 2, pValue); } |
andrewboyson | 3:f1464bf461c1 | 299 | |
andrewboyson | 3:f1464bf461c1 | 300 | void SetProgramDay (int index, char* pValue) { FramWrite(iProgramDay + index, 1, pValue); } |
andrewboyson | 3:f1464bf461c1 | 301 | void GetProgramDay (int index, char* pValue) { FramRead (iProgramDay + index, 1, pValue); } |
andrewboyson | 3:f1464bf461c1 | 302 | void SetProgram (int index, int16_t* pValue) { FramWrite(iPrograms + index * 8, 8, pValue); } |
andrewboyson | 3:f1464bf461c1 | 303 | void GetProgram (int index, int16_t* pValue) { FramRead (iPrograms + index * 8, 8, pValue); } |
andrewboyson | 3:f1464bf461c1 | 304 | void SetProgramNewDayHour (char* pValue) { FramWrite(iProgramNewDayHour, 1, pValue); } |
andrewboyson | 3:f1464bf461c1 | 305 | void GetProgramNewDayHour (char* pValue) { FramRead (iProgramNewDayHour, 1, pValue); } |
andrewboyson | 3:f1464bf461c1 | 306 | |
andrewboyson | 3:f1464bf461c1 | 307 | void SetHotWaterRom (char* value) { FramWrite(iHotWaterRom, 8, value); } |
andrewboyson | 3:f1464bf461c1 | 308 | void GetHotWaterRom (char* value) { FramRead (iHotWaterRom, 8, value); } |
andrewboyson | 3:f1464bf461c1 | 309 | |
andrewboyson | 3:f1464bf461c1 | 310 | int SettingsInit() |
andrewboyson | 0:22b158d3c76f | 311 | { |
andrewboyson | 0:22b158d3c76f | 312 | int address; |
andrewboyson | 3:f1464bf461c1 | 313 | char b; |
andrewboyson | 3:f1464bf461c1 | 314 | int8_t def1; |
andrewboyson | 3:f1464bf461c1 | 315 | int16_t def2; |
andrewboyson | 0:22b158d3c76f | 316 | int32_t def4; |
andrewboyson | 3:f1464bf461c1 | 317 | int64_t def8; |
andrewboyson | 3:f1464bf461c1 | 318 | |
andrewboyson | 3:f1464bf461c1 | 319 | if (FramInit()) return -1; //Reserves 1 FRAM byte to detect if empty |
andrewboyson | 3:f1464bf461c1 | 320 | FramAllocate(4); //Reserves 4 FRAM bytes where the watchdog used to hold the last program position |
andrewboyson | 0:22b158d3c76f | 321 | |
andrewboyson | 0:22b158d3c76f | 322 | def4 = 0; address = FramLoad( DNS_MAX_LABEL_LENGTH+1, NtpClientQueryServerName, NULL ); if (address < 0) return -1; iServerName = address; |
andrewboyson | 0:22b158d3c76f | 323 | def4 = 1; address = FramLoad( 4, &NtpClientQueryInitialInterval, &def4); if (address < 0) return -1; iInitialInterval = address; |
andrewboyson | 0:22b158d3c76f | 324 | def4 = 600; address = FramLoad( 4, &NtpClientQueryNormalInterval, &def4); if (address < 0) return -1; iNormalInterval = address; |
andrewboyson | 0:22b158d3c76f | 325 | def4 = 60; address = FramLoad( 4, &NtpClientQueryRetryInterval, &def4); if (address < 0) return -1; iRetryInterval = address; |
andrewboyson | 0:22b158d3c76f | 326 | def4 = 0; address = FramLoad( 4, &NtpClientReplyOffsetMs, &def4); if (address < 0) return -1; iOffsetMs = address; |
andrewboyson | 0:22b158d3c76f | 327 | def4 = 50; address = FramLoad( 4, &NtpClientReplyMaxDelayMs, &def4); if (address < 0) return -1; iMaxDelayMs = address; |
andrewboyson | 0:22b158d3c76f | 328 | |
andrewboyson | 3:f1464bf461c1 | 329 | //Boiler |
andrewboyson | 3:f1464bf461c1 | 330 | address = FramAllocate(8); if (address < 0) return -1; iTankRom = address; |
andrewboyson | 3:f1464bf461c1 | 331 | address = FramAllocate(8); if (address < 0) return -1; iOutputRom = address; |
andrewboyson | 3:f1464bf461c1 | 332 | address = FramAllocate(8); if (address < 0) return -1; iReturnRom = address; |
andrewboyson | 3:f1464bf461c1 | 333 | address = FramAllocate(1); if (address < 0) return -1; iFullSpeedSecs = address; |
andrewboyson | 3:f1464bf461c1 | 334 | address = FramAllocate(1); if (address < 0) return -1; iTankSetPoint = address; |
andrewboyson | 3:f1464bf461c1 | 335 | address = FramAllocate(2); if (address < 0) return -1; iTankHysteresis = address; |
andrewboyson | 3:f1464bf461c1 | 336 | address = FramAllocate(2); if (address < 0) return -1; iRunOnDeltaT = address; |
andrewboyson | 3:f1464bf461c1 | 337 | address = FramAllocate(1); if (address < 0) return -1; iRunOnTime2s = address; |
andrewboyson | 3:f1464bf461c1 | 338 | address = FramAllocate(1); if (address < 0) return -1; iPumpSpeedCalling = address; |
andrewboyson | 3:f1464bf461c1 | 339 | address = FramAllocate(1); if (address < 0) return -1; iRampDownTime = address; |
andrewboyson | 3:f1464bf461c1 | 340 | address = FramAllocate(1); if (address < 0) return -1; iBoilerTarget = address; |
andrewboyson | 3:f1464bf461c1 | 341 | address = FramAllocate(1); if (address < 0) return -1; iMinSpeed = address; |
andrewboyson | 3:f1464bf461c1 | 342 | FramAllocate(1); //Spare byte |
andrewboyson | 3:f1464bf461c1 | 343 | address = FramAllocate(1); if (address < 0) return -1; iMidSpeedPwm = address; |
andrewboyson | 3:f1464bf461c1 | 344 | FramAllocate(1); //Spare byte |
andrewboyson | 3:f1464bf461c1 | 345 | address = FramAllocate(2); if (address < 0) return -1; iFullSpeedDeltaT = address; |
andrewboyson | 3:f1464bf461c1 | 346 | |
andrewboyson | 3:f1464bf461c1 | 347 | //Radiator |
andrewboyson | 3:f1464bf461c1 | 348 | address = FramAllocate(1); if (address < 0) return -1; iWinter = address; |
andrewboyson | 3:f1464bf461c1 | 349 | FramAllocate(1); //Spare byte |
andrewboyson | 3:f1464bf461c1 | 350 | address = FramAllocate(8); if (address < 0) return -1; iHallRom = address; |
andrewboyson | 3:f1464bf461c1 | 351 | address = FramAllocate(1); if (address < 0) return -1; iOverrideCancelHour = address; |
andrewboyson | 3:f1464bf461c1 | 352 | address = FramAllocate(1); if (address < 0) return -1; iOverrideCancelMinute = address; |
andrewboyson | 5:3579001bea1b | 353 | address = FramAllocate(1); if (address < 0) return -1; iHotWaterProtectTemp = address; |
andrewboyson | 5:3579001bea1b | 354 | address = FramAllocate(1); if (address < 0) return -1; iHotWaterProtectOn = address; |
andrewboyson | 3:f1464bf461c1 | 355 | address = FramAllocate(2); if (address < 0) return -1; iNightTemperature = address; |
andrewboyson | 3:f1464bf461c1 | 356 | address = FramAllocate(2); if (address < 0) return -1; iFrostTemperature = address; |
andrewboyson | 3:f1464bf461c1 | 357 | address = FramAllocate(7); if (address < 0) return -1; iProgramDay = address; |
andrewboyson | 3:f1464bf461c1 | 358 | |
andrewboyson | 3:f1464bf461c1 | 359 | int programSize = PROGRAM_COUNT * PROGRAM_TRANSITIONS_COUNT * sizeof(int16_t); |
andrewboyson | 3:f1464bf461c1 | 360 | address = FramAllocate(programSize); if (address < 0) return -1; iPrograms = address; //3 x 4 x 2 |
andrewboyson | 3:f1464bf461c1 | 361 | address = FramAllocate(1); if (address < 0) return -1; iProgramNewDayHour = address; |
andrewboyson | 0:22b158d3c76f | 362 | |
andrewboyson | 3:f1464bf461c1 | 363 | address = FramAllocate(8); if (address < 0) return -1; iHotWaterRom = address; |
andrewboyson | 3:f1464bf461c1 | 364 | |
andrewboyson | 3:f1464bf461c1 | 365 | if (FramEmpty) |
andrewboyson | 3:f1464bf461c1 | 366 | { |
andrewboyson | 3:f1464bf461c1 | 367 | def1 = 100; FramWrite(iFullSpeedSecs, 1, &def1); |
andrewboyson | 3:f1464bf461c1 | 368 | def1 = 65; FramWrite(iTankSetPoint, 1, &def1); |
andrewboyson | 3:f1464bf461c1 | 369 | def2 = 3; FramWrite(iTankHysteresis, 2, &def2); |
andrewboyson | 3:f1464bf461c1 | 370 | def2 = 2<<4; FramWrite(iRunOnDeltaT, 2, &def2); |
andrewboyson | 3:f1464bf461c1 | 371 | def1 = 180>>2; FramWrite(iRunOnTime2s, 1, &def1); //3 minutes = 2 * 90 2 seconds |
andrewboyson | 3:f1464bf461c1 | 372 | def1 = 100; FramWrite(iPumpSpeedCalling, 1, &def1); |
andrewboyson | 3:f1464bf461c1 | 373 | def1 = 10; FramWrite(iRampDownTime, 1, &def1); |
andrewboyson | 3:f1464bf461c1 | 374 | def1 = 60; FramWrite(iBoilerTarget, 1, &def1); |
andrewboyson | 3:f1464bf461c1 | 375 | def1 = 50; FramWrite(iMinSpeed, 1, &def1); |
andrewboyson | 3:f1464bf461c1 | 376 | def1 = 50; FramWrite(iMidSpeedPwm, 1, &def1); |
andrewboyson | 3:f1464bf461c1 | 377 | def2 = 10<<4; FramWrite(iFullSpeedDeltaT, 2, &def2); |
andrewboyson | 3:f1464bf461c1 | 378 | def1 = 0; FramWrite(iWinter, 1, &def1); |
andrewboyson | 3:f1464bf461c1 | 379 | def1 = 23; FramWrite(iOverrideCancelHour, 1, &def1); |
andrewboyson | 3:f1464bf461c1 | 380 | def1 = 0; FramWrite(iOverrideCancelMinute, 1, &def1); |
andrewboyson | 5:3579001bea1b | 381 | def1 = 50; FramWrite(iHotWaterProtectTemp, 1, &def1); |
andrewboyson | 5:3579001bea1b | 382 | def1 = 0; FramWrite(iHotWaterProtectOn, 1, &def1); |
andrewboyson | 3:f1464bf461c1 | 383 | def2 = 15; FramWrite(iNightTemperature, 2, &def2); |
andrewboyson | 3:f1464bf461c1 | 384 | def2 = 8; FramWrite(iFrostTemperature, 2, &def2); |
andrewboyson | 3:f1464bf461c1 | 385 | def1 = 2; FramWrite(iProgramNewDayHour, 1, &def1); |
andrewboyson | 3:f1464bf461c1 | 386 | } |
andrewboyson | 0:22b158d3c76f | 387 | |
andrewboyson | 0:22b158d3c76f | 388 | def4 = 10; address = FramLoad( 4, &ClkGovSlewDivisor, &def4); if (address < 0) return -1; iClkGovSlewDivisor = address; |
andrewboyson | 0:22b158d3c76f | 389 | def4 = 20; address = FramLoad( 4, &ClkGovSlewChangeMaxMs, &def4); if (address < 0) return -1; iClkGovSlewMaxMs = address; |
andrewboyson | 0:22b158d3c76f | 390 | def4 = 1000; address = FramLoad( 4, &ClkGovFreqDivisor, &def4); if (address < 0) return -1; iClkGovPpbDivisor = address; |
andrewboyson | 0:22b158d3c76f | 391 | def4 = 10000000; address = FramLoad( 4, &ClkGovFreqChangeMaxPpb, &def4); if (address < 0) return -1; iClkGovPpbChangeMax = address; |
andrewboyson | 0:22b158d3c76f | 392 | def4 = 100000; address = FramLoad( 4, &ClkGovSlewSyncedLimNs, &def4); if (address < 0) return -1; iClkGovSyncedLimitNs = address; |
andrewboyson | 0:22b158d3c76f | 393 | def4 = 100000; address = FramLoad( 4, &ClkGovFreqSyncedLimPpb, &def4); if (address < 0) return -1; iClkGovSyncedLimitPpb = address; |
andrewboyson | 0:22b158d3c76f | 394 | def4 = 10000; address = FramLoad( 4, &ClkGovSlewSyncedHysNs, &def4); if (address < 0) return -1; iClkGovSyncedHysterisNs = address; |
andrewboyson | 0:22b158d3c76f | 395 | def4 = 1000; address = FramLoad( 4, &ClkGovFreqSyncedHysPpb, &def4); if (address < 0) return -1; iClkGovSyncedHysterisPpb = address; |
andrewboyson | 0:22b158d3c76f | 396 | def4 = 3; address = FramLoad( 4, &ClkGovSlewOffsetMaxSecs, &def4); if (address < 0) return -1; iClkGovMaxOffsetSecs = address; |
andrewboyson | 0:22b158d3c76f | 397 | address = FramLoad( 1, &b, NULL); ClkGovTrace = b; if (address < 0) return -1; iClkGov = address; |
andrewboyson | 0:22b158d3c76f | 398 | address = FramLoad( 1, &b, NULL); OneWireTrace = b; if (address < 0) return -1; iOneWire = address; |
andrewboyson | 0:22b158d3c76f | 399 | address = FramLoad( 1, &b, NULL); DnsSendRequestsViaIp4 = b; if (address < 0) return -1; iDnsSendRequestsViaIp4 = address; |
andrewboyson | 0:22b158d3c76f | 400 | address = FramLoad( 1, &b, NULL); NtpClientQuerySendRequestsViaIp4 = b; if (address < 0) return -1; iNtpSendRequestsViaIp4 = address; |
andrewboyson | 0:22b158d3c76f | 401 | address = FramLoad( 1, &b, NULL); TftpSendRequestsViaIp4 = b; if (address < 0) return -1; iTftpSendRequestsViaIp4 = address; |
andrewboyson | 0:22b158d3c76f | 402 | address = FramLoad( 1, &b, NULL); LogUart = b; if (address < 0) return -1; iLogUart = address; |
andrewboyson | 0:22b158d3c76f | 403 | address = FramLoad( 2, NetTraceHost, NULL) ; if (address < 0) return -1; iNetHost = address; |
andrewboyson | 0:22b158d3c76f | 404 | address = FramLoad( 1, &b, NULL); NetTraceStack = b; if (address < 0) return -1; iNetStack = address; |
andrewboyson | 0:22b158d3c76f | 405 | address = FramLoad( 1, &b, NULL); NetTraceNewLine = b; if (address < 0) return -1; iNetNewLine = address; |
andrewboyson | 0:22b158d3c76f | 406 | address = FramLoad( 1, &b, NULL); NetTraceVerbose = b; if (address < 0) return -1; iNetVerbose = address; |
andrewboyson | 0:22b158d3c76f | 407 | address = FramLoad( 1, &b, NULL); LinkTrace = b; if (address < 0) return -1; iLink = address; |
andrewboyson | 0:22b158d3c76f | 408 | address = FramLoad( 1, &b, NULL); DnsNameTrace = b; if (address < 0) return -1; iDnsName = address; |
andrewboyson | 0:22b158d3c76f | 409 | address = FramLoad( 1, &b, NULL); DnsQueryTrace = b; if (address < 0) return -1; iDnsQuery = address; |
andrewboyson | 0:22b158d3c76f | 410 | address = FramLoad( 1, &b, NULL); DnsReplyTrace = b; if (address < 0) return -1; iDnsReply = address; |
andrewboyson | 0:22b158d3c76f | 411 | address = FramLoad( 1, &b, NULL); DnsServerTrace = b; if (address < 0) return -1; iDnsServer = address; |
andrewboyson | 0:22b158d3c76f | 412 | address = FramLoad( 1, &b, NULL); NtpTrace = b; if (address < 0) return -1; iNtp = address; |
andrewboyson | 0:22b158d3c76f | 413 | address = FramLoad( 1, &b, NULL); DhcpTrace = b; if (address < 0) return -1; iDhcp = address; |
andrewboyson | 0:22b158d3c76f | 414 | address = FramLoad( 1, &b, NULL); NsTraceRecvSol = b; if (address < 0) return -1; iNsRecvSol = address; |
andrewboyson | 0:22b158d3c76f | 415 | address = FramLoad( 1, &b, NULL); NsTraceRecvAdv = b; if (address < 0) return -1; iNsRecvAdv = address; |
andrewboyson | 0:22b158d3c76f | 416 | address = FramLoad( 1, &b, NULL); NsTraceSendSol = b; if (address < 0) return -1; iNsSendSol = address; |
andrewboyson | 0:22b158d3c76f | 417 | address = FramLoad( 1, &b, NULL); Nr4Trace = b; if (address < 0) return -1; iNr4 = address; |
andrewboyson | 0:22b158d3c76f | 418 | address = FramLoad( 1, &b, NULL); NrTrace = b; if (address < 0) return -1; iNr = address; |
andrewboyson | 0:22b158d3c76f | 419 | address = FramLoad( 1, &b, NULL); NtpClientTrace = b; if (address < 0) return -1; iNtpClient = address; |
andrewboyson | 0:22b158d3c76f | 420 | address = FramLoad( 1, &b, NULL); Echo4Trace = b; if (address < 0) return -1; iEcho4 = address; |
andrewboyson | 0:22b158d3c76f | 421 | address = FramLoad( 1, &b, NULL); Echo6Trace = b; if (address < 0) return -1; iEcho6 = address; |
andrewboyson | 0:22b158d3c76f | 422 | address = FramLoad( 1, &b, NULL); Dest6Trace = b; if (address < 0) return -1; iDest6 = address; |
andrewboyson | 0:22b158d3c76f | 423 | address = FramLoad( 1, &b, NULL); RaTrace = b; if (address < 0) return -1; iRa = address; |
andrewboyson | 0:22b158d3c76f | 424 | address = FramLoad( 1, &b, NULL); RsTrace = b; if (address < 0) return -1; iRs = address; |
andrewboyson | 0:22b158d3c76f | 425 | address = FramLoad( 1, &b, NULL); Ar4Trace = b; if (address < 0) return -1; iAr4 = address; |
andrewboyson | 0:22b158d3c76f | 426 | address = FramLoad( 1, &b, NULL); Ar6Trace = b; if (address < 0) return -1; iAr6 = address; |
andrewboyson | 0:22b158d3c76f | 427 | address = FramLoad( 1, &b, NULL); ArpTrace = b; if (address < 0) return -1; iArp = address; |
andrewboyson | 0:22b158d3c76f | 428 | address = FramLoad( 1, &b, NULL); Ip4Trace = b; if (address < 0) return -1; iIp4 = address; |
andrewboyson | 0:22b158d3c76f | 429 | address = FramLoad( 1, &b, NULL); Ip6Trace = b; if (address < 0) return -1; iIp6 = address; |
andrewboyson | 0:22b158d3c76f | 430 | address = FramLoad( 1, &b, NULL); UdpTrace = b; if (address < 0) return -1; iUdp = address; |
andrewboyson | 0:22b158d3c76f | 431 | address = FramLoad( 1, &b, NULL); TcpTrace = b; if (address < 0) return -1; iTcp = address; |
andrewboyson | 0:22b158d3c76f | 432 | address = FramLoad( 1, &b, NULL); WebTrace = b; if (address < 0) return -1; iHttp = address; |
andrewboyson | 0:22b158d3c76f | 433 | address = FramLoad( 1, &b, NULL); TftpTrace = b; if (address < 0) return -1; iTftp = address; |
andrewboyson | 0:22b158d3c76f | 434 | |
andrewboyson | 0:22b158d3c76f | 435 | address = FramAllocate(DNS_MAX_LABEL_LENGTH); if (address < 0) return -1; iValuesServerName = address; |
andrewboyson | 0:22b158d3c76f | 436 | FramAllocate(1); //Spare |
andrewboyson | 0:22b158d3c76f | 437 | address = FramAllocate(DNS_MAX_LABEL_LENGTH); if (address < 0) return -1; iValuesFileName = address; |
andrewboyson | 0:22b158d3c76f | 438 | FramAllocate(1); //Spare |
andrewboyson | 0:22b158d3c76f | 439 | address = FramAllocate( 4); if (address < 0) return -1; iValuesWriteSize = address; |
andrewboyson | 0:22b158d3c76f | 440 | address = FramAllocate( 4); if (address < 0) return -1; iValuesReadInterval = address; |
andrewboyson | 0:22b158d3c76f | 441 | address = FramAllocate( 8); if (address < 0) return -1; iValuesStartTime = address; |
andrewboyson | 0:22b158d3c76f | 442 | address = FramAllocate( 4); if (address < 0) return -1; iValuesCount = address; |
andrewboyson | 0:22b158d3c76f | 443 | if (FramEmpty) |
andrewboyson | 0:22b158d3c76f | 444 | { |
andrewboyson | 0:22b158d3c76f | 445 | b = 0; FramWrite(iValuesServerName , 1, &b ); |
andrewboyson | 0:22b158d3c76f | 446 | b = 0; FramWrite(iValuesFileName , 1, &b ); |
andrewboyson | 0:22b158d3c76f | 447 | def4 = 100; FramWrite(iValuesWriteSize , 4, &def4); |
andrewboyson | 0:22b158d3c76f | 448 | def4 = 15; FramWrite(iValuesReadInterval, 4, &def4); |
andrewboyson | 0:22b158d3c76f | 449 | def8 = 0; FramWrite(iValuesStartTime , 8, &def8); |
andrewboyson | 0:22b158d3c76f | 450 | def4 = 0; FramWrite(iValuesCount , 4, &def4); |
andrewboyson | 0:22b158d3c76f | 451 | } |
andrewboyson | 0:22b158d3c76f | 452 | address = FramLoad( 1, &b, NULL); WizTrace = b; if (address < 0) return -1; iWizTrace = address; |
andrewboyson | 0:22b158d3c76f | 453 | |
andrewboyson | 0:22b158d3c76f | 454 | for (int i = 0; i < WIZ_LIST_MAX_ITEMS; i++) |
andrewboyson | 0:22b158d3c76f | 455 | { |
andrewboyson | 0:22b158d3c76f | 456 | address = FramAllocate( 6); if (address < 0) return -1; iWizMacs [i] = address; |
andrewboyson | 0:22b158d3c76f | 457 | address = FramAllocate(WIZ_LIST_NAME_LENGTH); if (address < 0) return -1; iWizNames[i] = address; |
andrewboyson | 0:22b158d3c76f | 458 | address = FramAllocate(WIZ_LIST_NAME_LENGTH); if (address < 0) return -1; iWizRooms[i] = address; |
andrewboyson | 0:22b158d3c76f | 459 | } |
andrewboyson | 0:22b158d3c76f | 460 | for (int i = 0; i < WIZ_SCHED_MAX_ITEMS; i++) |
andrewboyson | 0:22b158d3c76f | 461 | { |
andrewboyson | 0:22b158d3c76f | 462 | address = FramAllocate(WIZ_LIST_NAME_LENGTH); if (address < 0) return -1; iWizSchedNames [i] = address; |
andrewboyson | 0:22b158d3c76f | 463 | address = FramAllocate( 1); if (address < 0) return -1; iWizSchedOnDatums [i] = address; |
andrewboyson | 0:22b158d3c76f | 464 | address = FramAllocate( 2); if (address < 0) return -1; iWizSchedOnMinutes [i] = address; |
andrewboyson | 0:22b158d3c76f | 465 | address = FramAllocate( 1); if (address < 0) return -1; iWizSchedOffDatums [i] = address; |
andrewboyson | 0:22b158d3c76f | 466 | address = FramAllocate( 2); if (address < 0) return -1; iWizSchedOffMinutes[i] = address; |
andrewboyson | 0:22b158d3c76f | 467 | } |
andrewboyson | 0:22b158d3c76f | 468 | |
andrewboyson | 0:22b158d3c76f | 469 | iValuesData = FramUsed; |
andrewboyson | 0:22b158d3c76f | 470 | |
andrewboyson | 0:22b158d3c76f | 471 | return 0; |
andrewboyson | 0:22b158d3c76f | 472 | |
andrewboyson | 0:22b158d3c76f | 473 | } |