From 50da242f79e4c8c0b1edef829cee050b1890c13e Mon Sep 17 00:00:00 2001
From: "jacob.eva" <x00010@disroot.org>
Date: Sun, 5 May 2024 17:15:33 +0100
Subject: [PATCH 1/3] Fix redundant call

---
 Bluetooth.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/Bluetooth.h b/Bluetooth.h
index 64eac7d..38951f7 100644
--- a/Bluetooth.h
+++ b/Bluetooth.h
@@ -313,7 +313,6 @@ bool bt_setup_hw() {
       Bluefruit.Security.setPairPasskeyCallback(bt_passkey_callback);
       Bluefruit.Periph.setConnectCallback(bt_connect_callback);
       Bluefruit.Periph.setDisconnectCallback(bt_disconnect_callback);
-      Bluefruit.Security.setIOCaps(true, true, false);
       Bluefruit.Security.setPairCompleteCallback(bt_pairing_complete);
       const ble_gap_addr_t gap_addr = Bluefruit.getAddr();
       char *data = (char*)malloc(BT_DEV_ADDR_LEN+1);

From 29e84064370f43512078e3ae8feae2fc3c75e7bd Mon Sep 17 00:00:00 2001
From: "jacob.eva" <x00010@disroot.org>
Date: Sun, 5 May 2024 17:15:55 +0100
Subject: [PATCH 2/3] Fix display on NRF52

---
 Display.h          | 10 +++++++++-
 RNode_Firmware.ino |  4 ++++
 Utilities.h        |  4 ++++
 3 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/Display.h b/Display.h
index 1420167..a988f0e 100644
--- a/Display.h
+++ b/Display.h
@@ -134,7 +134,11 @@ bool display_init() {
     #endif
 
     #if DISP_CUSTOM_ADDR == true
+      #if HAS_EEPROM
       uint8_t display_address = EEPROM.read(eeprom_addr(ADDR_CONF_DADR));
+      #elif MCU_VARIANT == MCU_NRF52
+      uint8_t display_address = eeprom_read(eeprom_addr(ADDR_CONF_DADR));
+      #endif
       if (display_address == 0xFF) display_address = DISP_ADDR;
     #else
       uint8_t display_address = DISP_ADDR;
@@ -188,7 +192,11 @@ bool display_init() {
       disp_area.cp437(true);
       display.cp437(true);
 
-      display_intensity = EEPROM.read(eeprom_addr(ADDR_CONF_DINT));
+      #if HAS_EEPROM
+      uint8_t display_intensity = EEPROM.read(eeprom_addr(ADDR_CONF_DINT));
+      #elif MCU_VARIANT == MCU_NRF52
+      uint8_t display_intensity = eeprom_read(eeprom_addr(ADDR_CONF_DINT));
+      #endif
 
       return true;
     }
diff --git a/RNode_Firmware.ino b/RNode_Firmware.ino
index c0b0192..34d31e7 100644
--- a/RNode_Firmware.ino
+++ b/RNode_Firmware.ino
@@ -151,7 +151,11 @@ void setup() {
   #endif
 
   #if HAS_DISPLAY
+    #if HAS_EEPROM
     if (EEPROM.read(eeprom_addr(ADDR_CONF_DSET)) != CONF_OK_BYTE) {
+    #elif MCU_VARIANT == MCU_NRF52
+    if (eeprom_read(eeprom_addr(ADDR_CONF_DSET)) != CONF_OK_BYTE) {
+    #endif
       eeprom_update(eeprom_addr(ADDR_CONF_DSET), CONF_OK_BYTE);
       eeprom_update(eeprom_addr(ADDR_CONF_DINT), 0xFF);
     }
diff --git a/Utilities.h b/Utilities.h
index b2f4f74..22080de 100644
--- a/Utilities.h
+++ b/Utilities.h
@@ -43,6 +43,10 @@ sx128x *LoRa = &sx128x_modem;
 #include "Framing.h"
 #include "MD5.h"
 
+#if !HAS_EEPROM && MCU_VARIANT == MCU_NRF52
+uint8_t eeprom_read(uint32_t mapped_addr);
+#endif
+
 #if HAS_DISPLAY == true
   #include "Display.h"
 #endif

From c2e7c7070b1dca04b6421cae8a1998995c50843a Mon Sep 17 00:00:00 2001
From: "jacob.eva" <x00010@disroot.org>
Date: Sun, 5 May 2024 17:16:09 +0100
Subject: [PATCH 3/3] Fix TXEN / RXEN pin init for SX1280

---
 sx128x.cpp | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/sx128x.cpp b/sx128x.cpp
index 065598d..e61ffb0 100644
--- a/sx128x.cpp
+++ b/sx128x.cpp
@@ -361,6 +361,14 @@ int sx128x::begin(unsigned long frequency)
     delay(10);
   }
 
+  if (_rxen != -1) {
+      pinMode(_rxen, OUTPUT);
+  }
+
+  if (_txen != -1) {
+      pinMode(_txen, OUTPUT);
+  }
+
   if (_busy != -1) {
       pinMode(_busy, INPUT);
   }