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+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Software/VNA_embedded/.settings/language.settings.xml b/Software/VNA_embedded/.settings/language.settings.xml
index 05de18d..1e25ada 100644
--- a/Software/VNA_embedded/.settings/language.settings.xml
+++ b/Software/VNA_embedded/.settings/language.settings.xml
@@ -1,25 +1,48 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Software/VNA_embedded/Application/App.cpp b/Software/VNA_embedded/Application/App.cpp
index e3a7221..2a69028 100644
--- a/Software/VNA_embedded/Application/App.cpp
+++ b/Software/VNA_embedded/Application/App.cpp
@@ -24,10 +24,7 @@
#define LOG_MODULE "App"
#include "Log.h"
-static Protocol::SweepSettings settings;
-static uint16_t lastPoint;
-
-static Protocol::PacketInfo recv_packet, transmit_packet;
+static Protocol::PacketInfo recv_packet;
static TaskHandle_t handle;
#if HW_REVISION >= 'B'
@@ -39,18 +36,7 @@ static TaskHandle_t handle;
extern ADC_HandleTypeDef hadc1;
#define FLAG_USB_PACKET 0x01
-#define FLAG_DATAPOINT 0x02
-static void VNACallback(const Protocol::Datapoint &res) {
- DEBUG2_HIGH();
- transmit_packet.type = Protocol::PacketType::Datapoint;
- transmit_packet.datapoint = res;
- lastPoint = res.pointNum;
- BaseType_t woken = false;
- xTaskNotifyFromISR(handle, FLAG_DATAPOINT, eSetBits, &woken);
- portYIELD_FROM_ISR(woken);
- DEBUG2_LOW();
-}
static void USBPacketReceived(const Protocol::PacketInfo &p) {
recv_packet = p;
BaseType_t woken = false;
@@ -119,16 +105,11 @@ void App_Start() {
uint32_t notification;
if(xTaskNotifyWait(0x00, UINT32_MAX, ¬ification, 100) == pdPASS) {
// something happened
- if(notification & FLAG_DATAPOINT) {
- Communication::Send(transmit_packet);
- lastNewPoint = HAL_GetTick();
- }
if(notification & FLAG_USB_PACKET) {
switch(recv_packet.type) {
case Protocol::PacketType::SweepSettings:
LOG_INFO("New settings received");
- settings = recv_packet.settings;
- sweepActive = VNA::Setup(settings, VNACallback);
+ sweepActive = VNA::Setup(recv_packet.settings);
lastNewPoint = HAL_GetTick();
Communication::SendWithoutPayload(Protocol::PacketType::Ack);
break;
@@ -218,16 +199,5 @@ void App_Start() {
}
}
}
-
-// if(sweepActive && HAL_GetTick() - lastNewPoint > 1000) {
-// LOG_WARN("Timed out waiting for point, last received point was %d (Status 0x%04x)", lastPoint, FPGA::GetStatus());
-// FPGA::AbortSweep();
-// // restart the current sweep
-// HW::Init();
-// HW::Ref::update();
-// VNA::Setup(settings, VNACallback);
-// sweepActive = true;
-// lastNewPoint = HAL_GetTick();
-// }
}
}
diff --git a/Software/VNA_embedded/Application/VNA.cpp b/Software/VNA_embedded/Application/VNA.cpp
index d413501..e3c354f 100644
--- a/Software/VNA_embedded/Application/VNA.cpp
+++ b/Software/VNA_embedded/Application/VNA.cpp
@@ -17,7 +17,6 @@
#define LOG_MODULE "VNA"
#include "Log.h"
-static VNA::SweepCallback sweepCallback;
static Protocol::SweepSettings settings;
static uint16_t pointCnt;
static bool excitingPort1;
@@ -44,7 +43,7 @@ static_assert(alternativePhaseInc * alternativeSamplerate == 4096 * HW::IF2, "DF
using namespace HWHAL;
-bool VNA::Setup(Protocol::SweepSettings s, SweepCallback cb) {
+bool VNA::Setup(Protocol::SweepSettings s) {
VNA::Stop();
vTaskDelay(5);
HW::SetMode(HW::Mode::VNA);
@@ -54,7 +53,6 @@ bool VNA::Setup(Protocol::SweepSettings s, SweepCallback cb) {
active = false;
return false;
}
- sweepCallback = cb;
settings = s;
// Abort possible active sweep first
FPGA::SetMode(FPGA::Mode::FPGA);
@@ -200,9 +198,6 @@ static void PassOnData() {
info.type = Protocol::PacketType::Datapoint;
info.datapoint = data;
Communication::Send(info);
-// if (sweepCallback) {
-// sweepCallback(data);
-// }
}
bool VNA::MeasurementDone(const FPGA::SamplingResult &result) {
diff --git a/Software/VNA_embedded/Application/VNA.hpp b/Software/VNA_embedded/Application/VNA.hpp
index 693ba84..3fae0f6 100644
--- a/Software/VNA_embedded/Application/VNA.hpp
+++ b/Software/VNA_embedded/Application/VNA.hpp
@@ -6,9 +6,7 @@
namespace VNA {
-using SweepCallback = void(*)(const Protocol::Datapoint&);
-
-bool Setup(Protocol::SweepSettings s, SweepCallback cb);
+bool Setup(Protocol::SweepSettings s);
bool MeasurementDone(const FPGA::SamplingResult &result);
void Work();
void SweepHalted();