feat: main-algo #16
@ -3,6 +3,7 @@
|
||||
|
||||
#include "DolibarrClient.h"
|
||||
#include "GRBL.h"
|
||||
#include "NfcReader.h"
|
||||
#include <Arduino.h>
|
||||
#include <M5Stack.h>
|
||||
// #include <vector>
|
||||
@ -27,6 +28,12 @@ private:
|
||||
* @brief stepper motor controller
|
||||
*/
|
||||
GRBL* grbl;
|
||||
|
||||
/**
|
||||
* @brief nfc reader
|
||||
*
|
||||
*/
|
||||
NfcReader* NFC;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -26,6 +26,8 @@ Program::Program() {
|
||||
this->grbl = new GRBL(STEPMOTOR_I2C_ADDR);
|
||||
Wire.begin(21, 22);
|
||||
grbl->init(STEPER_SPEED, STEPER_PAS, STEPER_ACC);
|
||||
|
||||
this->NFC = new NfcReader(NFC_ADDR);
|
||||
}
|
||||
|
||||
void Program::loop() {
|
||||
@ -40,18 +42,36 @@ void Program::loop() {
|
||||
// if(this->NfcIDs->size() > 0){
|
||||
// }
|
||||
|
||||
|
||||
//alog V1
|
||||
//algo V1
|
||||
//je lis la valeur NFC
|
||||
String nfcId = this->NFC->ReadNfc();
|
||||
//si qqc
|
||||
if(nfcId != "0"){
|
||||
//j'arrète le stepper
|
||||
//this->grbl->stop(); //FIXME: implemente
|
||||
//j'affiche le tag lue
|
||||
Serial.print("new colis in comming : ");
|
||||
Serial.println(nfcId);
|
||||
//je demande a dolibard ou j'envoie
|
||||
Serial.println("Demande a dolibard");
|
||||
delay(500);// TODO: remove mock
|
||||
//j'envoie au servo la commande
|
||||
Serial.print("Servo : ");
|
||||
Serial.println("Droite");
|
||||
delay(500);// TODO: remove mock
|
||||
//j'avance le moteur jusqu'a X (a definir)
|
||||
//si rien j'avance le moteur (5mm)
|
||||
|
||||
this->grbl->mouveForward(CONVOYER_LEN);
|
||||
}else{
|
||||
//si rien
|
||||
//je check si le stepper est en iddle
|
||||
if(this->grbl->isIddle()){
|
||||
//si oui j'avance de 5 mm
|
||||
this->grbl->mouveForward(5);
|
||||
}
|
||||
}
|
||||
//j'update la position du servo
|
||||
|
||||
//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
|
||||
@ -65,15 +85,11 @@ void Program::loop() {
|
||||
//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
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user