From cc8256b4cc9f285a756ae9f5c868ee835f39af76 Mon Sep 17 00:00:00 2001 From: Andre Dunford Date: Tue, 20 Dec 2022 11:42:11 -0800 Subject: [PATCH] commit missed changes to VNA.cpp --- Software/VNA_embedded/Application/VNA.cpp | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/Software/VNA_embedded/Application/VNA.cpp b/Software/VNA_embedded/Application/VNA.cpp index 2f2c588..192a99f 100644 --- a/Software/VNA_embedded/Application/VNA.cpp +++ b/Software/VNA_embedded/Application/VNA.cpp @@ -27,6 +27,7 @@ static uint32_t last_LO2; static double logMultiplier, logFrequency; static Protocol::VNADatapoint<32> data; static bool active = false; +static bool waitingInStandby = false; static Si5351C::DriveStrength fixedPowerLowband; static bool adcShifted; static uint32_t actualBandwidth; @@ -260,7 +261,10 @@ bool VNA::Setup(Protocol::SweepSettings s) { FPGA::EnableInterrupt(FPGA::Interrupt::SweepHalted); // Start the sweep if not configured for standby firstPoint = true; - if(!settings.standby){ + if (settings.standby) { + waitingInStandby = true; + } + else { FPGA::StartSweep(); } return true; @@ -268,9 +272,10 @@ bool VNA::Setup(Protocol::SweepSettings s) { void VNA::InitiateSweep() { // Invoked by a host via InitiateSweep packet - if(settings.standby){ + if(waitingInStandby){ // make sure that SweepSettings have been configured for standby operation FPGA::StartSweep(); + waitingInStandby = false; } } @@ -278,6 +283,14 @@ bool VNA::GetStandbyMode() { return settings.standby; } +bool VNA::IsWaitingInStandby() { + return waitingInStandby; +} + +void VNA::SetWaitingInStandby(bool waiting) { + waitingInStandby = waiting; +} + static void PassOnData() { Protocol::PacketInfo info; info.type = Protocol::PacketType::VNADatapoint; @@ -345,7 +358,10 @@ void VNA::Work() { } // do not reset unlevel flag here, as it is calculated only once at the setup of the sweep // Start next sweep if not configured for standby - if (!settings.standby){ + if (settings.standby) { + waitingInStandby = true; + } + else { FPGA::StartSweep(); }