LoRa Multiple Communication (LoRa Duplex)

Hello to all,
First I would like to apologize for my English.
I am new to working with the LoRa system and have already managed to do some work with the Heltec LORA ESP 32 V2 boards and have been successful when it is end to end ie two boards.
I saw an example from Heltec itself (LoRaMultipleCommunication) where it is possible to send data from multiple transmitters to a single receiver, I was very excited about the idea and tried to implement. It worked very well but I have some problems that if they can help me fix grateful.

What I am implementing is this.

Imgur

The problem I am having is this that occurs from time to time.

Imgur

the correct thing i should see would be like this and i see it for a long time until the error happens.

Imgur

What could be done to prevent this from happening?

This is the code I’m using

/*
This is a simple example show the Heltec.LoRa recived data in OLED.

The onboard OLED display is SSD1306 driver and I2C interface. In order to make the
OLED correctly operation, you should output a high-low-high(1-0-1) signal by soft-
ware to OLED’s reset pin, the low-level signal at least 5ms.

OLED pins to ESP32 GPIOs via this connecthin:
OLED_SDA – GPIO4
OLED_SCL – GPIO15
OLED_RST – GPIO16

by Aaron.Lee from HelTec AutoMation, ChengDu, China
成都惠利特自动化科技有限公司
www.heltec.cn

this project also realess in GitHub:
https://github.com/Heltec-Aaron-Lee/WiFi_Kit_series
*/
#include “heltec.h”
#include “images.h”
#define RST 14 // GPIO14 RESET
#define BAND 915E6 //you can set band here directly,e.g. 868E6,915E6
String rssi;
String packSize = “–”;
String packet ;
String loRaMessage;
String temperatura1;
String umidade1;
String pressao1;
String estacao1;
String contador1;

//********
String temperatura2;
String umidade2;
String pressao2;
String estacao2;
String contador2;
//*********
int contador;
void logo(){
Heltec.display->clear();
Heltec.display->drawXbm(0,5,logo_width,logo_height,logo_bits);
Heltec.display->display();
}

void setup() {
//WIFI Kit series V1 not support Vext control
Heltec.begin(true /DisplayEnable Enable/, true /Heltec.Heltec.Heltec.LoRa Disable/, true /Serial Enable/, true /PABOOST Enable/, BAND /long BAND/);

Heltec.display->init();
Heltec.display->flipScreenVertically();
Heltec.display->setFont(ArialMT_Plain_16);
logo();
delay(1500);
Heltec.display->clear();

Heltec.display->drawString(0, 0, “Sucesso!”);
Heltec.display->drawString(0, 16, “Esperando …”);
Heltec.display->drawString(0, 32, “Dados …”);
Heltec.display->display();
delay(1000);
LoRa.receive();
}

void loop() {

int packetSize = LoRa.parsePacket();
if (packetSize)
{
while (LoRa.available())
{ //lora Avaliable
String LoRaData = LoRa.readString();
Serial.print("Dados Brutos: ");Serial.print(LoRaData);

if ((contador >0) && (contador<2)){   

int pos1 = LoRaData.indexOf('X');   // Contador 1
int pos2 = LoRaData.indexOf('T');  // Temperatura 1
int pos3 = LoRaData.indexOf('U');  // Umidade 1
int pos4 = LoRaData.indexOf('V');  // Pressão 1
int pos5 = LoRaData.indexOf('Z');  // Estação 1
contador1 = LoRaData.substring(pos1 +1, pos2);
temperatura1 = LoRaData.substring(pos2 +1, pos3);
umidade1 = LoRaData.substring(pos3+1, pos4);
pressao1 = LoRaData.substring(pos4+1, pos5);
estacao1 = LoRaData.substring(pos5+1, LoRaData.length());

}

/******************estaçao 2**********************************/

if ((contador >2) && (contador<5))
{
/estaçao 2****************/
int pos6 = LoRaData.indexOf(‘A’); // Contador2
int pos7 = LoRaData.indexOf(‘B’); // Temperatura 2
int pos8 = LoRaData.indexOf(‘C’); // umidade 2
int pos9 = LoRaData.indexOf(‘D’); // pressao 3
int pos10 = LoRaData.indexOf(‘E’); // Estação 2
contador2 = LoRaData.substring(pos6+1, pos7);
temperatura2 = LoRaData.substring(pos7+1, pos8);
umidade2= LoRaData.substring(pos8+1, pos9);
pressao2 = LoRaData.substring(pos9+1, pos10);
estacao2 = LoRaData.substring(pos10+1,LoRaData.length());
}
//Get RSSI
rssi = LoRa.packetRssi();
// Serial.print(" with RSSI ");
// Serial.println(rssi);

if ((contador >0) && (contador<2))
{
Heltec.display->clear();
Heltec.display->setTextAlignment(TEXT_ALIGN_LEFT);
Heltec.display->setFont(ArialMT_Plain_16);
Heltec.display->drawString(0, 0, "Sinal: ");
Heltec.display->drawString(40, 0, rssi);
Heltec.display->drawString(80, 0, String(estacao1));
Heltec.display->drawString(0, 16, "Pacotes: ");
Heltec.display->drawString(90, 16, String(contador1));
Heltec.display->drawString(0, 32,"T: "+ String(temperatura1) + " U: "+String(umidade1));
Heltec.display->drawString(0, 48, "P: "+String(pressao1));
Heltec.display->display();
}

if ((contador >2) && (contador<4))
{
Heltec.display->clear();
Heltec.display->setTextAlignment(TEXT_ALIGN_LEFT);
Heltec.display->setFont(ArialMT_Plain_16);
Heltec.display->drawString(0, 0, "Sinal: ");
Heltec.display->drawString(40, 0, rssi);
Heltec.display->drawString(80, 0, String(estacao2));
Heltec.display->drawString(0, 16, "Pacotes: ");
Heltec.display->drawString(90, 16, String(contador2));
Heltec.display->drawString(0, 32,"T: "+ String(temperatura2) + " U: "+String(umidade2));
Heltec.display->drawString(0, 48, "P: "+String(pressao2));
Heltec.display->display();
}

}
}
Serial.println("************* DADOS DA STATION TXA******************");

Serial.print(" TEMP-TXA; “); Serial.println(temperatura1);
Serial.print(” Umidade-TXA; “); Serial.println(umidade1);
Serial.print(” Pressão-TXA: “); Serial.println(pressao1);
Serial.print(” Estação TXA: “); Serial.println(estacao1);
Serial.print(” Contador1 TXA: "); Serial.println(contador1);

Serial.println(“DADOS DA STATION TXB*****”);

Serial.print(" TEMP-TXB: “); Serial.println(temperatura2);
Serial.print(” Umidade-TXB: “); Serial.println(umidade2);
Serial.print(” Pressão-TXB “); Serial.println(pressao2);
Serial.print(” Estação2:TXB “); Serial.println(estacao2);
Serial.print(” Contador2 TXB: “); Serial.println(contador2);
Serial.println(”***********########");

delay(1000);

contador++;
digitalWrite(LED, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(LED, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second

if (contador == 5)
{
contador = 0;
}
}