From 5511ce319bcc1f581a518d74f5dcf407b8f547d8 Mon Sep 17 00:00:00 2001
From: Davide Mor <tazdevil971@gmail.com>
Date: Sun, 30 Jul 2023 18:28:51 +0200
Subject: [PATCH] [sx1278] Fixed a small SPITransaction bug

---
 src/shared/radio/SX1278/SX1278Lora.cpp | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/shared/radio/SX1278/SX1278Lora.cpp b/src/shared/radio/SX1278/SX1278Lora.cpp
index 8e9e76d6a..43e5ab188 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
-- 
GitLab