ESP32 LoRa Receive Interrupt

Hi,

I’m trying to make a LoRa sender/receiver board.

Therefore the plan is to send some messages whenever I want, but if there is an incoming packet, I want to interrupt the sending-process (for beginning without any sending retries) and receive the incoming packet.

I tried the mix of the Heltec examples “OLED_LoRa_Sender” and “LoRaReceiverInterrupt”, and it works fine until I’m sending and receiving a message at the same time. Then the receive interrupt does not interrupt.

How can I solve that?

Thanks a lot in advance

void loop(){
  if (sendMsg && !receivingMsg) { // sendMsg drives true, if PRG button is pressed receivingMsg drives try in "void onReceive(int packetSize)"
    /*
    Heltec.display->clear();
    Heltec.display->setTextAlignment(TEXT_ALIGN_LEFT);
    Heltec.display->setFont(ArialMT_Plain_10);

    //Serial.println(WiFi.macAddress());
    Heltec.display->drawString(0, 0, "Sending packet: ");
    Heltec.display->drawString(0, 15, WiFi.macAddress());
    Heltec.display->drawString(100, 15, String(counter));
    Heltec.display->display();
    */
    LoRa.beginPacket();
    LoRa.setTxPower(14,RF_PACONFIG_PASELECT_PABOOST);
    LoRa.print("hello ");
    LoRa.print(counter);
    LoRa.endPacket();

    delay(10); // give me time to bring up serial monitor

    counter++;

    // put the radio into receive mode
    LoRa.receive();

    sendMsg = false;
  }
    
}