Commit c21a2c1657b83295995590dc6515f44a4ec48a65
1 parent
52bded2e
Re added timestamp to log
Re added temperature to log Edited HVC to control the heat during 10s
Showing
3 changed files
with
12 additions
and
2 deletions
Show diff stats
... | ... | @@ -59,6 +59,12 @@ void processCmd(char* buffer) |
59 | 59 | setHeatTimer(5); |
60 | 60 | setHeatWantedState(true); |
61 | 61 | } |
62 | + else if(strcmp(buffer, "setheaton35s") == 0) | |
63 | + { | |
64 | + printx(INFO, BUS, "Setting HEAT ON for 10 secs"); | |
65 | + setHeatTimer(10); | |
66 | + setHeatWantedState(true); | |
67 | + } | |
62 | 68 | else if(strcmp(buffer, "setpumpon5s") == 0) |
63 | 69 | { |
64 | 70 | printx(INFO, BUS, "Setting PUMP ON for 5 secs"); | ... | ... |
printx.c
... | ... | @@ -14,6 +14,7 @@ |
14 | 14 | FILE* logfile = NULL; |
15 | 15 | char s_color[4][12] = {"\x1b[01;31m", "\x1b[01;33m", "\x1b[01;32m", "\x1b[01;36m"}; |
16 | 16 | char f_name[5][5] = {"MAIN", "UI ", "NFC ", "HVC ", "BUS "}; |
17 | +float start; | |
17 | 18 | |
18 | 19 | void removeCharFromString(char c, char *str) |
19 | 20 | { |
... | ... | @@ -41,6 +42,8 @@ bool initLog() |
41 | 42 | return false; |
42 | 43 | } |
43 | 44 | |
45 | + start = clock(); | |
46 | + | |
44 | 47 | return true; |
45 | 48 | } |
46 | 49 | |
... | ... | @@ -54,9 +57,10 @@ void printx(severity s, msgfrom from, char* str, ...) |
54 | 57 | char buffer1[MAX_BUFFER]; |
55 | 58 | char buffer2[MAX_BUFFER]; |
56 | 59 | va_list arglist; |
60 | + float now = clock(); | |
57 | 61 | va_start(arglist, str); |
58 | 62 | vsprintf(buffer1, str, arglist); |
59 | - fprintf(logfile, buffer1); | |
63 | + fprintf(logfile, "[%6f] : %s", (now - start)/CLOCKS_PER_SEC, buffer1); | |
60 | 64 | fflush(logfile); |
61 | 65 | sprintf(buffer2, "[%s] %s%s%s", f_name[from], s_color[s], buffer1, S_RESET); |
62 | 66 | removeCharFromString('\n', buffer2); | ... | ... |