From b78a65174f2bf3ecafb473ef97d6b28b046c1a8c Mon Sep 17 00:00:00 2001 From: Chris Esposito Date: Sun, 17 Feb 2019 16:39:11 +1100 Subject: [PATCH] Added attenuation and offset to backend --- Desktop_Interface/isodriver.cpp | 10 ++++++++++ Desktop_Interface/isodriver.h | 4 ++++ Desktop_Interface/mainwindow.cpp | 4 ++++ 3 files changed, 18 insertions(+) diff --git a/Desktop_Interface/isodriver.cpp b/Desktop_Interface/isodriver.cpp index f980bced..ecf5fbe0 100644 --- a/Desktop_Interface/isodriver.cpp +++ b/Desktop_Interface/isodriver.cpp @@ -701,6 +701,11 @@ void isoDriver::frameActionGeneric(char CH1_mode, char CH2_mode) //0 for off, 1 if (CH1_mode == 1){ analogConvert(readData375_CH1.get(), &CH1, 128, AC_CH1, 1); + for (int i=0; i < GRAPH_SAMPLES; i++) + { + CH1[i] /= m_attenuation_CH1; + CH1[i] += m_offset_CH1; + } xmin = (currentVmin < xmin) ? currentVmin : xmin; xmax = (currentVmax > xmax) ? currentVmax : xmax; broadcastStats(0); @@ -709,6 +714,11 @@ void isoDriver::frameActionGeneric(char CH1_mode, char CH2_mode) //0 for off, 1 if (CH2_mode == 1){ analogConvert(readData375_CH2.get(), &CH2, 128, AC_CH2, 2); + for (int i=0; i < GRAPH_SAMPLES; i++) + { + CH2[i] /= m_attenuation_CH2; + CH2[i] += m_offset_CH2; + } ymin = (currentVmin < ymin) ? currentVmin : ymin; ymax = (currentVmax > ymax) ? currentVmax : ymax; broadcastStats(1); diff --git a/Desktop_Interface/isodriver.h b/Desktop_Interface/isodriver.h index 81e27ea1..5ad3e0e1 100644 --- a/Desktop_Interface/isodriver.h +++ b/Desktop_Interface/isodriver.h @@ -108,6 +108,10 @@ private: double estimated_resistance = 0; int multimeterRsource = 0; int triggerMode = 0; + double m_offset_CH1 = 0; + double m_offset_CH2 = 0; + double m_attenuation_CH1 = 1; + double m_attenuation_CH2 = 1; //Pure MM++ related variables enum multimeterType_enum {V = 0, I = 1, R = 2, C = 3}; multimeterType_enum multimeterType = V; diff --git a/Desktop_Interface/mainwindow.cpp b/Desktop_Interface/mainwindow.cpp index 9e07c477..fc377467 100644 --- a/Desktop_Interface/mainwindow.cpp +++ b/Desktop_Interface/mainwindow.cpp @@ -202,6 +202,10 @@ MainWindow::MainWindow(QWidget *parent) : qDebug() << "Low resolution detected:" << QApplication::desktop()->availableGeometry().width() << "x" << QApplication::desktop()->availableGeometry().height(); this->setGeometry(64, 64, 800, 600); } + else + { + this->setGeometry(64, 64, 1440, 900); + } } MainWindow::~MainWindow()