fix some thing
This commit is contained in:
parent
650290ab67
commit
7b21441976
@ -45,7 +45,9 @@ build_flags =
|
|||||||
-D API_HOST=\"iot.epi.cb85.software\"
|
-D API_HOST=\"iot.epi.cb85.software\"
|
||||||
|
|
||||||
;---CAPTEUR FULL CONFIG---
|
;---CAPTEUR FULL CONFIG---
|
||||||
|
;valFull/valReset
|
||||||
-D ULTRA_SOUND_FULL=\"10\"
|
-D ULTRA_SOUND_FULL=\"5/10\"
|
||||||
|
;tempmin:tempmax/hummin:humax
|
||||||
-D DHT_FULL=\"20:30/60:80\"
|
-D DHT_FULL=\"20:30/60:80\"
|
||||||
|
;poid max
|
||||||
-D POID_FULL=\"100\"
|
-D POID_FULL=\"100\"
|
@ -49,8 +49,6 @@ public:
|
|||||||
*/
|
*/
|
||||||
bool connect();
|
bool connect();
|
||||||
|
|
||||||
//TODO :: Check wifibegin avant
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
|
||||||
@ -89,7 +87,11 @@ private:
|
|||||||
*/
|
*/
|
||||||
String token;
|
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->https = https;
|
||||||
this->token = "";
|
this->token = "";
|
||||||
this->client = new WiFiEspClient();
|
this->client = new WiFiEspClient();
|
||||||
|
this->init = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool API::wifiBegin(String wifiId, String wifiPass, Stream* espSerial){
|
bool API::wifiBegin(String wifiId, String wifiPass, Stream* espSerial){
|
||||||
WiFi.init(espSerial);
|
WiFi.init(espSerial);
|
||||||
|
this->init = true;
|
||||||
|
|
||||||
// check for the presence of the shield
|
// check for the presence of the shield
|
||||||
if (WiFi.status() == WL_NO_SHIELD) {
|
if (WiFi.status() == WL_NO_SHIELD) {
|
||||||
@ -28,6 +30,7 @@ bool API::wifiBegin(String wifiId, String wifiPass, Stream* espSerial){
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
bool API::connect(){
|
bool API::connect(){
|
||||||
|
if(!this->init)return false;
|
||||||
this->client->stop();
|
this->client->stop();
|
||||||
bool sortie = false;
|
bool sortie = false;
|
||||||
|
|
||||||
|
@ -11,8 +11,16 @@ String HumiTemp::read(){
|
|||||||
int hum = this->capteur->readHumidity(true);
|
int hum = this->capteur->readHumidity(true);
|
||||||
int temp = this->capteur->readTemperature(false,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
|
//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;
|
this->full = true;
|
||||||
}else{
|
}else{
|
||||||
this->full = false;
|
this->full = false;
|
||||||
|
@ -9,11 +9,11 @@ Ultrason::Ultrason(int trigeur, int echo, String fullVall):
|
|||||||
|
|
||||||
String Ultrason::read(){
|
String Ultrason::read(){
|
||||||
int sortie = this->capteur->read();
|
int sortie = this->capteur->read();
|
||||||
if (sortie < this->fullVall.toInt())
|
if (sortie < this->fullVall.substring(0, this->fullVall.indexOf("/")).toInt())
|
||||||
{
|
{
|
||||||
this->full = true;
|
this->full = true;
|
||||||
}else{
|
}else if (sortie > this->fullVall.substring(this->fullVall.indexOf("/")+1, this->fullVall.length()).toInt()){
|
||||||
this->full = false;
|
this->full = false;
|
||||||
}
|
}
|
||||||
return String(sortie);
|
return String(sortie);
|
||||||
}//TODO: faire en sorte que full se reset avec une autre val
|
}
|
@ -45,5 +45,4 @@ void Program::loop(){
|
|||||||
|
|
||||||
Serial.println();
|
Serial.println();
|
||||||
|
|
||||||
delay(1000);
|
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user