diff --git a/examples/SX127x/SX127x_PingPong/SX127x_PingPong.ino b/examples/SX127x/SX127x_PingPong/SX127x_PingPong.ino index e403c902..26d1132b 100644 --- a/examples/SX127x/SX127x_PingPong/SX127x_PingPong.ino +++ b/examples/SX127x/SX127x_PingPong/SX127x_PingPong.ino @@ -32,9 +32,6 @@ int transmissionState = RADIOLIB_ERR_NONE; // flag to indicate transmission or reception state bool transmitFlag = false; -// disable interrupt when it's not needed -volatile bool enableInterrupt = true; - // flag to indicate that a packet was sent or received volatile bool operationDone = false; @@ -43,11 +40,6 @@ volatile bool operationDone = false; // IMPORTANT: this function MUST be 'void' type // and MUST NOT have any arguments! void setFlag(void) { - // check if the interrupt is enabled - if(!enableInterrupt) { - return; - } - // we sent or received packet, set the flag operationDone = true; } @@ -92,10 +84,6 @@ void setup() { void loop() { // check if the previous operation finished if(operationDone) { - // disable the interrupt service routine while - // processing the data - enableInterrupt = false; - // reset flag operationDone = false; @@ -150,10 +138,5 @@ void loop() { transmissionState = radio.startTransmit("Hello World!"); transmitFlag = true; } - - // we're ready to process more packets, - // enable interrupt service routine - enableInterrupt = true; - } } diff --git a/examples/Stream/Stream_Receive/Stream_Receive.ino b/examples/Stream/Stream_Receive/Stream_Receive.ino index 2dc723ed..39fc1bb6 100644 --- a/examples/Stream/Stream_Receive/Stream_Receive.ino +++ b/examples/Stream/Stream_Receive/Stream_Receive.ino @@ -86,9 +86,6 @@ void setup() { // flag to indicate that a packet was received volatile bool receivedFlag = false; -// disable interrupt when it's not needed -volatile bool enableInterrupt = true; - // how many bytes are there in total const int totalLength = 512; @@ -106,11 +103,6 @@ volatile uint8_t rxBuffer[totalLength + 1]; ICACHE_RAM_ATTR #endif void fifoGet(void) { - // check if the interrupt is enabled - if(!enableInterrupt) { - return; - } - // set the flag when we receive the full packet receivedFlag = radio.fifoGet(rxBuffer, totalLength, &receivedLength); } @@ -118,10 +110,6 @@ void fifoGet(void) { void loop() { // check if the flag is set if(receivedFlag) { - // disable the interrupt service routine while - // processing the data - enableInterrupt = false; - // packet was successfully received Serial.println(F("[SX1278] Received packet!")); @@ -135,10 +123,5 @@ void loop() { // put module back to listen mode radio.startReceive(); - - // we're ready to receive more packets, - // enable interrupt service routine - enableInterrupt = true; } - } diff --git a/examples/Stream/Stream_Transmit/Stream_Transmit.ino b/examples/Stream/Stream_Transmit/Stream_Transmit.ino index 02c6bec6..4789a6eb 100644 --- a/examples/Stream/Stream_Transmit/Stream_Transmit.ino +++ b/examples/Stream/Stream_Transmit/Stream_Transmit.ino @@ -80,9 +80,6 @@ void setup() { transmissionState = radio.startTransmit(longPacket); } -// disable interrupt when it's not needed -volatile bool enableInterrupt = true; - // flag to indicate we can keep adding more bytes to FIFO volatile bool fifoEmpty = false; @@ -103,31 +100,18 @@ int remLength = totalLength; ICACHE_RAM_ATTR #endif void fifoAdd(void) { - // check if the interrupt is enabled - if(!enableInterrupt) { - return; - } - // we can send more bytes fifoEmpty = true; } void loop() { if(fifoEmpty) { - // disable the interrupt service routine while - // processing the data - enableInterrupt = false; - // reset flag fifoEmpty = false; // add more bytes to the transmit buffer uint8_t* txBuffPtr = (uint8_t*)longPacket.c_str(); transmittedFlag = radio.fifoAdd(txBuffPtr, totalLength, &remLength); - - // we're ready to send more packets, - // enable interrupt service routine - enableInterrupt = true; } // check if the previous transmission finished