feat/output-reader #20

Merged
Clement merged 5 commits from feat/output-reader into develop 2024-02-02 15:43:14 +00:00
4 changed files with 16 additions and 11 deletions
Showing only changes of commit 35ecce7d5d - Show all commits

View File

@ -6,6 +6,7 @@
#include "ServoMotorComponent.h"
#include "NfcReader.h"
#include "GRBL.h"
#include "BigNfcReader.h"
class Program {
public:
@ -26,6 +27,7 @@ private:
ServoMotorComponent *servo;
NfcReader *nfcReader;
GRBL *grbl;
BigNfcReader* outputReader;
};
#endif

View File

@ -1,14 +1,14 @@
#ifndef NFC_READER_H
#define NFC_READER_H
#ifndef BIG_NFC_READER_H
#define BIG_NFC_READER_H
#include <Arduino.h>
#include <vector>
#include "TrameList.h"
class NfcReader{
class BigNfcReader{
public:
NfcReader();
BigNfcReader();
/**
* @brief initialise le lecteur NFC

View File

@ -1,14 +1,14 @@
#include "../include/NfcReader.h"
#include "../include/BigNfcReader.h"
NfcReader::NfcReader(){
BigNfcReader::BigNfcReader(){
Serial2.begin(115200,SERIAL_8N1,2,3);//TODO: mettre le port série en paramètre
this->pair = true;
this->trame = new std::vector<byte>();
}
bool NfcReader::init(){
bool BigNfcReader::init(){
const std::vector<std::vector<byte>> INIT_TRAMES = {INIT_TRAM_0, INIT_TRAM_1, INIT_TRAM_2, INIT_TRAM_3, INIT_TRAM_4, INIT_TRAM_5, INIT_TRAM_6, INIT_TRAM_7};
const std::vector<std::vector<byte>> REP_TRAMES = {REP_TRAM_0, REP_TRAM_1, REP_TRAM_2, REP_TRAM_3, REP_TRAM_4, REP_TRAM_5, REP_TRAM_6, REP_TRAM_7};
int repnb = 0;
@ -30,7 +30,7 @@ bool NfcReader::init(){
return true;
}
void NfcReader::refresh(){
void BigNfcReader::refresh(){
this->trame->clear();
std::vector<byte> trame = READ_TRAM_0;
if (this->pair){
@ -48,7 +48,7 @@ void NfcReader::refresh(){
}
String NfcReader::digitify(int number){
String BigNfcReader::digitify(int number){
String sortie = "";
if(number <= 0xF){
@ -62,7 +62,7 @@ String NfcReader::digitify(int number){
}
void NfcReader::printTrame(){
void BigNfcReader::printTrame(){
for(byte i: *this->trame){
Serial.print(this->digitify(i));
Serial.print(" ");
@ -70,6 +70,6 @@ void NfcReader::printTrame(){
Serial.println();
}
int NfcReader::getNbTags(){
int BigNfcReader::getNbTags(){
return this->trame->at(8);
}

View File

@ -80,6 +80,7 @@ Program::Program() {
this->servo = new ServoMotorComponent(2, 1, 1);
this->servo->setDesiredPosition(Position::MIDDLE);
this->grbl = new GRBL(STEPMOTOR_I2C_ADDR);
this->outputReader = new BigNfcReader();
Wire.begin(21, 22);
grbl->init(STEPER_SPEED, STEPER_PAS, STEPER_ACC);
struct WifiConfig wifi_c = {WIFI_SSID, WIFI_PASSWORD};
@ -97,6 +98,8 @@ void Program::loop() {
derniereExecution = maintenant;
}
this->servo->refresh();
this->outputReader->refresh();
Serial.printf("Output colis number : ", this->outputReader->getNbTags());
String nfcId = this->nfcReader->ReadNfc();
//si qqc