I used to use 1.5.10 version, and mu code works fine. but, after updated doesnt work.Started w/ minor issue that was in changing the air data rate, higher data rates was received, and lower data rates was'nt received. I already try to downgrade version, download directly from here. As last test I've adapted the code to use w EBYTE.h lib. but this last one, dont implement some features that LoRa_E32 implements.
Code from TX :
`//Includes
include
include "LoRa_E32.h"
include
include "stdlib.h"
include "string.h"
include
include
// RTCC
RTC_DS3231 rtc; //OBJETO DO TIPO RTC_DS3231
int testSf;
char key;
unsigned long lastRetransmitTime = 0;
unsigned long minRetransmitInterval = 500;
int retransmitBackoff = 0;
unsigned long minSendInterval = 1000; // tempo mínimo entre o envio de dois pacotes (em ms)
unsigned long lastSentTime = 0; // última vez que um pacote foi enviado (em ms)
int mudasf;
int needRetrans[10] = {0};
int currentPacketIndex = 0;
struct DATA {
unsigned long pct_id=0;
unsigned long timestamp;
unsigned long milis;
unsigned long actualMillis;
};
DATA MyData;
DATA queue[10];
int repeatCount[10] = {0};
unsigned long sentTime[10] = {0};
unsigned long timeZero;
unsigned long time2;
// create a serial object for Arduino, again Teensy uses a much simpler #define scenario
SoftwareSerial ESerial(2, 3);
// Now you MUST create the transceiver object and you must pass in the serail object use the & to pass by reference
// usage for teensy is the exact same
// M0, M1, and Aux pins are next
LoRa_E32 e32ttl100(&ESerial, 4, 5, 6);
int n =0;
void setup() {
// you should set the pin modes, MO, and M1 are to set the usage state of the EBYTE, aux is for reading states of the EBYTE
pinMode(4, OUTPUT);
pinMode(5, OUTPUT);
pinMode(6, INPUT);
Serial.begin(9600);
if(! rtc.begin()) { // SE O RTC NÃO FOR INICIALIZADO, FAZ
Serial.println("DS3231 não encontrado");
}
if(rtc.lostPower()){ //SE RTC FOI LIGADO PELA PRIMEIRA VEZ / FICOU SEM ENERGIA / ESGOTOU A BATERIA, FAZ
Serial.println("DS3231 OK!");
}
delay(100); //INTERVALO DE 100 MILISSEGUNDOS
rtc.adjust(1684330529);
e32ttl100.begin();
ResponseStructContainer c;
c = e32ttl100.getConfiguration();
// It's important get configuration pointer before all other operation
Configuration configuration = (Configuration)c.data;
//configuration.OPTION.fixedTransmission = FT_TRANSPARENT_TRANSMISSION;
// configurar o sf no 7
//configuration.SPED.airDataRate = AIR_DATA_RATE_101_192; // TABELA ATUALIZADA SF 7
// It's important get configuration pointer before all other operation
ResponseStatus rs = e32ttl100.setConfiguration(configuration, WRITE_CFG_PWR_DWN_LOSE);
e32ttl100.setMode(MODE_0_NORMAL); //e32ttl.setMode(MODE_2_POWER_SAVING);
Serial.println(F(" ----- MENU DE CONFIGURAÇÂO ------- \n5. TX s/ CONFIANÇA 6. TX c/ CONFIANÇA"));
}
void loop(){
while(testSf < 1){
Serial.println(F("-------- iniciando transmissão em 5s ------ "));
delay(7500);
DateTime now = rtc.now();
int repeat = 0;
unsigned long tempof;
unsigned long tempog;
unsigned long elapsed;
tempog = 0;
tempof = millis();
elapsed = millis();
while (repeat < 1) {
repeat++;
tempof = millis();
while (tempog <= 150000) {
tempo30 = millis();
if(millis()-elapsed >= 1000){
MyData.pct_id++;
MyData.timestamp = rtc.now().unixtime();
MyData.milis = millis();
MyData.actualMillis = millis();
Serial.print((MyData.pct_id));Serial.print(F(","));
Serial.print((timeConvert = MyData.timestamp).timestamp());
Serial.print(F(","));
Serial.print(MyData.milis);Serial.print(F(","));
ResponseStatus rs = e32ttl100.sendMessage(&MyData, sizeof(DATA));
Serial.println(millis());
tempog = tempo30 - tempof;
elapsed = millis();
}
}
tempo30=0;
tempog = 0;
tempof = millis();
MyData.pct_id = 0;
Serial.println(F("------------------ Teste C Confiança A Seguir em 10s--------------"));
delay(28000);
}
elapsed = 0;
tempog = 0 ;
unsigned long stop;
stop = rtc.now().unixtime();
tempog = millis();
int x = 0;
int z =0;
while(x<1){
elapsed = millis() - tempog;
if(elapsed >= 1500){
if(isQueueFull() == true){
waitAck();
Serial.println(F("FILA CHEIA"));
while(z<1){
checkTimeouts();
resendPacket2();
waitAck();
if(isQueueFull() == false){
z++;
}
}
}
if (constructPacket() == true){
int index = updateQueue();
sendPacket((size_t)index, false);
tempog = millis();
}
}
waitAck();
checkTimeouts();
resendPacket();
z = 0;
if ((rtc.now().unixtime() - stop) >= 150){ // VOLTAR PRO 150 NÃO ESQUECER
x++;
if (hasDataInQueue() == true){
while(n < 1){
resendPacket2();
waitAck();
checkTimeouts();
if(hasDataInQueue() == false){
n++;
}
}
}
MyData.pct_id = 0;
lastSent = 0;
testSf = 1;
Serial.println(F("--------- FIM DO TESTE ---------"));
}
}
}
}
bool hasDataInQueue(){
for (int i = 0; i < 9; i++){
if (queue[i].pct_id !=0){
return true;
}
}
return false;
}
bool isQueueFull() {
for (int i = 0; i < 9; i++) {
if (queue[i].timestamp == 0) { // Se encontrar uma posição vazia
return false; // A fila não está cheia
return i;
}
}
return true; // A fila está cheia
}
int removePacketFromQueue(int value, bool is_index) {
if (is_index) {
if (value < 0 || value >= 10) {
return -1; // Índice inválido
}
// Remove o pacote da fila
for (int j = value; j < 9; j++) {
queue[j] = queue[j+1];
sentTime[j] = sentTime[j+1];
needRetrans[j] = needRetrans[j+1];
repeatCount[j] = repeatCount[j+1];
}
// Define os valores da posição final como 0
queue[9].pct_id = 0;
queue[9].timestamp = 0;
queue[9].milis = 0;
sentTime[9] = 0;
needRetrans[9] = 0;
repeatCount[9]=0;
return value; // Retorna o índice do pacote removido
} else {
for (int i = 0; i < 10; i++) {
if (queue[i].pct_id == value) {
// Remove o pacote da fila
for (int j = i; j < 9; j++) {
queue[j] = queue[j+1];
sentTime[j] = sentTime[j+1];
repeatCount[j]= repeatCount[j+1];
}
// Define os valores da posição final como 0
queue[9].pct_id = 0;
queue[9].timestamp = 0;
queue[9].milis = 0;
sentTime[9] = 0;
needRetrans[9] = 0;
repeatCount[9]=0;
return i; // Retorna o índice do pacote removido
}
}
return -1; // Retorna -1 caso o pacote não seja encontrado na fila
}
}
void waitAck(){
for (int i =0; i < 10; i++){
if(e32ttl100.available() > 0){
ResponseStructContainer rsc = e32ttl100.receiveMessage(sizeof(ACK));
struct ACK ack = (ACK) rsc.data;
if(ack.ack == 1){
Serial.print(F("ACKED pct id: "));Serial.println(ack.ACKED_PCT_ID);
int pctAckered = ack.ACKED_PCT_ID;
int index = removePacketFromQueue(pctAckered,false);
//repeatCount[index] = 0;
}
//rsc.close();
}
}
}
void checkTimeouts() {
for (int i = 0; i < 10; i++) {
if (sentTime[i] != 0) { // Verifica se o tempo foi registrado
unsigned long elapsedTime = (rtc.now().unixtime() - sentTime[(i)]);
if (elapsedTime >= 4 ) { // Verifica se o tempo estourou
needRetrans[(i)] = queue[(i)].pct_id;
}
}
}
}
int updateQueue() {
static int j = 0;
if (queue[j].pct_id != 0) { // se a posição não estiver vazia
j++; // avança para a próxima posição
if (j >= 10) {
j = 0;
}
}
queue[j].timestamp = MyData.timestamp;
queue[j].pct_id = MyData.pct_id;
queue[j].milis = MyData.milis;
return j;
}
DATA queue[10];
int repeatCount[10];
unsigned long sentTime[10];
unsigned long timeZero;
unsigned long time2;
// create a serial object for Arduino, again Teensy uses a much simpler #define scenario
SoftwareSerial ESerial(2, 3);
// Now you MUST create the transceiver object and you must pass in the serail object use the & to pass by reference
// usage for teensy is the exact same
// M0, M1, and Aux pins are next
LoRa_E32 e32ttl100(&ESerial, 4, 5, 6);
void setup() {
// you should set the pin modes, MO, and M1 are to set the usage state of the EBYTE, aux is for reading states of the EBYTE
pinMode(4, OUTPUT);
pinMode(5, OUTPUT);
pinMode(6, INPUT);
Serial.begin(9600);
if(! rtc.begin()) { // SE O RTC NÃO FOR INICIALIZADO, FAZ
Serial.println("DS3231 não encontrado");
}
if(rtc.lostPower()){ //SE RTC FOI LIGADO PELA PRIMEIRA VEZ / FICOU SEM ENERGIA / ESGOTOU A BATERIA, FAZ
Serial.println("DS3231 OK!");
}
delay(100); //INTERVALO DE 100 MILISSEGUNDOS
e32ttl100.begin();
//ResponseStructContainer c;
//c = e32ttl100.getConfiguration();
// It's important get configuration pointer before all other operation
//Configuration configuration = (Configuration)c.data;
//configuration.OPTION.fixedTransmission = FT_TRANSPARENT_TRANSMISSION;
//configuration.SPED.airDataRate = AIR_DATA_RATE_101_192; // TABELA ATUALIZADA SF 7
// It's important get configuration pointer before all other operation
// ResponseStatus rs = e32ttl100.setConfiguration(configuration, WRITE_CFG_PWR_DWN_LOSE);
I used to use 1.5.10 version, and mu code works fine. but, after updated doesnt work.Started w/ minor issue that was in changing the air data rate, higher data rates was received, and lower data rates was'nt received. I already try to downgrade version, download directly from here. As last test I've adapted the code to use w EBYTE.h lib. but this last one, dont implement some features that LoRa_E32 implements. Code from TX : `//Includes
include
include "LoRa_E32.h"
include
include "stdlib.h"
include "string.h"
include
include
// RTCC RTC_DS3231 rtc; //OBJETO DO TIPO RTC_DS3231
int testSf;
char key;
unsigned long lastRetransmitTime = 0; unsigned long minRetransmitInterval = 500; int retransmitBackoff = 0; unsigned long minSendInterval = 1000; // tempo mínimo entre o envio de dois pacotes (em ms) unsigned long lastSentTime = 0; // última vez que um pacote foi enviado (em ms)
int mudasf; int needRetrans[10] = {0};
int currentPacketIndex = 0;
struct DATA { unsigned long pct_id=0; unsigned long timestamp; unsigned long milis; unsigned long actualMillis; }; DATA MyData;
unsigned long tempo30;
struct ACK { bool ack; unsigned long kj; bool beg; uint8_t ACKED_PCT_ID; }; ACK ack;
DateTime timeConvert;
unsigned long lastSent;
DATA queue[10]; int repeatCount[10] = {0}; unsigned long sentTime[10] = {0}; unsigned long timeZero; unsigned long time2;
// create a serial object for Arduino, again Teensy uses a much simpler #define scenario SoftwareSerial ESerial(2, 3);
// Now you MUST create the transceiver object and you must pass in the serail object use the & to pass by reference // usage for teensy is the exact same // M0, M1, and Aux pins are next LoRa_E32 e32ttl100(&ESerial, 4, 5, 6);
int n =0; void setup() { // you should set the pin modes, MO, and M1 are to set the usage state of the EBYTE, aux is for reading states of the EBYTE pinMode(4, OUTPUT); pinMode(5, OUTPUT); pinMode(6, INPUT); Serial.begin(9600); if(! rtc.begin()) { // SE O RTC NÃO FOR INICIALIZADO, FAZ Serial.println("DS3231 não encontrado"); } if(rtc.lostPower()){ //SE RTC FOI LIGADO PELA PRIMEIRA VEZ / FICOU SEM ENERGIA / ESGOTOU A BATERIA, FAZ Serial.println("DS3231 OK!"); } delay(100); //INTERVALO DE 100 MILISSEGUNDOS rtc.adjust(1684330529); e32ttl100.begin(); ResponseStructContainer c; c = e32ttl100.getConfiguration();
// It's important get configuration pointer before all other operation Configuration configuration = (Configuration)c.data; //configuration.OPTION.fixedTransmission = FT_TRANSPARENT_TRANSMISSION; // configurar o sf no 7 //configuration.SPED.airDataRate = AIR_DATA_RATE_101_192; // TABELA ATUALIZADA SF 7
// It's important get configuration pointer before all other operation ResponseStatus rs = e32ttl100.setConfiguration(configuration, WRITE_CFG_PWR_DWN_LOSE); e32ttl100.setMode(MODE_0_NORMAL); //e32ttl.setMode(MODE_2_POWER_SAVING);
Serial.println(F(" ----- MENU DE CONFIGURAÇÂO ------- \n5. TX s/ CONFIANÇA 6. TX c/ CONFIANÇA"));
}
void loop(){ while(testSf < 1){ Serial.println(F("-------- iniciando transmissão em 5s ------ ")); delay(7500); DateTime now = rtc.now(); int repeat = 0; unsigned long tempof; unsigned long tempog; unsigned long elapsed; tempog = 0; tempof = millis(); elapsed = millis(); while (repeat < 1) { repeat++; tempof = millis(); while (tempog <= 150000) { tempo30 = millis(); if(millis()-elapsed >= 1000){ MyData.pct_id++; MyData.timestamp = rtc.now().unixtime(); MyData.milis = millis(); MyData.actualMillis = millis(); Serial.print((MyData.pct_id));Serial.print(F(",")); Serial.print((timeConvert = MyData.timestamp).timestamp()); Serial.print(F(",")); Serial.print(MyData.milis);Serial.print(F(",")); ResponseStatus rs = e32ttl100.sendMessage(&MyData, sizeof(DATA)); Serial.println(millis()); tempog = tempo30 - tempof; elapsed = millis(); } } tempo30=0; tempog = 0; tempof = millis(); MyData.pct_id = 0; Serial.println(F("------------------ Teste C Confiança A Seguir em 10s--------------")); delay(28000); } elapsed = 0; tempog = 0 ; unsigned long stop; stop = rtc.now().unixtime(); tempog = millis(); int x = 0; int z =0; while(x<1){ elapsed = millis() - tempog; if(elapsed >= 1500){ if(isQueueFull() == true){ waitAck(); Serial.println(F("FILA CHEIA")); while(z<1){ checkTimeouts(); resendPacket2(); waitAck(); if(isQueueFull() == false){ z++; } } } if (constructPacket() == true){ int index = updateQueue(); sendPacket((size_t)index, false); tempog = millis(); }
} waitAck(); checkTimeouts(); resendPacket(); z = 0; if ((rtc.now().unixtime() - stop) >= 150){ // VOLTAR PRO 150 NÃO ESQUECER x++; if (hasDataInQueue() == true){ while(n < 1){ resendPacket2(); waitAck(); checkTimeouts(); if(hasDataInQueue() == false){ n++; } } } MyData.pct_id = 0; lastSent = 0; testSf = 1;
} }
bool hasDataInQueue(){ for (int i = 0; i < 9; i++){ if (queue[i].pct_id !=0){ return true; } } return false; }
bool isQueueFull() { for (int i = 0; i < 9; i++) { if (queue[i].timestamp == 0) { // Se encontrar uma posição vazia return false; // A fila não está cheia return i; } } return true; // A fila está cheia }
int removePacketFromQueue(int value, bool is_index) { if (is_index) { if (value < 0 || value >= 10) { return -1; // Índice inválido } // Remove o pacote da fila for (int j = value; j < 9; j++) { queue[j] = queue[j+1]; sentTime[j] = sentTime[j+1]; needRetrans[j] = needRetrans[j+1]; repeatCount[j] = repeatCount[j+1]; } // Define os valores da posição final como 0 queue[9].pct_id = 0; queue[9].timestamp = 0; queue[9].milis = 0; sentTime[9] = 0; needRetrans[9] = 0; repeatCount[9]=0; return value; // Retorna o índice do pacote removido } else { for (int i = 0; i < 10; i++) { if (queue[i].pct_id == value) { // Remove o pacote da fila for (int j = i; j < 9; j++) { queue[j] = queue[j+1]; sentTime[j] = sentTime[j+1]; repeatCount[j]= repeatCount[j+1]; } // Define os valores da posição final como 0 queue[9].pct_id = 0; queue[9].timestamp = 0; queue[9].milis = 0; sentTime[9] = 0; needRetrans[9] = 0; repeatCount[9]=0; return i; // Retorna o índice do pacote removido } } return -1; // Retorna -1 caso o pacote não seja encontrado na fila } }
void waitAck(){ for (int i =0; i < 10; i++){ if(e32ttl100.available() > 0){ ResponseStructContainer rsc = e32ttl100.receiveMessage(sizeof(ACK)); struct ACK ack = (ACK) rsc.data; if(ack.ack == 1){ Serial.print(F("ACKED pct id: "));Serial.println(ack.ACKED_PCT_ID); int pctAckered = ack.ACKED_PCT_ID; int index = removePacketFromQueue(pctAckered,false); //repeatCount[index] = 0; }
//rsc.close(); }
}
}
void checkTimeouts() { for (int i = 0; i < 10; i++) { if (sentTime[i] != 0) { // Verifica se o tempo foi registrado unsigned long elapsedTime = (rtc.now().unixtime() - sentTime[(i)]); if (elapsedTime >= 4 ) { // Verifica se o tempo estourou needRetrans[(i)] = queue[(i)].pct_id; } } } }
int updateQueue() { static int j = 0; if (queue[j].pct_id != 0) { // se a posição não estiver vazia j++; // avança para a próxima posição if (j >= 10) { j = 0; } } queue[j].timestamp = MyData.timestamp; queue[j].pct_id = MyData.pct_id; queue[j].milis = MyData.milis; return j; }
void constructPacketFromQueue(int queueIndex) { MyData.pct_id = queue[queueIndex].pct_id; MyData.timestamp = queue[queueIndex].timestamp; MyData.milis = queue[queueIndex].milis; MyData.actualMillis = millis(); }
bool constructPacket(){ if(lastSent == MyData.pct_id){ if(isQueueFull() == false){ MyData.pct_id++; MyData.timestamp = rtc.now().unixtime(); MyData.milis = millis(); MyData.actualMillis = millis(); return true; }
} else{ if(isQueueFull() == false){ MyData.pct_id = lastSent; MyData.pct_id++; MyData.timestamp = rtc.now().unixtime(); MyData.milis = millis(); MyData.actualMillis = millis(); return true; } } }
int findPacketIndex(int pct_id) { for (int i = 0; i < 10; i++) { if (queue[i].pct_id == pct_id) { return i; } } return -1; }
void resendPacket(){ static int j = 0; for (int i = j; i < 10; i++){ if (needRetrans[i] > 0){ int index = findPacketIndex(needRetrans[i]); if(index < 0 ){ break; } if((rtc.now().unixtime() - sentTime[(index)]) >= 4){ constructPacketFromQueue(index); sendPacket(index, true); waitAck(); j = i; } } } if(j>=10){ j = 0; } } void resendPacket2(){ for (int i = 0; i < 10; i++){ if (needRetrans[i] > 0){ int index = findPacketIndex(needRetrans[i]); if(index < 0){ break; } if((rtc.now().unixtime() - sentTime[(index)]) >= 4){ constructPacketFromQueue(index); sendPacket(index, true); waitAck(); } } } }
void sendPacket(int index, bool resend){
if(resend == false) { ResponseStatus rs = e32ttl100.sendMessage(&MyData, sizeof(DATA)); //timeZero = rtc.now().unixtime(); printPacket(); sentTime[(index)] = rtc.now().unixtime(); repeatCount[(index)]++; lastSent++; } if(resend == true) { if(millis() - lastRetransmitTime >= minRetransmitInterval){ ResponseStatus rs = e32ttl100.sendMessage(&MyData, sizeof(DATA)); Serial.print(F("PACOTE RETRANSMITIDO do índice -> ")); printPacket(); sentTime[(index)] = rtc.now().unixtime(); repeatCount[(index)]++; lastRetransmitTime = millis(); minRetransmitInterval = random(1300,1450); retransmitBackoff++; if(repeatCount[(index)] >= 5){ Serial.print(F("PACOTE REMOVIDO do indice "));Serial.println((index)); removePacketFromQueue((index), true); } } } }
unsigned long expBackoff(int n) { return (1 << n) * 350; // espera exponencial }
void printParameters(struct Configuration configuration) { Serial.println("----------------------------------------");
}
void printPacket(){ Serial.print(MyData.pct_id);Serial.print(F(",")); Serial.print((timeConvert = MyData.timestamp).timestamp()); Serial.print(F(",")); Serial.print(MyData.milis); Serial.print(F(",")); Serial.println(MyData.actualMillis);
}
void printQueue(){ for(int i = 0; i < 10; i++){ Serial.print(queue[i].pct_id);Serial.print(F(",")); Serial.print(queue[i].timestamp); Serial.print(F(",")); Serial.print(queue[i].milis); Serial.print(F(",")); Serial.println(queue[i].actualMillis); } }`
Code from RX: `#include
include "LoRa_E32.h"
include
include "stdlib.h"
include "string.h"
include
include
// RTCC RTC_DS3231 rtc; //OBJETO DO TIPO RTC_DS3231 // uint8_t bat = 0;
struct DATA { unsigned long pct_id=0; unsigned long timestamp; unsigned long milis; unsigned long actualMillis; };
unsigned long pctid =1; // create a data structure DATA MyData; DateTime convertTime; unsigned long tempo30;
struct ACK { bool ack; unsigned long kj; bool beg; uint8_t ACKED_PCT_ID; }; ACK ack;
int i;
unsigned long lastSent;
DATA queue[10]; int repeatCount[10]; unsigned long sentTime[10]; unsigned long timeZero; unsigned long time2;
// create a serial object for Arduino, again Teensy uses a much simpler #define scenario SoftwareSerial ESerial(2, 3);
// Now you MUST create the transceiver object and you must pass in the serail object use the & to pass by reference // usage for teensy is the exact same // M0, M1, and Aux pins are next LoRa_E32 e32ttl100(&ESerial, 4, 5, 6);
void setup() { // you should set the pin modes, MO, and M1 are to set the usage state of the EBYTE, aux is for reading states of the EBYTE pinMode(4, OUTPUT); pinMode(5, OUTPUT); pinMode(6, INPUT); Serial.begin(9600); if(! rtc.begin()) { // SE O RTC NÃO FOR INICIALIZADO, FAZ Serial.println("DS3231 não encontrado"); } if(rtc.lostPower()){ //SE RTC FOI LIGADO PELA PRIMEIRA VEZ / FICOU SEM ENERGIA / ESGOTOU A BATERIA, FAZ Serial.println("DS3231 OK!"); } delay(100); //INTERVALO DE 100 MILISSEGUNDOS e32ttl100.begin(); //ResponseStructContainer c; //c = e32ttl100.getConfiguration();
// It's important get configuration pointer before all other operation //Configuration configuration = (Configuration)c.data; //configuration.OPTION.fixedTransmission = FT_TRANSPARENT_TRANSMISSION; //configuration.SPED.airDataRate = AIR_DATA_RATE_101_192; // TABELA ATUALIZADA SF 7
// configuration.SPED.airDataRate = AIR_DATA_RATE_000_03; //sf10
// It's important get configuration pointer before all other operation // ResponseStatus rs = e32ttl100.setConfiguration(configuration, WRITE_CFG_PWR_DWN_LOSE);
// rtc.adjust(1684330529); // e32ttl100.setMode(MODE_0_NORMAL); //e32ttl.setMode(MODE_2_POWER_SAVING);
Serial.print(F("id tx: ")); Serial.print(F(",")); Serial.print(F("id rx")); Serial.print(F(",")); Serial.print(F("Time tx")); Serial.print(F(","));Serial.print(F("ms tx")); Serial.print(F(","));Serial.print(F("actual_ms_tx")); Serial.print(F(",")); Serial.print(F("Time rx")); Serial.print(F(",")); Serial.print(F("ms rx")); Serial.print(F(",")); Serial.println(F("bateria")); }
void loop(){ int repeat = 0; if (e32ttl100.available()) { unsigned long tempof1; unsigned long tempog1; tempog1 = 0; while (repeat < 5) { repeat++; bat++; tempof1 = millis(); while (tempog1 < 35000) { tempo30 = millis(); if (e32ttl100.available()) { tempo30 = millis(); ResponseStructContainer rsc = e32ttl100.receiveMessage(sizeof(DATA)); struct DATA MyData = (DATA) rsc.data; ack.ack++; ack.ACKED_PCT_ID = MyData.pct_id; convertTime = MyData.timestamp; Serial.print(MyData.pct_id);Serial.print(F(","));Serial.print(pctid);Serial.print(F(","));Serial.print(convertTime.timestamp()); Serial.print(F(","));Serial.print(MyData.milis);Serial.print(F(","));Serial.print(MyData.actualMillis);Serial.print(F(",")); Serial.print(rtc.now().timestamp());Serial.print(F(","));Serial.print(millis()); Serial.print(F(","));Serial.println(bat); pctid++; ResponseStatus rs = e32ttl100.sendMessage(&ack, sizeof(ACK)); ack.ack = 0; rsc.close();
tempog1 = tempo30 - tempof1;
} }`
if u can try this codes on your desk i was gratefull. My actual issue is that I wont received any packet.