Added attenuation and offset to backend

This commit is contained in:
Chris Esposito 2019-02-17 16:39:11 +11:00
parent 5e185ba08c
commit b78a65174f
3 changed files with 18 additions and 0 deletions

View File

@ -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);

View File

@ -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;

View File

@ -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()