Commit 2bc2194a3caa0c961e0273f44cf942287bb893c8
1 parent
2c7e20e4
Revert "Fixed some printx"
This reverts commit 846585f9ccacd0022ecbbb6806071766ef90dcdd.
Showing
4 changed files
with
8 additions
and
22 deletions
Show diff stats
.gitignore
@@ -35,42 +35,36 @@ void processCmd(char* buffer) | @@ -35,42 +35,36 @@ void processCmd(char* buffer) | ||
35 | } | 35 | } |
36 | else if(strcmp(buffer, "setpumpon") == 0) | 36 | else if(strcmp(buffer, "setpumpon") == 0) |
37 | { | 37 | { |
38 | - printx(INFO, BUS, "Setting PUMP ON\n"); | 38 | + printx(INFO, BUS, "Setting PUMP ON"); |
39 | setPumpWantedState(true); | 39 | setPumpWantedState(true); |
40 | } | 40 | } |
41 | else if(strcmp(buffer, "setpumpoff") == 0) | 41 | else if(strcmp(buffer, "setpumpoff") == 0) |
42 | { | 42 | { |
43 | - printx(INFO, BUS, "Setting PUMP OFF\n"); | 43 | + printx(INFO, BUS, "Setting PUMP OFF"); |
44 | setPumpWantedState(false); | 44 | setPumpWantedState(false); |
45 | } | 45 | } |
46 | else if(strcmp(buffer, "setheaton") == 0) | 46 | else if(strcmp(buffer, "setheaton") == 0) |
47 | { | 47 | { |
48 | - printx(INFO, BUS, "Setting HEAT ON\n"); | 48 | + printx(INFO, BUS, "Setting HEAT ON"); |
49 | setHeatWantedState(true); | 49 | setHeatWantedState(true); |
50 | } | 50 | } |
51 | else if(strcmp(buffer, "setheatoff") == 0) | 51 | else if(strcmp(buffer, "setheatoff") == 0) |
52 | { | 52 | { |
53 | - printx(INFO, BUS, "Setting HEAT OFF\n"); | 53 | + printx(INFO, BUS, "Setting HEAT OFF"); |
54 | setHeatWantedState(false); | 54 | setHeatWantedState(false); |
55 | } | 55 | } |
56 | else if(strcmp(buffer, "setheaton5s") == 0) | 56 | else if(strcmp(buffer, "setheaton5s") == 0) |
57 | { | 57 | { |
58 | - printx(INFO, BUS, "Setting HEAT ON for 5 secs\n"); | 58 | + printx(INFO, BUS, "Setting HEAT ON for 5 secs"); |
59 | setHeatTimer(5); | 59 | setHeatTimer(5); |
60 | setHeatWantedState(true); | 60 | setHeatWantedState(true); |
61 | } | 61 | } |
62 | else if(strcmp(buffer, "setpumpon5s") == 0) | 62 | else if(strcmp(buffer, "setpumpon5s") == 0) |
63 | { | 63 | { |
64 | - printx(INFO, BUS, "Setting PUMP ON for 5 secs\n"); | 64 | + printx(INFO, BUS, "Setting PUMP ON for 5 secs"); |
65 | setPumpTimer(5); | 65 | setPumpTimer(5); |
66 | setPumpWantedState(true); | 66 | setPumpWantedState(true); |
67 | } | 67 | } |
68 | - else if(strcmp(buffer, "setheaton35s") == 0) | ||
69 | - { | ||
70 | - printx(INFO, BUS, "Setting HEAT ON for 35 secs\n"); | ||
71 | - setHeatTimer(35); | ||
72 | - setHeatWantedState(true); | ||
73 | - } | ||
74 | 68 | ||
75 | //printx(DEBUG, BUS, "STRLEN : %d and strcmp ret %d", strlen(buffer), strcmp(buffer, "quit")); | 69 | //printx(DEBUG, BUS, "STRLEN : %d and strcmp ret %d", strlen(buffer), strcmp(buffer, "quit")); |
76 | } | 70 | } |
@@ -87,8 +81,7 @@ void* processBus(void* we) | @@ -87,8 +81,7 @@ void* processBus(void* we) | ||
87 | printx(DEBUG, BUS, "Event receved !\n"); | 81 | printx(DEBUG, BUS, "Event receved !\n"); |
88 | busFree = false; | 82 | busFree = false; |
89 | lseek(bus, 0, SEEK_SET); | 83 | lseek(bus, 0, SEEK_SET); |
90 | - read(bus, buffer, CMD_MAX); | ||
91 | - //printx(DEBUG, BUS, "Data read %d\n", read(bus, buffer, CMD_MAX)); | 84 | + printx(DEBUG, BUS, "Data read %d\n", read(bus, buffer, CMD_MAX)); |
92 | ftruncate(bus, 0); | 85 | ftruncate(bus, 0); |
93 | sync(); | 86 | sync(); |
94 | processCmd(buffer); | 87 | processCmd(buffer); |
@@ -104,7 +104,6 @@ void* processHVC(void* we) | @@ -104,7 +104,6 @@ void* processHVC(void* we) | ||
104 | sendData(&hvc_fd, GET_TEMP); | 104 | sendData(&hvc_fd, GET_TEMP); |
105 | data = getData(&hvc_fd); | 105 | data = getData(&hvc_fd); |
106 | setTemp(data); | 106 | setTemp(data); |
107 | - printx(DEBUG, HVC, "TEMP %d\n", data); | ||
108 | 107 | ||
109 | if(tHeatTimer > 0) | 108 | if(tHeatTimer > 0) |
110 | { | 109 | { |
@@ -113,7 +112,6 @@ void* processHVC(void* we) | @@ -113,7 +112,6 @@ void* processHVC(void* we) | ||
113 | { | 112 | { |
114 | wHeat = false; | 113 | wHeat = false; |
115 | tHeatTimer = 0; | 114 | tHeatTimer = 0; |
116 | - printx(INFO, HVC, "Shutting down HEAT according to timer\n"); | ||
117 | } | 115 | } |
118 | 116 | ||
119 | } | 117 | } |
@@ -125,7 +123,6 @@ void* processHVC(void* we) | @@ -125,7 +123,6 @@ void* processHVC(void* we) | ||
125 | { | 123 | { |
126 | wPump = false; | 124 | wPump = false; |
127 | tPumpTimer = 0; | 125 | tPumpTimer = 0; |
128 | - printx(INFO, HVC, "Shutting down PUMP according to timer\n"); | ||
129 | } | 126 | } |
130 | } | 127 | } |
131 | 128 |
printx.c
@@ -14,7 +14,6 @@ | @@ -14,7 +14,6 @@ | ||
14 | FILE* logfile = NULL; | 14 | FILE* logfile = NULL; |
15 | char s_color[4][12] = {"\x1b[01;31m", "\x1b[01;33m", "\x1b[01;32m", "\x1b[01;36m"}; | 15 | char s_color[4][12] = {"\x1b[01;31m", "\x1b[01;33m", "\x1b[01;32m", "\x1b[01;36m"}; |
16 | char f_name[5][5] = {"MAIN", "UI ", "NFC ", "HVC ", "BUS "}; | 16 | char f_name[5][5] = {"MAIN", "UI ", "NFC ", "HVC ", "BUS "}; |
17 | -time_t start; | ||
18 | 17 | ||
19 | void removeCharFromString(char c, char *str) | 18 | void removeCharFromString(char c, char *str) |
20 | { | 19 | { |
@@ -27,7 +26,6 @@ void removeCharFromString(char c, char *str) | @@ -27,7 +26,6 @@ void removeCharFromString(char c, char *str) | ||
27 | 26 | ||
28 | bool initLog() | 27 | bool initLog() |
29 | { | 28 | { |
30 | - start = clock(); | ||
31 | char filename[FILENAME_LENGTH]; | 29 | char filename[FILENAME_LENGTH]; |
32 | time_t now = time(NULL); | 30 | time_t now = time(NULL); |
33 | 31 | ||
@@ -55,11 +53,10 @@ void printx(severity s, msgfrom from, char* str, ...) | @@ -55,11 +53,10 @@ void printx(severity s, msgfrom from, char* str, ...) | ||
55 | { | 53 | { |
56 | char buffer1[MAX_BUFFER]; | 54 | char buffer1[MAX_BUFFER]; |
57 | char buffer2[MAX_BUFFER]; | 55 | char buffer2[MAX_BUFFER]; |
58 | - time_t now = clock(); | ||
59 | va_list arglist; | 56 | va_list arglist; |
60 | va_start(arglist, str); | 57 | va_start(arglist, str); |
61 | vsprintf(buffer1, str, arglist); | 58 | vsprintf(buffer1, str, arglist); |
62 | - fprintf(logfile, "[%6lu] %s", (now - start)/CLOCKS_PER_SEC , buffer1); | 59 | + fprintf(logfile, buffer1); |
63 | fflush(logfile); | 60 | fflush(logfile); |
64 | sprintf(buffer2, "[%s] %s%s%s", f_name[from], s_color[s], buffer1, S_RESET); | 61 | sprintf(buffer2, "[%s] %s%s%s", f_name[from], s_color[s], buffer1, S_RESET); |
65 | removeCharFromString('\n', buffer2); | 62 | removeCharFromString('\n', buffer2); |