From 1479d95f97169c118f3a984ef0a838324a388898 Mon Sep 17 00:00:00 2001 From: Chris Esposito Date: Sun, 17 Feb 2019 19:08:50 +1100 Subject: [PATCH] frontend for offset and attenuation: --- Desktop_Interface/isodriver.cpp | 46 ++++++++++++++++++- Desktop_Interface/isodriver.h | 4 ++ Desktop_Interface/mainwindow.cpp | 6 +++ .../ui_files_desktop/mainwindow.ui | 4 +- 4 files changed, 57 insertions(+), 3 deletions(-) diff --git a/Desktop_Interface/isodriver.cpp b/Desktop_Interface/isodriver.cpp index ecf5fbe0..f6d945b3 100644 --- a/Desktop_Interface/isodriver.cpp +++ b/Desktop_Interface/isodriver.cpp @@ -1458,6 +1458,50 @@ void isoDriver::triggerStateChanged() break; } } - } +void isoDriver::offsetChanged_CH1(double newOffset) +{ + m_offset_CH1 = newOffset; +} + +void isoDriver::offsetChanged_CH2(double newOffset) +{ + m_offset_CH2 = newOffset; +} + +void isoDriver::attenuationChanged_CH1(int attenuationIndex) +{ + switch(attenuationIndex) + { + case 0: + m_attenuation_CH1 = 1; + break; + case 1: + m_attenuation_CH1 = 5; + break; + case 2: + m_attenuation_CH1 = 10; + break; + default: + throw std::runtime_error("Unknown attenuation index for CH1"); + } +} + +void isoDriver::attenuationChanged_CH2(int attenuationIndex) +{ + switch(attenuationIndex) + { + case 0: + m_attenuation_CH2 = 1; + break; + case 1: + m_attenuation_CH2 = 5; + break; + case 2: + m_attenuation_CH2 = 10; + break; + default: + throw std::runtime_error("Unknown attenuation index for CH2"); + } +} diff --git a/Desktop_Interface/isodriver.h b/Desktop_Interface/isodriver.h index 5ad3e0e1..2424c511 100644 --- a/Desktop_Interface/isodriver.h +++ b/Desktop_Interface/isodriver.h @@ -221,6 +221,10 @@ public slots: void disableFileMode(); void hideCH1(bool enable); void hideCH2(bool enable); + void offsetChanged_CH1(double newOffset); + void offsetChanged_CH2(double newOffset); + void attenuationChanged_CH1(int attenuationIndex); + void attenuationChanged_CH2(int attenuationIndex); }; #endif // ISODRIVER_H diff --git a/Desktop_Interface/mainwindow.cpp b/Desktop_Interface/mainwindow.cpp index 054ce2d2..77abc7cd 100644 --- a/Desktop_Interface/mainwindow.cpp +++ b/Desktop_Interface/mainwindow.cpp @@ -2,6 +2,7 @@ #include "uartstyledecoder.h" #include "daqform.h" #include +#include "espospinbox.h" namespace { @@ -210,6 +211,11 @@ MainWindow::MainWindow(QWidget *parent) : { this->setGeometry(64, 64, 1440, 880); } + + connect(ui->offsetSpinBox_CH1, SIGNAL(valueChanged(double)), ui->controller_iso, SLOT(offsetChanged_CH1(double))); + connect(ui->offsetSpinBox_CH2, SIGNAL(valueChanged(double)), ui->controller_iso, SLOT(offsetChanged_CH2(double))); + connect(ui->attenuationComboBox_CH1, SIGNAL(currentIndexChanged(int)), ui->controller_iso, SLOT(attenuationChanged_CH1(int))); + connect(ui->attenuationComboBox_CH2, SIGNAL(currentIndexChanged(int)), ui->controller_iso, SLOT(attenuationChanged_CH2(int))); } MainWindow::~MainWindow() diff --git a/Desktop_Interface/ui_files_desktop/mainwindow.ui b/Desktop_Interface/ui_files_desktop/mainwindow.ui index a07724b3..6d2e28ae 100644 --- a/Desktop_Interface/ui_files_desktop/mainwindow.ui +++ b/Desktop_Interface/ui_files_desktop/mainwindow.ui @@ -266,7 +266,7 @@ - + 1x @@ -471,7 +471,7 @@ - + 1x