From d8f0bb07be101e5634db3fd1b9f8028f015e61eb Mon Sep 17 00:00:00 2001 From: Clement Date: Thu, 18 Jan 2024 19:16:23 +0100 Subject: [PATCH] =?UTF-8?q?add=20id=C3=A9e=20d'algo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- include/Program.h | 17 +++++++++++++++- src/Program.cpp | 50 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 66 insertions(+), 1 deletion(-) diff --git a/include/Program.h b/include/Program.h index b4f30bb..949efc8 100644 --- a/include/Program.h +++ b/include/Program.h @@ -1,9 +1,11 @@ #ifndef PROGRAM_H #define PROGRAM_H -#include "Arduino.h" #include "DolibarrClient.h" +#include "GRBL.h" +#include #include +#include class Program { public: @@ -16,8 +18,21 @@ public: * Program WarehouseGUI loop */ void loop(); + private: + DolibarrClient *client; + + /** + * @brief stepper motor controller + */ + GRBL* grbl; + + /** + * @brief stack des UUID lue + * + */ + std::vector* NfcIDs; }; #endif diff --git a/src/Program.cpp b/src/Program.cpp index 8454899..45e9961 100644 --- a/src/Program.cpp +++ b/src/Program.cpp @@ -21,9 +21,59 @@ Program::Program() { struct DolibarrConfig dolibarr = {DOLIBARR_URL, DOLIBARR_API_TOKEN}; initialize_wifi(wifi_c); this->client = new DolibarrClient(dolibarr); + + // initialisation GRBL + this->grbl = new GRBL(STEPMOTOR_I2C_ADDR); + Wire.begin(21, 22); + grbl->init(STEPER_SPEED, STEPER_PAS, STEPER_ACC); } void Program::loop() { + if(this->grbl->) + this->grbl->mouveForward(5); //TODO: réglé pour qu'il avance de la bonne distance + String nfcIn = "0"; // TODO: si le lecteur envoie qqc + //TODO: refrech servo + if(nfcIn !="0"){ + //envoyer sur dolibard + this->NfcIDs->push_back(nfcIn); + } + if(this->NfcIDs->size() > 0){ + + } + + //alog V1 + //je lis la valeur NFC + //si qqc + //je demande a dolibard ou j'envoie + //j'envoie au servo la commande + //j'avance le moteur jusqu'a X (a definir) + //si rien j'avance le moteur (5mm) + + + //idée algo v1.5 (ajou petite gestion d'erreur) + //alog V1 + //je lis la valeur NFC + //si qqc + //je demande a dolibard ou j'envoie + //j'envoie au servo la commande + //j'avance le moteur jusqu'a X (a definir) + //si rien j'avance le moteur (5mm) + //si le lecteur de sortie voi pas de colis + //on affiche une erreur de colis non lue + //si un seul colis + //on dit que le colis est bien trié (avec porte de sortie) + //si il y a 2 colis (ou plus) + //on affiche une erreur de bourrage + + + + //idée algo v2 + //utiliser une pile + //utiliser le 2nd lecteur pour vidé la pile + //gestion d'erreur complete avec celle du dessus plus celle de la pile + + + }