fix: RM-all-todo #49
@ -45,7 +45,9 @@ build_flags =
|
||||
-D API_HOST=\"iot.epi.cb85.software\"
|
||||
|
||||
;---CAPTEUR FULL CONFIG---
|
||||
|
||||
-D ULTRA_SOUND_FULL=\"10\"
|
||||
;valFull/valReset
|
||||
-D ULTRA_SOUND_FULL=\"5/10\"
|
||||
;tempmin:tempmax/hummin:humax
|
||||
-D DHT_FULL=\"20:30/60:80\"
|
||||
;poid max
|
||||
-D POID_FULL=\"100\"
|
@ -49,8 +49,6 @@ public:
|
||||
*/
|
||||
bool connect();
|
||||
|
||||
//TODO :: Check wifibegin avant
|
||||
|
||||
private:
|
||||
|
||||
|
||||
@ -89,7 +87,11 @@ private:
|
||||
*/
|
||||
String token;
|
||||
|
||||
|
||||
/**
|
||||
* @brief wifi démmaré
|
||||
*
|
||||
*/
|
||||
bool init;
|
||||
|
||||
};
|
||||
|
||||
|
@ -8,11 +8,13 @@ API::API(String user, String password, String host, bool https){
|
||||
this->https = https;
|
||||
this->token = "";
|
||||
this->client = new WiFiEspClient();
|
||||
this->init = false;
|
||||
}
|
||||
|
||||
|
||||
bool API::wifiBegin(String wifiId, String wifiPass, Stream* espSerial){
|
||||
WiFi.init(espSerial);
|
||||
this->init = true;
|
||||
|
||||
// check for the presence of the shield
|
||||
if (WiFi.status() == WL_NO_SHIELD) {
|
||||
@ -28,6 +30,7 @@ bool API::wifiBegin(String wifiId, String wifiPass, Stream* espSerial){
|
||||
return true;
|
||||
}
|
||||
bool API::connect(){
|
||||
if(!this->init)return false;
|
||||
this->client->stop();
|
||||
bool sortie = false;
|
||||
|
||||
|
@ -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
|
||||
}
|
@ -45,5 +45,4 @@ void Program::loop(){
|
||||
|
||||
Serial.println();
|
||||
|
||||
delay(1000);
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user