11 Commits

Author SHA1 Message Date
f64264631e Merge branch 'develop' of ssh://git.lab-ouest.org:8022/Epitech/T-IOT-901_convoyor into feat/main-algo
# Conflicts:
#	config.ini
#	include/Program.h
#	lib/NFC/src/NfcReader.cpp
#	src/Program.cpp
2024-01-26 09:46:49 +01:00
68a4ab9755 Merge pull request 'feat/m5_lcd' (#19) from feat/m5_lcd into develop
Reviewed-on: #19
2024-01-26 09:40:59 +01:00
b3ef581d28 Merge remote-tracking branch 'origin/develop' into feat/main-algo 2024-01-19 12:05:17 +01:00
29c41b6ccc add some affichage idea 2024-01-18 21:06:14 +01:00
04474bfb94 add main algo V1 with mock 2024-01-18 21:02:11 +01:00
463e71fe10 rename nfc reader 2024-01-18 21:01:53 +01:00
76ebc00763 add is idle condition on RGBL lib 2024-01-18 21:01:02 +01:00
8bdd4a9be2 add convoyer len and nfc i2C addr 2024-01-18 21:00:36 +01:00
f947fc7e5f Merge remote-tracking branch 'origin/feat/nfc-reader' into feat/main-algo 2024-01-18 19:53:23 +01:00
b96088c4eb cleanup 2024-01-18 19:32:02 +01:00
d8f0bb07be add idée d'algo 2024-01-18 19:16:23 +01:00
7 changed files with 21 additions and 11 deletions

View File

@ -36,4 +36,4 @@ build_flags =
-D RIGHT_POS=18 -D RIGHT_POS=18
-D MIDDLE_POS=32 -D MIDDLE_POS=32
-D LEFT_POS=52 -D LEFT_POS=52
-D CONVOYER_LEN=100 -D CONVOYER_LEN=150 ;mm

View File

@ -1,7 +1,6 @@
#ifndef PROGRAM_H #ifndef PROGRAM_H
#define PROGRAM_H #define PROGRAM_H
#include "Arduino.h"
#include "DolibarrClient.h" #include "DolibarrClient.h"
#include <M5Stack.h> #include <M5Stack.h>
#include "ServoMotorComponent.h" #include "ServoMotorComponent.h"

View File

@ -8,6 +8,7 @@ class iGRBL{
public: public:
virtual void init(int speed, double pas, int accel, String mode = "distance") = 0; virtual void init(int speed, double pas, int accel, String mode = "distance") = 0;
virtual void mouveForward(int mm) = 0; virtual void mouveForward(int mm) = 0;
virtual bool isIddle() = 0;
}; };
class GRBL : public iGRBL{ class GRBL : public iGRBL{
@ -15,6 +16,7 @@ public:
GRBL(int grblAddr); GRBL(int grblAddr);
void init(int speed, double pas, int accel, String mode = "distance") override; void init(int speed, double pas, int accel, String mode = "distance") override;
void mouveForward(int mm = 5) override; void mouveForward(int mm = 5) override;
bool isIddle() override;
private: private:
Module_GRBL* grbl; Module_GRBL* grbl;
}; };

View File

@ -32,3 +32,13 @@ void GRBL::mouveForward(int mm){
sprintf(s, "G1 X%d", mm); sprintf(s, "G1 X%d", mm);
this->grbl->sendGcode(s); this->grbl->sendGcode(s);
} }
bool GRBL::isIddle(){
bool sortie = false;
if(this->grbl->readStatus().indexOf("IDLE") != -1){
sortie = true;
}
return sortie;
}

View File

@ -11,7 +11,7 @@ String NfcReader::ReadNfc()
this->uid.clear(); this->uid.clear();
if (!this->mfrc522->PICC_IsNewCardPresent() || if (!this->mfrc522->PICC_IsNewCardPresent() ||
!this->mfrc522->PICC_ReadCardSerial()) { !this->mfrc522->PICC_ReadCardSerial()) {
return ("0"); return "0";
} }
for (unsigned int i = 0; i < this->mfrc522->uid.size; i++) { for (unsigned int i = 0; i < this->mfrc522->uid.size; i++) {
if (this->mfrc522->uid.uidByte[i] < 0xF) { if (this->mfrc522->uid.uidByte[i] < 0xF) {

View File

@ -1,5 +1,5 @@
#ifndef NFCREADER_HPP_ #ifndef NFCREADER_H
#define NFCREADER_HPP_ #define NFCREADER_H
#include <M5Stack.h> #include <M5Stack.h>
#include "MFRC522_I2C.h" #include "MFRC522_I2C.h"
@ -19,4 +19,4 @@ class NfcReader {
String uid; String uid;
}; };
#endif /* !NFCREADER_HPP_ */ #endif /* !NFCREADER_H */

View File

@ -152,9 +152,8 @@ void Program::loop() {
} }
this->grbl->mouveForward(CONVOYER_LEN); this->grbl->mouveForward(CONVOYER_LEN);
} else { } else {
//si rien if(this->grbl->isIddle()){
//je check si le stepper est en iddle this->grbl->mouveForward(5);
//this->grbl->mouveForward(5); }
} }
} }