fix some thing
This commit is contained in:
@ -11,8 +11,16 @@ String HumiTemp::read(){
|
||||
int hum = this->capteur->readHumidity(true);
|
||||
int temp = this->capteur->readTemperature(false,true);
|
||||
|
||||
String stemp = this->fullVall.substring(0, this->fullVall.indexOf("/"));
|
||||
String shum = this->fullVall.substring(this->fullVall.indexOf("/")+1, this->fullVall.length());
|
||||
|
||||
int mintemp = stemp.substring(0, stemp.indexOf(":")).toInt();
|
||||
int maxtemp = stemp.substring(stemp.indexOf(":")+1, stemp.length()).toInt();
|
||||
int minhum = shum.substring(0, shum.indexOf(":")).toInt();
|
||||
int maxhum = shum.substring(shum.indexOf(":")+1, shum.length()).toInt();
|
||||
|
||||
//valeur pour un élevage d'astico de pèche selon chatGPT
|
||||
if((temp > 20 && temp < 30) && (hum > 60 && hum < 80)){//TODO: passer les valeurs en config
|
||||
if((temp > mintemp && temp < maxtemp) && (hum > minhum && hum < maxhum)){
|
||||
this->full = true;
|
||||
}else{
|
||||
this->full = false;
|
||||
|
@ -9,11 +9,11 @@ Ultrason::Ultrason(int trigeur, int echo, String fullVall):
|
||||
|
||||
String Ultrason::read(){
|
||||
int sortie = this->capteur->read();
|
||||
if (sortie < this->fullVall.toInt())
|
||||
if (sortie < this->fullVall.substring(0, this->fullVall.indexOf("/")).toInt())
|
||||
{
|
||||
this->full = true;
|
||||
}else{
|
||||
}else if (sortie > this->fullVall.substring(this->fullVall.indexOf("/")+1, this->fullVall.length()).toInt()){
|
||||
this->full = false;
|
||||
}
|
||||
return String(sortie);
|
||||
}//TODO: faire en sorte que full se reset avec une autre val
|
||||
}
|
Reference in New Issue
Block a user