From 7e4d2b9e6fb11bf0bec8730c9d5853fb7f3984dd Mon Sep 17 00:00:00 2001
From: Federico Lolli <federico.lolli@skywarder.eu>
Date: Wed, 13 Mar 2024 20:42:25 +0100
Subject: [PATCH] Fixed bug with interrupts, now working properly

---
 on-device/src/entrypoints/arpist_device_receiver.cpp | 8 ++++----
 on-device/src/entrypoints/arpist_device_sender.cpp   | 4 ++--
 on-device/src/shared/radio/Radio.cpp                 | 3 ++-
 on-device/src/shared/radio/Radio.h                   | 1 -
 4 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/on-device/src/entrypoints/arpist_device_receiver.cpp b/on-device/src/entrypoints/arpist_device_receiver.cpp
index ab72c90..9a4bfe1 100644
--- a/on-device/src/entrypoints/arpist_device_receiver.cpp
+++ b/on-device/src/entrypoints/arpist_device_receiver.cpp
@@ -41,11 +41,11 @@ int main()
     // start radio
     if (Radio::getInstance().start(onReceive))
     {
-        printf("Radio start success\n");
+        TRACE("Radio start success\n");
     }
     else
     {
-        printf("Radio start failed\n");
+        TRACE("Radio start failed\n");
         return -1;
     }
 
@@ -60,7 +60,7 @@ void onReceive(mavlink_message_t msg)
 {
     mavlink_payload_flight_tm_t payload;
 
-    printf("Received message with ID %d\n", msg.msgid);
+    TRACE("Received message with ID %d\n", msg.msgid);
     mavlink_msg_payload_flight_tm_decode(&msg, &payload);
-    printf("Received payload with timestamp %lld\n", payload.timestamp);
+    TRACE("Received payload with timestamp %lld\n", payload.timestamp);
 }
diff --git a/on-device/src/entrypoints/arpist_device_sender.cpp b/on-device/src/entrypoints/arpist_device_sender.cpp
index 3c3d63b..058addc 100644
--- a/on-device/src/entrypoints/arpist_device_sender.cpp
+++ b/on-device/src/entrypoints/arpist_device_sender.cpp
@@ -44,11 +44,11 @@ int main()
     // start radio
     if (Radio::getInstance().start([](const mavlink_message_t&) {}))
     {
-        printf("Radio start success\n");
+        TRACE("Radio start success\n");
     }
     else
     {
-        printf("Radio start failed\n");
+        TRACE("Radio start failed\n");
         return -1;
     }
 
diff --git a/on-device/src/shared/radio/Radio.cpp b/on-device/src/shared/radio/Radio.cpp
index 5dc2f0a..d111ea4 100644
--- a/on-device/src/shared/radio/Radio.cpp
+++ b/on-device/src/shared/radio/Radio.cpp
@@ -23,6 +23,7 @@
 #include "Radio.h"
 
 #include <config/RadioConfig.h>
+#include <drivers/interrupt/external_interrupts.h>
 #include <radio/SX1278/SX1278Frontends.h>
 
 #include <memory>
@@ -81,7 +82,7 @@ bool Radio::start(std::function<void(const mavlink_message_t &)> onReceive)
 {
     // initialize frontend
     std::unique_ptr<Boardcore::SX1278::ISX1278Frontend> frontend =
-        std::make_unique<Boardcore::Skyward433Frontend>();
+        std::make_unique<Boardcore::RA01Frontend>();
 
     std::unique_ptr<Boardcore::SX1278Fsk> sx1278 =
         std::make_unique<Boardcore::SX1278Fsk>(
diff --git a/on-device/src/shared/radio/Radio.h b/on-device/src/shared/radio/Radio.h
index edd4b37..8a4c3b2 100644
--- a/on-device/src/shared/radio/Radio.h
+++ b/on-device/src/shared/radio/Radio.h
@@ -27,7 +27,6 @@
 #include <config/RadioConfig.h>
 #include <radio/MavlinkDriver/MavlinkDriver.h>
 #include <radio/SX1278/SX1278Fsk.h>
-#include <radio/SX1278/SX1278Lora.h>
 
 #if defined _BOARD_STM32F429ZI_SKYWARD_GS_V2
 #include "interfaces-impl/hwmapping.h"
-- 
GitLab