Commit
bb8c27998dbf7650bedcf96a4635a887d9a86ce0
Authored by
henyxia
Fixed version
| @@ -35,10 +35,11 @@ bool heat_ok=false; |
| @@ -35,10 +35,11 @@ bool heat_ok=false; |
35
| bool hold_heat=true; |
35
| bool hold_heat=true; |
36
| bool pumpitup=false; //Lecture de l'état de la pompe |
36
| bool pumpitup=false; //Lecture de l'état de la pompe |
37
| bool eco_mode=false; |
37
| bool eco_mode=false; |
| |
38
| +bool stopHeat=false; |
38
| |
39
| |
39
| void* processHeat(void* arg) |
40
| void* processHeat(void* arg) |
40
| { |
41
| { |
41
| - while(!stop) |
42
| + while(!stopHeat) |
42
| { |
43
| { |
43
| tNow = clock(); |
44
| tNow = clock(); |
44
| |
45
| |
| @@ -230,5 +231,5 @@ void* processHeat(void* arg) |
| @@ -230,5 +231,5 @@ void* processHeat(void* arg) |
230
| } |
231
| } |
231
| |
232
| |
232
| |
233
| |
233
| -return NULL; |
234
| + return NULL; |
234
| } |
235
| } |
| @@ -32,7 +32,7 @@ int hvc_fd = -1; |
| @@ -32,7 +32,7 @@ int hvc_fd = -1; |
32
| bool hvcStop = false; |
32
| bool hvcStop = false; |
33
| bool sPump = false; |
33
| bool sPump = false; |
34
| bool sHeat = false; |
34
| bool sHeat = false; |
35
| -bool autoHeat = false; |
35
| +bool autoHeat = false; |
36
| struct termios hvcSaveterm; |
36
| struct termios hvcSaveterm; |
37
| bool wHeat = false; |
37
| bool wHeat = false; |
38
| bool wPump = false; |
38
| bool wPump = false; |
| @@ -42,7 +42,27 @@ double tHeatTimer; |
| @@ -42,7 +42,27 @@ double tHeatTimer; |
42
| time_t tPumpStart; |
42
| time_t tPumpStart; |
43
| double tPumpTimer; |
43
| double tPumpTimer; |
44
| time_t tPumpStop; |
44
| time_t tPumpStop; |
45
| -int tempCons; |
45
| +int tempCons; |
| |
46
| + |
| |
47
| +void setPumpOn() |
| |
48
| +{ |
| |
49
| + setPumpWantedState(true); |
| |
50
| +} |
| |
51
| + |
| |
52
| +void setPumpOff() |
| |
53
| +{ |
| |
54
| + setPumpWantedState(false); |
| |
55
| +} |
| |
56
| + |
| |
57
| +void setHeatOn() |
| |
58
| +{ |
| |
59
| + setHeatWantedState(true); |
| |
60
| +} |
| |
61
| + |
| |
62
| +void setHeatOff() |
| |
63
| +{ |
| |
64
| + setHeatWantedState(false); |
| |
65
| +} |
46
| |
66
| |
47
| void stopHVC() |
67
| void stopHVC() |
48
| { |
68
| { |
| @@ -10,5 +10,9 @@ void setPumpWantedState(bool); |
| @@ -10,5 +10,9 @@ void setPumpWantedState(bool); |
10
| void setHeatWantedState(bool); |
10
| void setHeatWantedState(bool); |
11
| void setPumpTimer(double); |
11
| void setPumpTimer(double); |
12
| void setHeatTimer(double); |
12
| void setHeatTimer(double); |
| |
13
| +void setHeatOn(); |
| |
14
| +void setHeatOff(); |
| |
15
| +void setPumpOn(); |
| |
16
| +void setPumpOff(); |
13
| |
17
| |
14
| #endif |
18
| #endif |
1
| #include <stdio.h> |
1
| #include <stdio.h> |
2
| #include <time.h> |
2
| #include <time.h> |
3
| #include <stdbool.h> |
3
| #include <stdbool.h> |
| |
4
| +#include <unistd.h> |
4
| #include "hvc.h" |
5
| #include "hvc.h" |
5
| #include "pump.h" |
6
| #include "pump.h" |
6
| |
7
| |
7
| #define K_DEB 1925 //en imp/L |
8
| #define K_DEB 1925 //en imp/L |
8
| |
9
| |
9
| - |
| |
10
| -//Globals |
| |
11
| -bool stop=false; |
| |
12
| -bool heat_ok=false; |
| |
13
| -bool coffee_wanted=false; |
| |
14
| -int volDeb=0; // Volume du débitmetre en impulsion |
| |
15
| -int volWanted=0; |
| |
16
| - |
| |
17
| -void* processHeat(void* arg) |
10
| +void* processPump(void* arg) |
18
| { |
11
| { |
19
| - while (!stop) |
12
| + bool stopPump=false; |
| |
13
| + bool heat_ok=false; |
| |
14
| + bool coffee_wanted=false; |
| |
15
| + int volDeb=0; // Volume du débitmetre en impulsion |
| |
16
| + int volWanted=0; |
| |
17
| + |
| |
18
| + while (!stopPump) |
20
| { |
19
| { |
21
| if (heat_ok && coffee_wanted) |
20
| if (heat_ok && coffee_wanted) |
22
| { |
21
| { |
| @@ -34,4 +33,6 @@ void* processHeat(void* arg) |
| @@ -34,4 +33,6 @@ void* processHeat(void* arg) |
34
| } |
33
| } |
35
| sleep(1); |
34
| sleep(1); |
36
| } |
35
| } |
| |
36
| + |
| |
37
| + return NULL; |
37
| } |
38
| } |