Compare commits
3 commits
e0e6b36878
...
61ffa12988
Author | SHA1 | Date | |
---|---|---|---|
|
61ffa12988 | ||
|
ada1425d83 | ||
|
73d4e43f97 |
2 changed files with 25 additions and 56 deletions
|
@ -8,10 +8,8 @@
|
||||||
#include "helpers.h"
|
#include "helpers.h"
|
||||||
|
|
||||||
static const double TimeBaseSteps [] = {
|
static const double TimeBaseSteps [] = {
|
||||||
2.0e-6, 5.0e-6, 1.0e-5, 2.0e-5, 5.0e-5, 1.0e-4, 2.0e-4, 5.0e-4,
|
2.0e-6, 5.0e-6, 1.0e-5, 2.0e-5, 5.0e-5, 1.0e-4, 2.0e-4, 5.0e-4, 1.0e-3,
|
||||||
1.0e-3, 2.0e-3, 5.0e-3, 1.0e-2, 2.0e-2, 5.0e-2, 1.0e-1, 2.0e-1,
|
2.0e-3, 5.0e-3, 1.0e-2, 2.0e-2, 5.0e-2, 1.0e-1, 2.0e-1, 5.0e-1, 1.0,
|
||||||
|
|
||||||
5.0e-1, 1.0,
|
|
||||||
};
|
};
|
||||||
static const double ChannelsSteps [] = {
|
static const double ChannelsSteps [] = {
|
||||||
0.1, 0.2, 0.5,
|
0.1, 0.2, 0.5,
|
||||||
|
@ -189,7 +187,6 @@ void DisplayWidget::reloadData () {
|
||||||
const QPointF pta (m_timeCount, ACopy [0]), ptb (m_timeCount, BCopy [0]);
|
const QPointF pta (m_timeCount, ACopy [0]), ptb (m_timeCount, BCopy [0]);
|
||||||
ChA[m_timeCount] = pta;
|
ChA[m_timeCount] = pta;
|
||||||
ChB[m_timeCount] = ptb;
|
ChB[m_timeCount] = ptb;
|
||||||
// printf("mode continuum\n");
|
|
||||||
m_timeCount += 1u;
|
m_timeCount += 1u;
|
||||||
m_timeCount &= T_MASK;
|
m_timeCount &= T_MASK;
|
||||||
return;
|
return;
|
||||||
|
@ -217,14 +214,6 @@ void DisplayWidget::reloadMatrix(const QSize & sz) {
|
||||||
m_forward = tm;
|
m_forward = tm;
|
||||||
m_inverse = m_forward.inverted();
|
m_inverse = m_forward.inverted();
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
void DisplayWidget::Refresh(int n) {
|
|
||||||
m_timeBase = n;
|
|
||||||
reloadMatrix (size());
|
|
||||||
drawBackground();
|
|
||||||
update();
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
void DisplayWidget::TimeBaseRange(int n) {
|
void DisplayWidget::TimeBaseRange(int n) {
|
||||||
m_timeBase = n;
|
m_timeBase = n;
|
||||||
reloadMatrix (size());
|
reloadMatrix (size());
|
||||||
|
@ -262,20 +251,24 @@ void DisplayWidget::drawBackground() {
|
||||||
// triger
|
// triger
|
||||||
const double ofs = (m_TrgSource ? m_offset.b : m_offset.a) - HALF_Y;
|
const double ofs = (m_TrgSource ? m_offset.b : m_offset.a) - HALF_Y;
|
||||||
QPointF trg (m_ts->offset, m_ts->value + ofs);
|
QPointF trg (m_ts->offset, m_ts->value + ofs);
|
||||||
QPen pc (QColor(0,0,255), 1);
|
QPen pc (QColor(0,128,255), 1);
|
||||||
p.setPen(pc);
|
p.setPen(pc);
|
||||||
const QLineF hline (xb, trg.y(), xe, trg.y());
|
const qreal pos = 30.0;
|
||||||
const QLineF vline (trg.x(), -ye, trg.x(), ye);
|
const QLineF hline = m_forward.map(QLine(xb, trg.y(), xe, trg.y()));
|
||||||
p.drawLine (m_forward.map(hline));
|
const QLineF vline = m_forward.map(QLine(trg.x(), -ye, trg.x(), ye));
|
||||||
p.drawLine (m_forward.map(vline));
|
QPointF vb = vline.p1() + QPointF(0,-pos), ve = vline.p2() + QPointF(0,+pos);
|
||||||
|
p.drawLine (hline);
|
||||||
|
p.drawLine (QLineF(vb,ve));
|
||||||
// markers
|
// markers
|
||||||
QPen pm (QColor(255,255,0,196), 1);
|
QPen pm (QColor(255,255,0,196), 1);
|
||||||
p.setPen(pm);
|
p.setPen(pm);
|
||||||
if (marker_type == MARKER_TIME) {
|
if (marker_type == MARKER_TIME) {
|
||||||
const QLineF ma (m_time.a, -ye, m_time.a, ye);
|
const QLineF ma = m_forward.map(QLine (m_time.a, -ye, m_time.a, ye));
|
||||||
const QLineF mb (m_time.b, -ye, m_time.b, ye);
|
const QLineF mb = m_forward.map(QLine (m_time.b, -ye, m_time.b, ye));
|
||||||
p.drawLine (m_forward.map(ma));
|
vb = ma.p1() + QPointF(0,-pos), ve = ma.p2() + QPointF(0,+pos);
|
||||||
p.drawLine (m_forward.map(mb));
|
p.drawLine (QLineF(vb, ve));
|
||||||
|
vb = mb.p1() + QPointF(0,-pos), ve = mb.p2() + QPointF(0,+pos);
|
||||||
|
p.drawLine (QLineF(vb, ve));
|
||||||
} else {
|
} else {
|
||||||
const QLineF ma (xb, m_volt.a, xe, m_volt.a);
|
const QLineF ma (xb, m_volt.a, xe, m_volt.a);
|
||||||
const QLineF mb (xb, m_volt.b, xe, m_volt.b);
|
const QLineF mb (xb, m_volt.b, xe, m_volt.b);
|
||||||
|
@ -285,12 +278,15 @@ void DisplayWidget::drawBackground() {
|
||||||
// offsets
|
// offsets
|
||||||
QPen ofpen(pcol.colA);
|
QPen ofpen(pcol.colA);
|
||||||
QVector<qreal>dashes;
|
QVector<qreal>dashes;
|
||||||
dashes << 5 << 5 << 1 << 5;
|
const qreal gap = 10;
|
||||||
|
dashes << gap << gap;
|
||||||
ofpen.setDashPattern(dashes);
|
ofpen.setDashPattern(dashes);
|
||||||
p.setPen (ofpen);
|
p.setPen (ofpen);
|
||||||
const QLineF oa (xb, m_offset.a, xe, m_offset.a);
|
const QLineF oa (xb, m_offset.a, xe, m_offset.a);
|
||||||
p.drawLine (m_forward.map(oa));
|
p.drawLine (m_forward.map(oa));
|
||||||
ofpen.setColor(pcol.colB);
|
ofpen.setColor(pcol.colB);
|
||||||
|
ofpen.setDashPattern(dashes);
|
||||||
|
ofpen.setDashOffset(gap);
|
||||||
p.setPen (ofpen);
|
p.setPen (ofpen);
|
||||||
const QLineF ob (xb, m_offset.b, xe, m_offset.b);
|
const QLineF ob (xb, m_offset.b, xe, m_offset.b);
|
||||||
p.drawLine (m_forward.map(ob));
|
p.drawLine (m_forward.map(ob));
|
||||||
|
@ -341,15 +337,20 @@ void DisplayWidget::reloadChRange(int a, int b) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayWidget::saveSettings(QSettings & setting) {
|
void DisplayWidget::saveSettings(QSettings & setting) {
|
||||||
setting.setValue("TimeBaseIndex", m_timeBase);
|
|
||||||
setting.setValue("TimeA", m_time.a);
|
setting.setValue("TimeA", m_time.a);
|
||||||
setting.setValue("TimeB", m_time.b);
|
setting.setValue("TimeB", m_time.b);
|
||||||
setting.setValue("VoltA", m_volt.a);
|
setting.setValue("VoltA", m_volt.a);
|
||||||
setting.setValue("VoltB", m_volt.b);
|
setting.setValue("VoltB", m_volt.b);
|
||||||
|
setting.setValue("OfsA" , m_offset.a);
|
||||||
|
setting.setValue("OfsB" , m_offset.b);
|
||||||
}
|
}
|
||||||
void DisplayWidget::restSettings(QSettings & setting) {
|
void DisplayWidget::restSettings(QSettings & setting) {
|
||||||
m_time.a = setting.value("TimeA").toDouble();
|
m_time.a = setting.value("TimeA").toDouble();
|
||||||
m_time.b = setting.value("TimeB").toDouble();
|
m_time.b = setting.value("TimeB").toDouble();
|
||||||
m_volt.a = setting.value("VoltA").toDouble();
|
m_volt.a = setting.value("VoltA").toDouble();
|
||||||
m_volt.b = setting.value("VoltB").toDouble();
|
m_volt.b = setting.value("VoltB").toDouble();
|
||||||
|
m_offset.a = setting.value("OfsA").toDouble();
|
||||||
|
m_offset.b = setting.value("OfsB").toDouble();
|
||||||
|
drawBackground();
|
||||||
|
update();
|
||||||
}
|
}
|
||||||
|
|
|
@ -124,10 +124,6 @@ void MainWindow::SendVoltageB(int n) {
|
||||||
void MainWindow::SendTrigerMode (int n) {
|
void MainWindow::SendTrigerMode (int n) {
|
||||||
if (n == TRIGER_MODE_SINGLE) ui->buttonStart->setEnabled(true);
|
if (n == TRIGER_MODE_SINGLE) ui->buttonStart->setEnabled(true);
|
||||||
else ui->buttonStart->setEnabled(false);
|
else ui->buttonStart->setEnabled(false);
|
||||||
/*
|
|
||||||
if (n == TRIGER_MODE_AUTO) ui->comboTimeRange->setEnabled(true); // BUG - jinak dojde při přepínání k chybě
|
|
||||||
else ui->comboTimeRange->setEnabled(false); // fixed
|
|
||||||
*/
|
|
||||||
firmware.SendTrigerMode(n);
|
firmware.SendTrigerMode(n);
|
||||||
}
|
}
|
||||||
void MainWindow::SendTrigerEdge (int n) {
|
void MainWindow::SendTrigerEdge (int n) {
|
||||||
|
@ -159,14 +155,6 @@ void MainWindow::ExportImage (bool) {
|
||||||
void MainWindow::SaveSettings(bool) {
|
void MainWindow::SaveSettings(bool) {
|
||||||
qDebug ("Save Settings");
|
qDebug ("Save Settings");
|
||||||
QSettings setting ("Kizarm", "Scope");
|
QSettings setting ("Kizarm", "Scope");
|
||||||
setting.beginGroup("Trigger");
|
|
||||||
const TrigerSettings * const ts = firmware.getTrigger();
|
|
||||||
setting.setValue("Value", ts->value);
|
|
||||||
setting.setValue("Offset", ts->offset);
|
|
||||||
setting.setValue("Mode", ts->mode);
|
|
||||||
setting.setValue("Channel", ts->channel);
|
|
||||||
setting.setValue("Edge", ts->rising);
|
|
||||||
setting.endGroup();
|
|
||||||
setting.beginGroup("Markers");
|
setting.beginGroup("Markers");
|
||||||
ui->Display->saveSettings (setting);
|
ui->Display->saveSettings (setting);
|
||||||
setting.endGroup();
|
setting.endGroup();
|
||||||
|
@ -174,28 +162,8 @@ void MainWindow::SaveSettings(bool) {
|
||||||
void MainWindow::RestSettings(bool) {
|
void MainWindow::RestSettings(bool) {
|
||||||
qDebug ("Restore Settings");
|
qDebug ("Restore Settings");
|
||||||
QSettings setting ("Kizarm", "Scope");
|
QSettings setting ("Kizarm", "Scope");
|
||||||
setting.beginGroup("Trigger");
|
|
||||||
TrigerSettings ts;
|
|
||||||
ts.value = setting.value ("Value").toInt();
|
|
||||||
ts.offset = setting.value ("Offset").toInt();
|
|
||||||
ts.mode = static_cast<TRIGER_MODE> (setting.value ("Mode").toInt());
|
|
||||||
ui->comboMode->setCurrentIndex(ts.mode);
|
|
||||||
ts.channel = static_cast<ADC_CHANNELS> (setting.value ("Channel").toInt());
|
|
||||||
ui->comboChannel->setCurrentIndex(ts.channel);
|
|
||||||
ts.rising = setting.value ("Edge").toBool();
|
|
||||||
ui->comboRissing->setCurrentIndex(ts.value ? 1 : 0);
|
|
||||||
memcpy (firmware.getTrigger(), & ts, sizeof(TrigerSettings));
|
|
||||||
setting.endGroup();
|
|
||||||
|
|
||||||
SendTrigerMode (ts.mode);
|
|
||||||
firmware.SettingChanged(MOVE_VALUE);
|
|
||||||
firmware.SettingChanged(MOVE_OFSET);
|
|
||||||
|
|
||||||
setting.beginGroup("Markers");
|
setting.beginGroup("Markers");
|
||||||
ui->Display->restSettings (setting);
|
ui->Display->restSettings (setting);
|
||||||
const int n = setting.value("TimeBaseIndex").toInt();
|
|
||||||
TimeBaseRange(n);
|
|
||||||
ui->comboTimeRange->setCurrentIndex(n);
|
|
||||||
setting.endGroup();
|
setting.endGroup();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue