mirror of
https://github.com/jankae/LibreVNA.git
synced 2026-04-06 15:04:11 +00:00
Merge branch 'SCPI_improvement' into HIL_actions
This commit is contained in:
commit
c5d045364c
21 changed files with 813 additions and 110 deletions
|
|
@ -143,11 +143,6 @@ AppWindow::AppWindow(QWidget *parent)
|
|||
central = new QStackedWidget;
|
||||
setCentralWidget(central);
|
||||
|
||||
auto vnaIndex = modeHandler->createMode("Vector Network Analyzer", Mode::Type::VNA);
|
||||
modeHandler->createMode("Signal Generator", Mode::Type::SG);
|
||||
modeHandler->createMode("Spectrum Analyzer", Mode::Type::SA);
|
||||
modeHandler->setCurrentIndex(vnaIndex);
|
||||
|
||||
auto setModeStatusbar = [=](const QString &msg) {
|
||||
lModeInfo.setText(msg);
|
||||
};
|
||||
|
|
@ -170,10 +165,9 @@ AppWindow::AppWindow(QWidget *parent)
|
|||
|
||||
SetupSCPI();
|
||||
|
||||
SetInitialState();
|
||||
|
||||
auto& pref = Preferences::getInstance();
|
||||
if(pref.Startup.UseSetupFile) {
|
||||
LoadSetup(pref.Startup.SetupFile);
|
||||
}
|
||||
// List available devices
|
||||
UpdateDeviceList();
|
||||
if(pref.Startup.ConnectToFirstDevice && deviceList.size() > 0) {
|
||||
|
|
@ -315,6 +309,23 @@ void AppWindow::closeEvent(QCloseEvent *event)
|
|||
QMainWindow::closeEvent(event);
|
||||
}
|
||||
|
||||
void AppWindow::SetInitialState()
|
||||
{
|
||||
modeHandler->closeModes();
|
||||
|
||||
auto& pref = Preferences::getInstance();
|
||||
if(pref.Startup.UseSetupFile) {
|
||||
LoadSetup(pref.Startup.SetupFile);
|
||||
} else {
|
||||
auto vnaIndex = modeHandler->createMode("Vector Network Analyzer", Mode::Type::VNA);
|
||||
modeHandler->createMode("Signal Generator", Mode::Type::SG);
|
||||
modeHandler->createMode("Spectrum Analyzer", Mode::Type::SA);
|
||||
modeHandler->setCurrentIndex(vnaIndex);
|
||||
}
|
||||
|
||||
ResetReference();
|
||||
}
|
||||
|
||||
bool AppWindow::ConnectToDevice(QString serial, DeviceDriver *driver)
|
||||
{
|
||||
if(serial.isEmpty()) {
|
||||
|
|
@ -477,9 +488,10 @@ void AppWindow::SetupSCPI()
|
|||
scpi.add(new SCPICommand("*IDN", nullptr, [=](QStringList){
|
||||
return "LibreVNA,LibreVNA-GUI,dummy_serial,"+appVersion;
|
||||
}));
|
||||
scpi.add(new SCPICommand("*OPC", nullptr, [=](QStringList){
|
||||
return "1";
|
||||
}));
|
||||
scpi.add(new SCPICommand("*RST", [=](QStringList){
|
||||
SetInitialState();
|
||||
return SCPI::getResultName(SCPI::Result::Empty);
|
||||
}, nullptr));
|
||||
auto scpi_dev = new SCPINode("DEVice");
|
||||
scpi.add(scpi_dev);
|
||||
scpi_dev->add(new SCPICommand("DISConnect", [=](QStringList params) -> QString {
|
||||
|
|
@ -1050,6 +1062,12 @@ int AppWindow::UpdateDeviceList()
|
|||
return available;
|
||||
}
|
||||
|
||||
void AppWindow::ResetReference()
|
||||
{
|
||||
toolbars.reference.type->setCurrentIndex(0);
|
||||
toolbars.reference.outFreq->setCurrentIndex(0);
|
||||
}
|
||||
|
||||
//void AppWindow::StartManualControl()
|
||||
//{
|
||||
// if(!vdevice || vdevice->isCompoundDevice()) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue