4 Commits

Author SHA1 Message Date
23651cb6d5 fix diagramme 2023-05-14 23:26:16 +02:00
0037b1831a rm debug 2023-05-14 23:17:05 +02:00
7b21441976 fix some thing 2023-05-14 23:16:16 +02:00
650290ab67 fix readme iot 2023-05-14 22:26:32 +02:00
10 changed files with 40 additions and 40 deletions

View File

@ -3,4 +3,6 @@
## setup :
rename `secrets.ini.example` to `secrets.ini`
renomé `secrets.ini.example` to `secrets.ini` et le remplir
compiler avec Platform.io

View File

@ -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\"

View File

@ -41,7 +41,7 @@ class Balance{
+ tar(val: int = 0): bool
}
class Ultrason{
class HumiTemp{
- capteur: DHT*
+ HumiTemp(pin: int, type: String, fullVal: String)
+ read(): String
@ -53,6 +53,15 @@ class Ultrason{
+ read(): String
}
class OledScreen{
- display: Adafruit_SSD1306*
+ OledScreen(screenWidth: int, screenHeight: int, oledResetPin: int = -1)
+ welcome(): void
+ clear(): void
+ wifiWaiting(): void
+ printVal(distance: String, poid: String, humitemp: String): void
}
Balance --|> Capteur
Ultrason --|> Capteur
HumiTemp --|> Capteur
@ -62,5 +71,8 @@ Program <-- Balance
Program <-- Ultrason
Program <-- HumiTemp
Program <- API
OledScreen -> Program
@enduml

View File

@ -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;
};

View File

@ -8,15 +8,16 @@ 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) {
Serial.println("WiFi shield not present"); // FIXME: rm debug
return false;
}
@ -28,6 +29,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;

View File

@ -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;

View File

@ -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
}

View File

@ -21,13 +21,6 @@ public:
*/
void welcome();
/**
* @brief print the total amount on the screen
*
* @param amount The total amount to print in centimes
*/
void printAmount(int amount);
/**
* @brief Clear the screen

View File

@ -40,26 +40,6 @@ void OledScreen::printVal(String distance, String poid, String humitemp){
void OledScreen::printAmount(int amount) {
this->display->clearDisplay();
this->display->setCursor(0, 0);
this->display->setTextSize(2);
this->display->setTextColor(WHITE);
this->display->println(F(" Total: "));
this->display->println();
this->display->print(amount / 100);
this->display->print(F(","));
int centimes = amount % 100;
if (centimes < 10) {
this->display->print(F("0"));
}
this->display->println(centimes);
this->display->print(F(" EUR"));
this->display->display();
}
void OledScreen::wifiWaiting() {
this->clear();
this->display->setCursor(0, 0);

View File

@ -45,5 +45,4 @@ void Program::loop(){
Serial.println();
delay(1000);
}