Commit bb8c27998dbf7650bedcf96a4635a887d9a86ce0
1 parent
8dca7aeb
Fixed version
Showing
4 changed files
with
40 additions
and
14 deletions
Show diff stats
... | ... | @@ -35,10 +35,11 @@ bool heat_ok=false; |
35 | 35 | bool hold_heat=true; |
36 | 36 | bool pumpitup=false; //Lecture de l'état de la pompe |
37 | 37 | bool eco_mode=false; |
38 | +bool stopHeat=false; | |
38 | 39 | |
39 | 40 | void* processHeat(void* arg) |
40 | 41 | { |
41 | - while(!stop) | |
42 | + while(!stopHeat) | |
42 | 43 | { |
43 | 44 | tNow = clock(); |
44 | 45 | |
... | ... | @@ -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 | 32 | bool hvcStop = false; |
33 | 33 | bool sPump = false; |
34 | 34 | bool sHeat = false; |
35 | -bool autoHeat = false; | |
35 | +bool autoHeat = false; | |
36 | 36 | struct termios hvcSaveterm; |
37 | 37 | bool wHeat = false; |
38 | 38 | bool wPump = false; |
... | ... | @@ -42,7 +42,27 @@ double tHeatTimer; |
42 | 42 | time_t tPumpStart; |
43 | 43 | double tPumpTimer; |
44 | 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 | 67 | void stopHVC() |
48 | 68 | { | ... | ... |
1 | 1 | #include <stdio.h> |
2 | 2 | #include <time.h> |
3 | 3 | #include <stdbool.h> |
4 | +#include <unistd.h> | |
4 | 5 | #include "hvc.h" |
5 | 6 | #include "pump.h" |
6 | 7 | |
7 | 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 | 20 | if (heat_ok && coffee_wanted) |
22 | 21 | { |
... | ... | @@ -34,4 +33,6 @@ void* processHeat(void* arg) |
34 | 33 | } |
35 | 34 | sleep(1); |
36 | 35 | } |
36 | + | |
37 | + return NULL; | |
37 | 38 | } | ... | ... |