diff --git a/src/shared/radio/SX1278/SX1278Lora.cpp b/src/shared/radio/SX1278/SX1278Lora.cpp index 8e9e76d6afe13091be4a995ab776ab336a665127..43e5ab18861fc1f42d0f863cea842e02bb060015 100644 --- a/src/shared/radio/SX1278/SX1278Lora.cpp +++ b/src/shared/radio/SX1278/SX1278Lora.cpp @@ -312,10 +312,12 @@ bool SX1278Lora::send(uint8_t *pkt, size_t len) Lock guard(*this); - SPITransaction spi(getSpiSlave()); + { + SPITransaction spi(getSpiSlave()); - spi.writeRegister(REG_PAYLOAD_LENGTH, len); - writeFifo(FIFO_TX_BASE_ADDR, pkt, len); + spi.writeRegister(REG_PAYLOAD_LENGTH, len); + writeFifo(FIFO_TX_BASE_ADDR, pkt, len); + } { // Now enter in mode TX to send the packet