LoRa multiple communication

Hi all, I have a problem regarding “LoRa multiple communication” on ESP32.

I am doing a project with 3 wifi sniffer nodes as 3 slaves. They will always be active, keeping sniffering/listening to the nearby packets data. They send the data to the server only when a specific request has been sent by the master. The workflow will be like: master send requests to slave 1 and wait for answer from slave 1 at 0~1s. When the slave 1 got the request, it will send the data to the server. Same applies to slave 2 and 3 in every second afterwards.

My problem is that not every request sent by master will be answered by the specific slave. I.e., it might request 5 times and only got 1 response, like the picture below. Also, the program became blocked forever when around 32 packets have been set to the master (Not sure if it’s relevant to LoRa.endPacket())

The (part of) master code is:

loop()
{
if (millis() - lastRequestSentTime > 500)
{
      if (turn == 1)
      {
            SendRequest("1#");     // Send request to Client 1
            receiveFromSlaveDevice("1#");      // This is data from Client 1
            lastRequestSentTime = millis();
            // trun = 2;
            // contintues to turn 2 and 3
      }
 }
      
vTaskDelay( 100 / portTICK_PERIOD_MS );
}
void SendRequest( String request )
{
  LoRa.beginPacket();           // start packet
  LoRa.print(request);          // send request
  LoRa.endPacket();             // finish packet and send it

} // SendRequest
void receiveFromSlaveDevice( String nodeID )
{
  int packetSize = LoRa.parsePacket();
  if (packetSize)
  {
    Serial.println( "Received packet from: " + nodeID );
    
    String incomingMessage = "";                 // payload of incoming packet
    while ( LoRa.available() )
    {            
      String incomingMessage = LoRa.readString();
      // incomingMessage (WiFi device data) format: Timestamp \t MAC Address \t RSSI \n

      int pos1 = incomingMessage.indexOf('\t');
      int pos2 = incomingMessage.indexOf('\t', pos1 + 1);
      int pos3 = incomingMessage.indexOf('\n', pos2 + 1);

      std::vector<String> wifiDevicePayload(3);
      wifiDevicePayload[0] = incomingMessage.substring(0, pos1);                        // Timestamp
      wifiDevicePayload[1] = incomingMessage.substring(pos1 + 1, pos2);            // MAC Address
      wifiDevicePayload[2] = incomingMessage.substring(pos2 + 1, pos3);            // RSSI
      Serial.println("Index 1: " + wifiDevicePayload[0]);

      printWiFiDeviceData( wifiDevicePayload );
      xQueueSend( g_queueBetweenReceiveAndWebServer, &wifiDevicePayload, portMAX_DELAY ); 
    }
  }
}

The (part of) slave code is:

int packetSize = LoRa.parsePacket();
if (packetSize)
{
  while ( LoRa.available() )
  {            
    String request = LoRa.readString();
    if ( request == "1#" )
    {
      Serial.println( "Client 1 got request, answering Server..." );
      sendToMasterDevice( WiFiDeviceData );
    }
    else
    {
      Serial.println( "ERROR - No requests from Server." );
    }
  }
}

It seems there is some transition time needed for the LoRa chip to switch from sending mode to receiving mode. But there is not a function can be used to wait until a message is received… (Like
RF95.waitAvailableTimeout()
in RadioHead Library, RadioHead: RHGenericDriver Class Reference).
I was mainly refering to this: https://miliohm.com/multi-clients-lora-with-a-server-communication/. And I wonder if it is possible to achieve the same thing by using arduino-LoRa library (https://github.com/sandeepmistry/arduino-LoRa)

Any suggestions or ideas will be of highly appreciated! Many thanks!

q220085:
It seems there is some transition time needed for the LoRa chip to switch from sending mode to receiving mode.

Not sure what point you are making here.

The LoRa 'chip' cannot switch with no delay between sending and receiving, it has to be programmed over the SPI bus to switch across from transmit to receive, this does take a small amount of time.

How is this application connected with WiFi ?