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
Diff: heating/values.c
- Revision:
- 38:2bfeefa8709a
- Parent:
- 33:6694d7c515a0
- Child:
- 41:6413522ed343
diff -r 1cdd820f2747 -r 2bfeefa8709a heating/values.c --- a/heating/values.c Mon Mar 11 10:07:11 2019 +0000 +++ b/heating/values.c Mon Mar 11 16:47:54 2019 +0000 @@ -3,7 +3,7 @@ #include <stdbool.h> #include "tftp.h" -#include "dns.h" +#include "dnslabel.h" #include "fram.h" #include "clk.h" #include "mstimer.h" @@ -32,14 +32,12 @@ void ValuesGetStartTm (struct tm* ptm) { ClkTimeToTmUtc(startTime, ptm);} int ValuesGetCount ( ) { return (int) count; } -static void lblcpy(char* dst, char* src) { strncpy(dst, src, DNS_MAX_LABEL_LENGTH); dst[DNS_MAX_LABEL_LENGTH] = 0; } - -void ValuesSetServerName (char* value) { lblcpy(serverName, value); FramWrite(iServerName , DNS_MAX_LABEL_LENGTH, serverName ); } -void ValuesSetFileName (char* value) { lblcpy( fileName, value); FramWrite(iFileName , DNS_MAX_LABEL_LENGTH, fileName ); } -void ValuesSetWriteSize (int value) { writeSize = (int32_t)value ; FramWrite(iWriteSize , 4, &writeSize ); } -void ValuesSetReadInterval (int value) { readInterval = (int32_t)value ; FramWrite(iReadInterval, 4, &readInterval ); } -static void setStartTime (int64_t value) { startTime = value ; FramWrite(iStartTime , 8, &startTime ); } -static void setCount (int value) { count = (int32_t)value ; FramWrite(iCount , 4, &count ); } +void ValuesSetServerName (char* value) { DnsLabelCopy(serverName, value); FramWrite(iServerName , DNS_MAX_LABEL_LENGTH, serverName ); } +void ValuesSetFileName (char* value) { DnsLabelCopy( fileName, value); FramWrite(iFileName , DNS_MAX_LABEL_LENGTH, fileName ); } +void ValuesSetWriteSize (int value) { writeSize = value ; FramWrite(iWriteSize , 4, &writeSize ); } +void ValuesSetReadInterval (int value) { readInterval = value ; FramWrite(iReadInterval, 4, &readInterval ); } +static void setStartTime (int64_t value) { startTime = value ; FramWrite(iStartTime , 8, &startTime ); } +static void setCount (int value) { count = value ; FramWrite(iCount , 4, &count ); } static int readValuesFromFram() {