settings
This commit is contained in:
parent
ada1425d83
commit
61ffa12988
2 changed files with 8 additions and 46 deletions
|
@ -8,10 +8,8 @@
|
|||
#include "helpers.h"
|
||||
|
||||
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,
|
||||
1.0e-3, 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,
|
||||
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,
|
||||
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,
|
||||
};
|
||||
static const double ChannelsSteps [] = {
|
||||
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]);
|
||||
ChA[m_timeCount] = pta;
|
||||
ChB[m_timeCount] = ptb;
|
||||
// printf("mode continuum\n");
|
||||
m_timeCount += 1u;
|
||||
m_timeCount &= T_MASK;
|
||||
return;
|
||||
|
@ -217,14 +214,6 @@ void DisplayWidget::reloadMatrix(const QSize & sz) {
|
|||
m_forward = tm;
|
||||
m_inverse = m_forward.inverted();
|
||||
}
|
||||
/*
|
||||
void DisplayWidget::Refresh(int n) {
|
||||
m_timeBase = n;
|
||||
reloadMatrix (size());
|
||||
drawBackground();
|
||||
update();
|
||||
}
|
||||
*/
|
||||
void DisplayWidget::TimeBaseRange(int n) {
|
||||
m_timeBase = n;
|
||||
reloadMatrix (size());
|
||||
|
@ -348,15 +337,20 @@ void DisplayWidget::reloadChRange(int a, int b) {
|
|||
}
|
||||
|
||||
void DisplayWidget::saveSettings(QSettings & setting) {
|
||||
setting.setValue("TimeBaseIndex", m_timeBase);
|
||||
setting.setValue("TimeA", m_time.a);
|
||||
setting.setValue("TimeB", m_time.b);
|
||||
setting.setValue("VoltA", m_volt.a);
|
||||
setting.setValue("VoltB", m_volt.b);
|
||||
setting.setValue("OfsA" , m_offset.a);
|
||||
setting.setValue("OfsB" , m_offset.b);
|
||||
}
|
||||
void DisplayWidget::restSettings(QSettings & setting) {
|
||||
m_time.a = setting.value("TimeA").toDouble();
|
||||
m_time.b = setting.value("TimeB").toDouble();
|
||||
m_volt.a = setting.value("VoltA").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) {
|
||||
if (n == TRIGER_MODE_SINGLE) ui->buttonStart->setEnabled(true);
|
||||
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);
|
||||
}
|
||||
void MainWindow::SendTrigerEdge (int n) {
|
||||
|
@ -159,14 +155,6 @@ void MainWindow::ExportImage (bool) {
|
|||
void MainWindow::SaveSettings(bool) {
|
||||
qDebug ("Save Settings");
|
||||
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");
|
||||
ui->Display->saveSettings (setting);
|
||||
setting.endGroup();
|
||||
|
@ -174,28 +162,8 @@ void MainWindow::SaveSettings(bool) {
|
|||
void MainWindow::RestSettings(bool) {
|
||||
qDebug ("Restore Settings");
|
||||
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");
|
||||
ui->Display->restSettings (setting);
|
||||
const int n = setting.value("TimeBaseIndex").toInt();
|
||||
TimeBaseRange(n);
|
||||
ui->comboTimeRange->setCurrentIndex(n);
|
||||
setting.endGroup();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue