From bb8c27998dbf7650bedcf96a4635a887d9a86ce0 Mon Sep 17 00:00:00 2001 From: henyxia Date: Wed, 22 Apr 2015 14:53:25 +0200 Subject: [PATCH] Fixed version --- heat.c | 5 +++-- hvc.c | 24 ++++++++++++++++++++++-- hvc.h | 4 ++++ pump.c | 21 +++++++++++---------- 4 files changed, 40 insertions(+), 14 deletions(-) diff --git a/heat.c b/heat.c index 44b4519..8850221 100644 --- a/heat.c +++ b/heat.c @@ -35,10 +35,11 @@ bool heat_ok=false; bool hold_heat=true; bool pumpitup=false; //Lecture de l'état de la pompe bool eco_mode=false; +bool stopHeat=false; void* processHeat(void* arg) { - while(!stop) + while(!stopHeat) { tNow = clock(); @@ -230,5 +231,5 @@ void* processHeat(void* arg) } -return NULL; + return NULL; } diff --git a/hvc.c b/hvc.c index 1299afc..6be249d 100644 --- a/hvc.c +++ b/hvc.c @@ -32,7 +32,7 @@ int hvc_fd = -1; bool hvcStop = false; bool sPump = false; bool sHeat = false; -bool autoHeat = false; +bool autoHeat = false; struct termios hvcSaveterm; bool wHeat = false; bool wPump = false; @@ -42,7 +42,27 @@ double tHeatTimer; time_t tPumpStart; double tPumpTimer; time_t tPumpStop; -int tempCons; +int tempCons; + +void setPumpOn() +{ + setPumpWantedState(true); +} + +void setPumpOff() +{ + setPumpWantedState(false); +} + +void setHeatOn() +{ + setHeatWantedState(true); +} + +void setHeatOff() +{ + setHeatWantedState(false); +} void stopHVC() { diff --git a/hvc.h b/hvc.h index 9ff2339..63685c6 100644 --- a/hvc.h +++ b/hvc.h @@ -10,5 +10,9 @@ void setPumpWantedState(bool); void setHeatWantedState(bool); void setPumpTimer(double); void setHeatTimer(double); +void setHeatOn(); +void setHeatOff(); +void setPumpOn(); +void setPumpOff(); #endif diff --git a/pump.c b/pump.c index b6bcad7..81bdf21 100644 --- a/pump.c +++ b/pump.c @@ -1,22 +1,21 @@ #include #include #include +#include #include "hvc.h" #include "pump.h" #define K_DEB 1925 //en imp/L - -//Globals -bool stop=false; -bool heat_ok=false; -bool coffee_wanted=false; -int volDeb=0; // Volume du débitmetre en impulsion -int volWanted=0; - -void* processHeat(void* arg) +void* processPump(void* arg) { - while (!stop) + bool stopPump=false; + bool heat_ok=false; + bool coffee_wanted=false; + int volDeb=0; // Volume du débitmetre en impulsion + int volWanted=0; + + while (!stopPump) { if (heat_ok && coffee_wanted) { @@ -34,4 +33,6 @@ void* processHeat(void* arg) } sleep(1); } + + return NULL; } -- libgit2 0.21.2