mirror of
https://github.com/jankae/LibreVNA.git
synced 2026-02-01 21:34:13 +01:00
Stop sweep after reset, fix failing tests
This commit is contained in:
parent
c5d045364c
commit
0fc6c912fc
2
.github/workflows/HIL_Tests.yml
vendored
2
.github/workflows/HIL_Tests.yml
vendored
|
|
@ -56,7 +56,7 @@ jobs:
|
|||
needs: [PC_Application_RPi5, Embedded_Firmware]
|
||||
steps:
|
||||
- name: Run HIL tests
|
||||
run: |
|
||||
run: |
|
||||
cd Software/Integrationtests
|
||||
export DISPLAY=:0
|
||||
python3 Integrationtest.py
|
||||
|
|
|
|||
|
|
@ -91,13 +91,13 @@ class libreVNA:
|
|||
self.sock.send(b"\n")
|
||||
if check or (check is None and self.default_check_cmds):
|
||||
status = self.get_status(timeout=timeout)
|
||||
if self.get_status() & 0x20:
|
||||
if status & 0x20:
|
||||
raise Exception("Command Error")
|
||||
if self.get_status() & 0x10:
|
||||
if status & 0x10:
|
||||
raise Exception("Execution Error")
|
||||
if self.get_status() & 0x08:
|
||||
if status & 0x08:
|
||||
raise Exception("Device Error")
|
||||
if self.get_status() & 0x04:
|
||||
if status & 0x04:
|
||||
raise Exception("Query Error")
|
||||
return status
|
||||
else:
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import unittest
|
||||
|
||||
testmodules = [
|
||||
'tests.TestUpdate', # Must go first because it updates the connected VNA to the firwmare which should be tested
|
||||
'tests.TestConnect',
|
||||
'tests.TestStatusRegisters',
|
||||
'tests.TestMode',
|
||||
|
|
|
|||
|
|
@ -153,7 +153,7 @@ class TestCalibration(TestBase):
|
|||
# Start measurement and grab data
|
||||
self.vna.cmd(":VNA:ACQ:SINGLE TRUE")
|
||||
self.assertEqual(self.vna.query(":VNA:ACQ:FIN?"), "FALSE")
|
||||
self.vna.cmd("*WAI")
|
||||
self.vna.cmd("*WAI", timeout=3)
|
||||
self.assertEqual(self.vna.query(":VNA:ACQ:FIN?"), "TRUE")
|
||||
|
||||
cal.reset()
|
||||
|
|
|
|||
|
|
@ -225,7 +225,7 @@ class TestRST(TestBase):
|
|||
self.vna.cmd("SA:TRACK:EN TRUE")
|
||||
self.vna.cmd(f"SA:TRACK:LVL {pwr_1_2}")
|
||||
self.vna.cmd("SA:TRACK:NORM:EN TRUE")
|
||||
self.vna.cmd("SA:TRACK:NORM:LVL {pwr_1_3}")
|
||||
self.vna.cmd(f"SA:TRACK:NORM:LVL {pwr_1_3}")
|
||||
self.vna.cmd("SA:TRACK:OFF 1.0e+6;PORT 2")
|
||||
self.vna.cmd("VNA:ACQ:AVG 10")
|
||||
self.vna.cmd(f"VNA:ACQ:IFBW {ifbw_1_2}")
|
||||
|
|
@ -236,6 +236,9 @@ class TestRST(TestBase):
|
|||
self.vna.cmd(f"VNA:STIM:FREQ {f_1_3}")
|
||||
self.vna.cmd(f"VNA:STIM:LVL {pwr_min}")
|
||||
self.vna.cmd("VNA:SWEEP POWER")
|
||||
|
||||
# We just configured a lot of settings, give some time to empty the output queue from the GUI to the device
|
||||
time.sleep(2)
|
||||
|
||||
# Reset and verify all settings revert.
|
||||
self.vna.cmd("*RST")
|
||||
|
|
|
|||
|
|
@ -36,6 +36,10 @@ public:
|
|||
|
||||
virtual void deviceInfoUpdated() override;
|
||||
|
||||
public slots:
|
||||
void Run();
|
||||
void Stop();
|
||||
|
||||
private:
|
||||
static QString WindowToString(DeviceDriver::SASettings::Window w);
|
||||
static DeviceDriver::SASettings::Window WindowFromString(QString s);
|
||||
|
|
@ -70,8 +74,6 @@ private slots:
|
|||
void ClearNormalization();
|
||||
void SetNormalizationLevel(double level);
|
||||
|
||||
void Run();
|
||||
void Stop();
|
||||
void ConfigureDevice();
|
||||
void ResetLiveTraces();
|
||||
|
||||
|
|
|
|||
|
|
@ -76,6 +76,8 @@ public:
|
|||
};
|
||||
|
||||
public slots:
|
||||
void Run();
|
||||
void Stop();
|
||||
bool LoadCalibration(QString filename = "");
|
||||
bool SaveCalibration(QString filename = "");
|
||||
|
||||
|
|
@ -130,8 +132,6 @@ private slots:
|
|||
void EnableDeembedding(bool enable);
|
||||
void UpdateStatusbar();
|
||||
void SetSingleSweep(bool single);
|
||||
void Run();
|
||||
void Stop();
|
||||
void ConfigureDevice(bool resetTraces = true, std::function<void(bool)> cb = nullptr);
|
||||
void ResetLiveTraces();
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -322,8 +322,6 @@ void AppWindow::SetInitialState()
|
|||
modeHandler->createMode("Spectrum Analyzer", Mode::Type::SA);
|
||||
modeHandler->setCurrentIndex(vnaIndex);
|
||||
}
|
||||
|
||||
ResetReference();
|
||||
}
|
||||
|
||||
bool AppWindow::ConnectToDevice(QString serial, DeviceDriver *driver)
|
||||
|
|
@ -490,6 +488,15 @@ void AppWindow::SetupSCPI()
|
|||
}));
|
||||
scpi.add(new SCPICommand("*RST", [=](QStringList){
|
||||
SetInitialState();
|
||||
auto vna = dynamic_cast<VNA*>(modeHandler->getActiveMode());
|
||||
if(vna) {
|
||||
vna->Stop();
|
||||
}
|
||||
auto sa = dynamic_cast<SpectrumAnalyzer*>(modeHandler->getActiveMode());
|
||||
if(sa) {
|
||||
sa->Stop();
|
||||
}
|
||||
ResetReference();
|
||||
return SCPI::getResultName(SCPI::Result::Empty);
|
||||
}, nullptr));
|
||||
auto scpi_dev = new SCPINode("DEVice");
|
||||
|
|
@ -529,7 +536,10 @@ void AppWindow::SetupSCPI()
|
|||
// not connected to any device
|
||||
return SCPI::getResultName(SCPI::Result::Error);
|
||||
}
|
||||
if(!device->updateFirmware(params[0])) {
|
||||
scpi.setOperationPending(true);
|
||||
auto ret = device->updateFirmware(params[0]);
|
||||
scpi.setOperationPending(false);
|
||||
if(!ret) {
|
||||
// update failed
|
||||
return SCPI::getResultName(SCPI::Result::Error);
|
||||
} else {
|
||||
|
|
@ -1064,8 +1074,13 @@ int AppWindow::UpdateDeviceList()
|
|||
|
||||
void AppWindow::ResetReference()
|
||||
{
|
||||
toolbars.reference.type->blockSignals(true);
|
||||
toolbars.reference.outFreq->blockSignals(true);
|
||||
toolbars.reference.type->setCurrentIndex(0);
|
||||
toolbars.reference.outFreq->setCurrentIndex(0);
|
||||
toolbars.reference.type->blockSignals(false);
|
||||
toolbars.reference.outFreq->blockSignals(false);
|
||||
UpdateReference();
|
||||
}
|
||||
|
||||
//void AppWindow::StartManualControl()
|
||||
|
|
|
|||
|
|
@ -44,9 +44,9 @@ public:
|
|||
|
||||
bool changeName(QString newname);
|
||||
|
||||
protected:
|
||||
void setOperationPending(bool pending);
|
||||
|
||||
protected:
|
||||
bool isOperationPending();
|
||||
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -347,7 +347,7 @@ void HW::getDeviceStatus(Protocol::DeviceStatus *status, bool updateEvenWhenBusy
|
|||
status->V1.LO1_locked = (FPGA_status & (int) FPGA::Interrupt::LO1Unlock) ? 0 : 1;
|
||||
status->V1.source_locked = (FPGA_status & (int) FPGA::Interrupt::SourceUnlock) ? 0 : 1;
|
||||
status->V1.extRefAvailable = Ref::available();
|
||||
status->V1.extRefInUse = extRefInUse;
|
||||
status->V1.extRefInUse = Ref::usingExternal();
|
||||
status->V1.unlevel = unlevel;
|
||||
status->V1.temp_LO1 = tempLO;
|
||||
status->V1.temp_source = tempSource;
|
||||
|
|
@ -365,7 +365,7 @@ void HW::Ref::set(Protocol::ReferenceSettings s) {
|
|||
}
|
||||
|
||||
bool HW::Ref::usingExternal() {
|
||||
return extRefInUse;
|
||||
return extRefInUse && (ref.UseExternalRef || ref.AutomaticSwitch);
|
||||
}
|
||||
|
||||
void HW::Ref::update() {
|
||||
|
|
|
|||
Loading…
Reference in a new issue