kopia lustrzana https://gitlab.com/Teuniz/DSRemote
Start to begin to implement serial decoding. Not finished yet, it's a work in progress.
rodzic
793f66baa3
commit
5aa417ad8e
|
|
@ -0,0 +1,780 @@
|
||||||
|
/*
|
||||||
|
***************************************************************************
|
||||||
|
*
|
||||||
|
* Author: Teunis van Beelen
|
||||||
|
*
|
||||||
|
* Copyright (C) 2016 Teunis van Beelen
|
||||||
|
*
|
||||||
|
* Email: teuniz@gmail.com
|
||||||
|
*
|
||||||
|
***************************************************************************
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
***************************************************************************
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include "decode_dialog.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
UI_decoder_window::UI_decoder_window(QWidget *w_parent)
|
||||||
|
{
|
||||||
|
mainwindow = (UI_Mainwindow *)w_parent;
|
||||||
|
|
||||||
|
devparms = &mainwindow->devparms;
|
||||||
|
|
||||||
|
setWindowTitle("Decode");
|
||||||
|
|
||||||
|
setMinimumSize(690, 525);
|
||||||
|
setMaximumSize(690, 525);
|
||||||
|
|
||||||
|
tabholder = new QTabWidget(this);
|
||||||
|
tabholder->setGeometry(0, 0, 690, 455);
|
||||||
|
|
||||||
|
tab_par = new QWidget;
|
||||||
|
tab_uart = new QWidget;
|
||||||
|
tab_spi = new QWidget;
|
||||||
|
tab_iic = new QWidget;
|
||||||
|
|
||||||
|
spi_clk_src_label = new QLabel(tab_spi);
|
||||||
|
spi_clk_src_label->setGeometry(10, 20, 100, 25);
|
||||||
|
spi_clk_src_label->setText("Clock");
|
||||||
|
|
||||||
|
spi_clk_src_combobox = new QComboBox(tab_spi);
|
||||||
|
spi_clk_src_combobox->setGeometry(130, 20, 100, 25);
|
||||||
|
spi_clk_src_combobox->addItem("Off");
|
||||||
|
spi_clk_src_combobox->addItem("Ch. 1");
|
||||||
|
spi_clk_src_combobox->addItem("Ch. 2");
|
||||||
|
spi_clk_src_combobox->addItem("Ch. 3");
|
||||||
|
spi_clk_src_combobox->addItem("Ch. 4");
|
||||||
|
spi_clk_src_combobox->setCurrentIndex(devparms->math_decode_spi_clk);
|
||||||
|
|
||||||
|
spi_clk_threshold_label = new QLabel(tab_spi);
|
||||||
|
spi_clk_threshold_label->setGeometry(270, 20, 100, 25);
|
||||||
|
spi_clk_threshold_label->setText("Threshold");
|
||||||
|
|
||||||
|
spi_clk_threshold_dspinbox = new QDoubleSpinBox(tab_spi);
|
||||||
|
spi_clk_threshold_dspinbox->setGeometry(370, 20, 100, 25);
|
||||||
|
spi_clk_threshold_dspinbox->setDecimals(3);
|
||||||
|
|
||||||
|
spi_threshold_auto_combobox = new QComboBox(tab_spi);
|
||||||
|
spi_threshold_auto_combobox->setGeometry(510, 20, 140, 25);
|
||||||
|
spi_threshold_auto_combobox->addItem("Manual threshold");
|
||||||
|
spi_threshold_auto_combobox->addItem("Auto threshold");
|
||||||
|
if(devparms->modelserie == 6)
|
||||||
|
{
|
||||||
|
devparms->math_decode_threshold_auto = 0;
|
||||||
|
spi_threshold_auto_combobox->setCurrentIndex(0);
|
||||||
|
spi_threshold_auto_combobox->setEnabled(false);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
spi_threshold_auto_combobox->setCurrentIndex(devparms->math_decode_threshold_auto);
|
||||||
|
}
|
||||||
|
|
||||||
|
spi_mosi_src_label = new QLabel(tab_spi);
|
||||||
|
spi_mosi_src_label->setGeometry(10, 55, 100, 25);
|
||||||
|
spi_mosi_src_label->setText("MOSI");
|
||||||
|
|
||||||
|
spi_mosi_src_combobox = new QComboBox(tab_spi);
|
||||||
|
spi_mosi_src_combobox->setGeometry(130, 55, 100, 25);
|
||||||
|
spi_mosi_src_combobox->addItem("Off");
|
||||||
|
spi_mosi_src_combobox->addItem("Ch. 1");
|
||||||
|
spi_mosi_src_combobox->addItem("Ch. 2");
|
||||||
|
spi_mosi_src_combobox->addItem("Ch. 3");
|
||||||
|
spi_mosi_src_combobox->addItem("Ch. 4");
|
||||||
|
spi_mosi_src_combobox->setCurrentIndex(devparms->math_decode_spi_mosi);
|
||||||
|
|
||||||
|
spi_mosi_threshold_label = new QLabel(tab_spi);
|
||||||
|
spi_mosi_threshold_label->setGeometry(270, 55, 100, 25);
|
||||||
|
spi_mosi_threshold_label->setText("Threshold");
|
||||||
|
|
||||||
|
spi_mosi_threshold_dspinbox = new QDoubleSpinBox(tab_spi);
|
||||||
|
spi_mosi_threshold_dspinbox->setGeometry(370, 55, 100, 25);
|
||||||
|
spi_mosi_threshold_dspinbox->setDecimals(3);
|
||||||
|
|
||||||
|
spi_miso_src_label = new QLabel(tab_spi);
|
||||||
|
spi_miso_src_label->setGeometry(10, 90, 100, 25);
|
||||||
|
spi_miso_src_label->setText("MISO");
|
||||||
|
|
||||||
|
spi_miso_src_combobox = new QComboBox(tab_spi);
|
||||||
|
spi_miso_src_combobox->setGeometry(130, 90, 100, 25);
|
||||||
|
spi_miso_src_combobox->addItem("Off");
|
||||||
|
spi_miso_src_combobox->addItem("Ch. 1");
|
||||||
|
spi_miso_src_combobox->addItem("Ch. 2");
|
||||||
|
spi_miso_src_combobox->addItem("Ch. 3");
|
||||||
|
spi_miso_src_combobox->addItem("Ch. 4");
|
||||||
|
spi_miso_src_combobox->setCurrentIndex(devparms->math_decode_spi_miso);
|
||||||
|
|
||||||
|
spi_miso_threshold_label = new QLabel(tab_spi);
|
||||||
|
spi_miso_threshold_label->setGeometry(270, 90, 100, 25);
|
||||||
|
spi_miso_threshold_label->setText("Threshold");
|
||||||
|
|
||||||
|
spi_miso_threshold_dspinbox = new QDoubleSpinBox(tab_spi);
|
||||||
|
spi_miso_threshold_dspinbox->setGeometry(370, 90, 100, 25);
|
||||||
|
spi_miso_threshold_dspinbox->setDecimals(3);
|
||||||
|
|
||||||
|
spi_cs_src_label = new QLabel(tab_spi);
|
||||||
|
spi_cs_src_label->setGeometry(10, 125, 100, 25);
|
||||||
|
spi_cs_src_label->setText("CS");
|
||||||
|
|
||||||
|
spi_cs_src_combobox = new QComboBox(tab_spi);
|
||||||
|
spi_cs_src_combobox->setGeometry(130, 125, 100, 25);
|
||||||
|
spi_cs_src_combobox->addItem("Off");
|
||||||
|
spi_cs_src_combobox->addItem("Ch. 1");
|
||||||
|
spi_cs_src_combobox->addItem("Ch. 2");
|
||||||
|
spi_cs_src_combobox->addItem("Ch. 3");
|
||||||
|
spi_cs_src_combobox->addItem("Ch. 4");
|
||||||
|
spi_cs_src_combobox->setCurrentIndex(devparms->math_decode_spi_cs);
|
||||||
|
|
||||||
|
spi_cs_threshold_label = new QLabel(tab_spi);
|
||||||
|
spi_cs_threshold_label->setGeometry(270, 125, 100, 25);
|
||||||
|
spi_cs_threshold_label->setText("Threshold");
|
||||||
|
|
||||||
|
spi_cs_threshold_dspinbox = new QDoubleSpinBox(tab_spi);
|
||||||
|
spi_cs_threshold_dspinbox->setGeometry(370, 125, 100, 25);
|
||||||
|
spi_cs_threshold_dspinbox->setDecimals(3);
|
||||||
|
|
||||||
|
spi_select_label = new QLabel(tab_spi);
|
||||||
|
spi_select_label->setGeometry(10, 160, 100, 25);
|
||||||
|
spi_select_label->setText("CS active level");
|
||||||
|
|
||||||
|
spi_select_combobox = new QComboBox(tab_spi);
|
||||||
|
spi_select_combobox->setGeometry(130, 160, 100, 25);
|
||||||
|
spi_select_combobox->addItem("Low");
|
||||||
|
spi_select_combobox->addItem("High");
|
||||||
|
spi_select_combobox->setCurrentIndex(devparms->math_decode_spi_select);
|
||||||
|
|
||||||
|
spi_mode_label = new QLabel(tab_spi);
|
||||||
|
spi_mode_label->setGeometry(10, 195, 100, 25);
|
||||||
|
spi_mode_label->setText("Mode");
|
||||||
|
|
||||||
|
spi_mode_combobox = new QComboBox(tab_spi);
|
||||||
|
spi_mode_combobox->setGeometry(130, 195, 100, 25);
|
||||||
|
spi_mode_combobox->addItem("Timeout");
|
||||||
|
spi_mode_combobox->addItem("CS");
|
||||||
|
spi_mode_combobox->setCurrentIndex(devparms->math_decode_spi_mode);
|
||||||
|
|
||||||
|
spi_timeout_label = new QLabel(tab_spi);
|
||||||
|
spi_timeout_label->setGeometry(10, 230, 100, 25);
|
||||||
|
spi_timeout_label->setText("Timeout");
|
||||||
|
|
||||||
|
spi_timeout_dspinbox = new QDoubleSpinBox(tab_spi);
|
||||||
|
spi_timeout_dspinbox->setGeometry(110, 230, 120, 25);
|
||||||
|
spi_timeout_dspinbox->setSuffix(" Sec.");
|
||||||
|
spi_timeout_dspinbox->setDecimals(7);
|
||||||
|
spi_timeout_dspinbox->setRange(1e-7, 1.0);
|
||||||
|
spi_timeout_dspinbox->setValue(devparms->math_decode_spi_timeout);
|
||||||
|
|
||||||
|
spi_polarity_label = new QLabel(tab_spi);
|
||||||
|
spi_polarity_label->setGeometry(10, 265, 100, 25);
|
||||||
|
spi_polarity_label->setText("Polarity");
|
||||||
|
|
||||||
|
spi_polarity_combobox = new QComboBox(tab_spi);
|
||||||
|
spi_polarity_combobox->setGeometry(130, 265, 100, 25);
|
||||||
|
spi_polarity_combobox->addItem("Negative");
|
||||||
|
spi_polarity_combobox->addItem("Positive");
|
||||||
|
|
||||||
|
spi_edge_label = new QLabel(tab_spi);
|
||||||
|
spi_edge_label->setGeometry(10, 300, 100, 25);
|
||||||
|
spi_edge_label->setText("Edge");
|
||||||
|
|
||||||
|
spi_edge_combobox = new QComboBox(tab_spi);
|
||||||
|
spi_edge_combobox->setGeometry(130, 300, 100, 25);
|
||||||
|
spi_edge_combobox->addItem("Falling");
|
||||||
|
spi_edge_combobox->addItem("Rising");
|
||||||
|
spi_edge_combobox->setCurrentIndex(devparms->math_decode_spi_edge);
|
||||||
|
|
||||||
|
spi_endian_label = new QLabel(tab_spi);
|
||||||
|
spi_endian_label->setGeometry(10, 335, 100, 25);
|
||||||
|
spi_endian_label->setText("Endian");
|
||||||
|
|
||||||
|
spi_endian_combobox = new QComboBox(tab_spi);
|
||||||
|
spi_endian_combobox->setGeometry(130, 335, 100, 25);
|
||||||
|
spi_endian_combobox->addItem("LSB");
|
||||||
|
spi_endian_combobox->addItem("MSB");
|
||||||
|
spi_endian_combobox->setCurrentIndex(devparms->math_decode_spi_end);
|
||||||
|
|
||||||
|
spi_width_label = new QLabel(tab_spi);
|
||||||
|
spi_width_label->setGeometry(10, 370, 100, 25);
|
||||||
|
spi_width_label->setText("Width");
|
||||||
|
|
||||||
|
spi_width_spinbox = new QSpinBox(tab_spi);
|
||||||
|
spi_width_spinbox->setGeometry(130, 370, 100, 25);
|
||||||
|
spi_width_spinbox->setSuffix(" bits");
|
||||||
|
spi_width_spinbox->setRange(8, 32);
|
||||||
|
spi_width_spinbox->setValue(devparms->math_decode_spi_width);
|
||||||
|
|
||||||
|
spi_trace_pos_label = new QLabel(tab_spi);
|
||||||
|
spi_trace_pos_label->setGeometry(270, 370, 100, 25);
|
||||||
|
spi_trace_pos_label->setText("Vertical position");
|
||||||
|
|
||||||
|
spi_trace_pos_spinbox = new QSpinBox(tab_spi);
|
||||||
|
spi_trace_pos_spinbox->setGeometry(370, 370, 100, 25);
|
||||||
|
spi_trace_pos_spinbox->setRange(50, 350);
|
||||||
|
spi_trace_pos_spinbox->setValue(devparms->math_decode_pos);
|
||||||
|
|
||||||
|
spi_threshold_auto_clicked(devparms->math_decode_threshold_auto);
|
||||||
|
|
||||||
|
toggle_decode_button = new QPushButton(this);
|
||||||
|
toggle_decode_button->setGeometry(20, 475, 100, 25);
|
||||||
|
if(devparms->math_decode_display == 1)
|
||||||
|
{
|
||||||
|
toggle_decode_button->setText("Stop Decoding");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
toggle_decode_button->setText("Start Decoding");
|
||||||
|
}
|
||||||
|
|
||||||
|
close_button = new QPushButton(this);
|
||||||
|
close_button->setGeometry(570, 475, 100, 25);
|
||||||
|
close_button->setText("Close");
|
||||||
|
|
||||||
|
tabholder->addTab(tab_par, "Parallel");
|
||||||
|
tabholder->addTab(tab_uart, "UART");
|
||||||
|
tabholder->addTab(tab_spi, "SPI");
|
||||||
|
tabholder->addTab(tab_iic, "I2C");
|
||||||
|
|
||||||
|
tabholder->setCurrentIndex(devparms->math_decode_mode);
|
||||||
|
|
||||||
|
connect(spi_threshold_auto_combobox, SIGNAL(currentIndexChanged(int)), this, SLOT(spi_threshold_auto_clicked(int)));
|
||||||
|
|
||||||
|
connect(spi_clk_src_combobox, SIGNAL(currentIndexChanged(int)), this, SLOT(spi_src_combobox_clicked(int)));
|
||||||
|
connect(spi_mosi_src_combobox, SIGNAL(currentIndexChanged(int)), this, SLOT(spi_src_combobox_clicked(int)));
|
||||||
|
connect(spi_miso_src_combobox, SIGNAL(currentIndexChanged(int)), this, SLOT(spi_src_combobox_clicked(int)));
|
||||||
|
connect(spi_cs_src_combobox, SIGNAL(currentIndexChanged(int)), this, SLOT(spi_src_combobox_clicked(int)));
|
||||||
|
|
||||||
|
connect(spi_mosi_threshold_dspinbox, SIGNAL(editingFinished()), this, SLOT(spi_mosi_threshold_dspinbox_changed()));
|
||||||
|
connect(spi_miso_threshold_dspinbox, SIGNAL(editingFinished()), this, SLOT(spi_miso_threshold_dspinbox_changed()));
|
||||||
|
connect(spi_clk_threshold_dspinbox, SIGNAL(editingFinished()), this, SLOT(spi_clk_threshold_dspinbox_changed()));
|
||||||
|
connect(spi_cs_threshold_dspinbox, SIGNAL(editingFinished()), this, SLOT(spi_cs_threshold_dspinbox_changed()));
|
||||||
|
|
||||||
|
connect(spi_width_spinbox, SIGNAL(editingFinished()), this, SLOT(spi_width_spinbox_changed()));
|
||||||
|
|
||||||
|
connect(tabholder, SIGNAL(currentChanged(int)), this, SLOT(tabholder_index_changed(int)));
|
||||||
|
|
||||||
|
connect(spi_select_combobox, SIGNAL(currentIndexChanged(int)), this, SLOT(spi_select_combobox_clicked(int)));
|
||||||
|
connect(spi_mode_combobox, SIGNAL(currentIndexChanged(int)), this, SLOT(spi_mode_combobox_clicked(int)));
|
||||||
|
connect(spi_polarity_combobox, SIGNAL(currentIndexChanged(int)), this, SLOT(spi_polarity_combobox_clicked(int)));
|
||||||
|
connect(spi_edge_combobox, SIGNAL(currentIndexChanged(int)), this, SLOT(spi_edge_combobox_clicked(int)));
|
||||||
|
connect(spi_endian_combobox, SIGNAL(currentIndexChanged(int)), this, SLOT(spi_endian_combobox_clicked(int)));
|
||||||
|
|
||||||
|
connect(close_button, SIGNAL(clicked()), this, SLOT(accept()));
|
||||||
|
connect(toggle_decode_button, SIGNAL(clicked()), this, SLOT(toggle_decode()));
|
||||||
|
|
||||||
|
exec();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void UI_decoder_window::spi_width_spinbox_changed()
|
||||||
|
{
|
||||||
|
char str[256];
|
||||||
|
|
||||||
|
devparms->math_decode_spi_width = spi_width_spinbox->value();
|
||||||
|
|
||||||
|
if(devparms->modelserie == 6)
|
||||||
|
{
|
||||||
|
sprintf(str, ":BUS1:SPI:DBIT %i", devparms->math_decode_spi_width);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sprintf(str, ":DEC1:SPI:WIDT %i", devparms->math_decode_spi_width);
|
||||||
|
}
|
||||||
|
|
||||||
|
mainwindow->set_cue_cmd(str);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void UI_decoder_window::spi_select_combobox_clicked(int idx)
|
||||||
|
{
|
||||||
|
devparms->math_decode_spi_select = idx;
|
||||||
|
|
||||||
|
if(devparms->modelserie == 6)
|
||||||
|
{
|
||||||
|
if(idx == 0)
|
||||||
|
{
|
||||||
|
mainwindow->set_cue_cmd(":BUS1:SPI:SS:POL NCS");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mainwindow->set_cue_cmd(":BUS1:SPI:SS:POL CS");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(idx == 0)
|
||||||
|
{
|
||||||
|
mainwindow->set_cue_cmd(":DEC1:SPI:SEL NEG");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mainwindow->set_cue_cmd(":DEC1:SPI:SEL POS");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void UI_decoder_window::spi_mode_combobox_clicked(int idx)
|
||||||
|
{
|
||||||
|
devparms->math_decode_spi_mode = idx;
|
||||||
|
|
||||||
|
if(devparms->modelserie != 6)
|
||||||
|
{
|
||||||
|
if(idx == 0)
|
||||||
|
{
|
||||||
|
mainwindow->set_cue_cmd(":DEC1:SPI:MODE TIM");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mainwindow->set_cue_cmd(":DEC1:SPI:MODE CS");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void UI_decoder_window::spi_polarity_combobox_clicked(int idx)
|
||||||
|
{
|
||||||
|
devparms->math_decode_spi_pol = idx;
|
||||||
|
|
||||||
|
if(devparms->modelserie == 6)
|
||||||
|
{
|
||||||
|
if(idx == 0)
|
||||||
|
{
|
||||||
|
mainwindow->set_cue_cmd(":BUS1:SPI:MISO:POL NEG");
|
||||||
|
mainwindow->set_cue_cmd(":BUS1:SPI:MOSI:POL NEG");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mainwindow->set_cue_cmd(":BUS1:SPI:MISO:POL POS");
|
||||||
|
mainwindow->set_cue_cmd(":BUS1:SPI:MOSI:POL POS");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(idx == 0)
|
||||||
|
{
|
||||||
|
mainwindow->set_cue_cmd(":DEC1:SPI:EDGE NEG");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mainwindow->set_cue_cmd(":DEC1:SPI:EDGE POS");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void UI_decoder_window::spi_edge_combobox_clicked(int idx)
|
||||||
|
{
|
||||||
|
devparms->math_decode_spi_edge = idx;
|
||||||
|
|
||||||
|
if(devparms->modelserie == 6)
|
||||||
|
{
|
||||||
|
if(idx == 0)
|
||||||
|
{
|
||||||
|
mainwindow->set_cue_cmd(":BUS1:SPI:SCLK:SLOP NEG");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mainwindow->set_cue_cmd(":BUS1:SPI:SCLK:SLOP POS");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(idx == 0)
|
||||||
|
{
|
||||||
|
mainwindow->set_cue_cmd(":DEC1:SPI:EDGE NEG");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mainwindow->set_cue_cmd(":DEC1:SPI:EDGE POS");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void UI_decoder_window::spi_endian_combobox_clicked(int idx)
|
||||||
|
{
|
||||||
|
devparms->math_decode_spi_end = idx;
|
||||||
|
|
||||||
|
if(devparms->modelserie == 6)
|
||||||
|
{
|
||||||
|
if(idx == 0)
|
||||||
|
{
|
||||||
|
mainwindow->set_cue_cmd(":BUS1:SPI:END LSB");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mainwindow->set_cue_cmd(":BUS1:SPI:END MSB");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(idx == 0)
|
||||||
|
{
|
||||||
|
mainwindow->set_cue_cmd(":DEC1:SPI:END LSB");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mainwindow->set_cue_cmd(":DEC1:SPI:END MSB");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void UI_decoder_window::tabholder_index_changed(int idx)
|
||||||
|
{
|
||||||
|
devparms->math_decode_mode = idx;
|
||||||
|
|
||||||
|
if(devparms->modelserie == 6)
|
||||||
|
{
|
||||||
|
if(idx == 0)
|
||||||
|
{
|
||||||
|
mainwindow->set_cue_cmd(":BUS1:MODE PAR");
|
||||||
|
}
|
||||||
|
else if(idx == 1)
|
||||||
|
{
|
||||||
|
mainwindow->set_cue_cmd(":BUS1:MODE RS232");
|
||||||
|
}
|
||||||
|
else if(idx == 2)
|
||||||
|
{
|
||||||
|
mainwindow->set_cue_cmd(":BUS1:MODE SPI");
|
||||||
|
}
|
||||||
|
else if(idx == 3)
|
||||||
|
{
|
||||||
|
mainwindow->set_cue_cmd(":BUS1:MODE IIC");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(idx == 0)
|
||||||
|
{
|
||||||
|
mainwindow->set_cue_cmd(":DEC1:MODE PAR");
|
||||||
|
}
|
||||||
|
else if(idx == 1)
|
||||||
|
{
|
||||||
|
mainwindow->set_cue_cmd(":DEC1:MODE UART");
|
||||||
|
}
|
||||||
|
else if(idx == 2)
|
||||||
|
{
|
||||||
|
mainwindow->set_cue_cmd(":DEC1:MODE SPI");
|
||||||
|
}
|
||||||
|
else if(idx == 3)
|
||||||
|
{
|
||||||
|
mainwindow->set_cue_cmd(":DEC1:MODE IIC");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void UI_decoder_window::spi_miso_threshold_dspinbox_changed()
|
||||||
|
{
|
||||||
|
char str[256];
|
||||||
|
|
||||||
|
if(devparms->modelserie == 6)
|
||||||
|
{
|
||||||
|
devparms->math_decode_threshold[0] = spi_miso_threshold_dspinbox->value();
|
||||||
|
|
||||||
|
sprintf(str, ":BUS1:SPI:MISO:THR %e", devparms->math_decode_threshold[0]);
|
||||||
|
|
||||||
|
mainwindow->set_cue_cmd(str);
|
||||||
|
}
|
||||||
|
else if(spi_miso_src_combobox->currentIndex() > 0)
|
||||||
|
{
|
||||||
|
devparms->math_decode_threshold[spi_miso_src_combobox->currentIndex() - 1] = spi_miso_threshold_dspinbox->value();
|
||||||
|
|
||||||
|
sprintf(str, ":DEC1:THRE:CHAN%i %e", spi_miso_src_combobox->currentIndex(),
|
||||||
|
devparms->math_decode_threshold[spi_miso_src_combobox->currentIndex() - 1]);
|
||||||
|
|
||||||
|
mainwindow->set_cue_cmd(str);
|
||||||
|
}
|
||||||
|
|
||||||
|
spi_threshold_auto_clicked(devparms->math_decode_threshold_auto);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void UI_decoder_window::spi_mosi_threshold_dspinbox_changed()
|
||||||
|
{
|
||||||
|
char str[256];
|
||||||
|
|
||||||
|
if(devparms->modelserie == 6)
|
||||||
|
{
|
||||||
|
devparms->math_decode_threshold[1] = spi_mosi_threshold_dspinbox->value();
|
||||||
|
|
||||||
|
sprintf(str, ":BUS1:SPI:MOSI:THR %e", devparms->math_decode_threshold[1]);
|
||||||
|
|
||||||
|
mainwindow->set_cue_cmd(str);
|
||||||
|
}
|
||||||
|
else if(spi_mosi_src_combobox->currentIndex() > 0)
|
||||||
|
{
|
||||||
|
devparms->math_decode_threshold[spi_mosi_src_combobox->currentIndex() - 1] = spi_mosi_threshold_dspinbox->value();
|
||||||
|
|
||||||
|
sprintf(str, ":DEC1:THRE:CHAN%i %e", spi_mosi_src_combobox->currentIndex(),
|
||||||
|
devparms->math_decode_threshold[spi_mosi_src_combobox->currentIndex() - 1]);
|
||||||
|
|
||||||
|
mainwindow->set_cue_cmd(str);
|
||||||
|
}
|
||||||
|
|
||||||
|
spi_threshold_auto_clicked(devparms->math_decode_threshold_auto);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void UI_decoder_window::spi_clk_threshold_dspinbox_changed()
|
||||||
|
{
|
||||||
|
char str[256];
|
||||||
|
|
||||||
|
if(devparms->modelserie == 6)
|
||||||
|
{
|
||||||
|
devparms->math_decode_threshold[2] = spi_clk_threshold_dspinbox->value();
|
||||||
|
|
||||||
|
sprintf(str, ":BUS1:SPI:SCLK:THR %e", devparms->math_decode_threshold[2]);
|
||||||
|
|
||||||
|
mainwindow->set_cue_cmd(str);
|
||||||
|
}
|
||||||
|
else if(spi_clk_src_combobox->currentIndex() > 0)
|
||||||
|
{
|
||||||
|
devparms->math_decode_threshold[spi_clk_src_combobox->currentIndex() - 1] = spi_clk_threshold_dspinbox->value();
|
||||||
|
|
||||||
|
sprintf(str, ":DEC1:THRE:CHAN%i %e", spi_clk_src_combobox->currentIndex(),
|
||||||
|
devparms->math_decode_threshold[spi_clk_src_combobox->currentIndex() - 1]);
|
||||||
|
|
||||||
|
mainwindow->set_cue_cmd(str);
|
||||||
|
}
|
||||||
|
|
||||||
|
spi_threshold_auto_clicked(devparms->math_decode_threshold_auto);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void UI_decoder_window::spi_cs_threshold_dspinbox_changed()
|
||||||
|
{
|
||||||
|
char str[256];
|
||||||
|
|
||||||
|
if(devparms->modelserie == 6)
|
||||||
|
{
|
||||||
|
devparms->math_decode_threshold[3] = spi_cs_threshold_dspinbox->value();
|
||||||
|
|
||||||
|
sprintf(str, ":BUS1:SPI:SS:THR %e", devparms->math_decode_threshold[3]);
|
||||||
|
|
||||||
|
mainwindow->set_cue_cmd(str);
|
||||||
|
}
|
||||||
|
else if(spi_cs_src_combobox->currentIndex() > 0)
|
||||||
|
{
|
||||||
|
devparms->math_decode_threshold[spi_cs_src_combobox->currentIndex() - 1] = spi_cs_threshold_dspinbox->value();
|
||||||
|
|
||||||
|
sprintf(str, ":DEC1:THRE:CHAN%i %e", spi_cs_src_combobox->currentIndex(),
|
||||||
|
devparms->math_decode_threshold[spi_cs_src_combobox->currentIndex() - 1]);
|
||||||
|
|
||||||
|
mainwindow->set_cue_cmd(str);
|
||||||
|
}
|
||||||
|
|
||||||
|
spi_threshold_auto_clicked(devparms->math_decode_threshold_auto);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void UI_decoder_window::spi_src_combobox_clicked(int)
|
||||||
|
{
|
||||||
|
spi_threshold_auto_clicked(devparms->math_decode_threshold_auto);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void UI_decoder_window::spi_threshold_auto_clicked(int idx)
|
||||||
|
{
|
||||||
|
char str[256];
|
||||||
|
|
||||||
|
devparms->math_decode_threshold_auto = idx;
|
||||||
|
|
||||||
|
if(devparms->modelserie != 6)
|
||||||
|
{
|
||||||
|
if(idx == 0)
|
||||||
|
{
|
||||||
|
mainwindow->set_cue_cmd(":DEC1:THRE:AUTO 0");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mainwindow->set_cue_cmd(":DEC1:THRE:AUTO 1");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if((spi_clk_src_combobox->currentIndex() > 0) && (idx == 0))
|
||||||
|
{
|
||||||
|
spi_clk_threshold_dspinbox->setEnabled(true);
|
||||||
|
|
||||||
|
if(devparms->modelserie == 6)
|
||||||
|
{
|
||||||
|
spi_clk_threshold_dspinbox->setValue(devparms->math_decode_threshold[2]);
|
||||||
|
|
||||||
|
sprintf(str, ":BUS1:SPI:SCLK:THR %e", devparms->math_decode_threshold[2]);
|
||||||
|
|
||||||
|
mainwindow->set_cue_cmd(str);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
spi_clk_threshold_dspinbox->setValue(devparms->math_decode_threshold[spi_clk_src_combobox->currentIndex() - 1]);
|
||||||
|
|
||||||
|
sprintf(str, ":DEC1:SPI:CLK:CHAN%i", spi_clk_src_combobox->currentIndex());
|
||||||
|
|
||||||
|
mainwindow->set_cue_cmd(str);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
spi_clk_threshold_dspinbox->setValue(0.0);
|
||||||
|
|
||||||
|
spi_clk_threshold_dspinbox->setEnabled(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
if((spi_mosi_src_combobox->currentIndex() > 0) && (idx == 0))
|
||||||
|
{
|
||||||
|
spi_mosi_threshold_dspinbox->setEnabled(true);
|
||||||
|
|
||||||
|
if(devparms->modelserie == 6)
|
||||||
|
{
|
||||||
|
spi_mosi_threshold_dspinbox->setValue(devparms->math_decode_threshold[1]);
|
||||||
|
|
||||||
|
sprintf(str, ":BUS1:SPI:MOSI:THR %e", devparms->math_decode_threshold[1]);
|
||||||
|
|
||||||
|
mainwindow->set_cue_cmd(str);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
spi_mosi_threshold_dspinbox->setValue(devparms->math_decode_threshold[spi_mosi_src_combobox->currentIndex() - 1]);
|
||||||
|
|
||||||
|
sprintf(str, ":DEC1:SPI:MOSI:CHAN%i", spi_mosi_src_combobox->currentIndex());
|
||||||
|
|
||||||
|
mainwindow->set_cue_cmd(str);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
spi_mosi_threshold_dspinbox->setValue(0.0);
|
||||||
|
|
||||||
|
spi_mosi_threshold_dspinbox->setEnabled(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
if((spi_miso_src_combobox->currentIndex() > 0) && (idx == 0))
|
||||||
|
{
|
||||||
|
spi_miso_threshold_dspinbox->setEnabled(true);
|
||||||
|
|
||||||
|
if(devparms->modelserie == 6)
|
||||||
|
{
|
||||||
|
spi_miso_threshold_dspinbox->setValue(devparms->math_decode_threshold[0]);
|
||||||
|
|
||||||
|
sprintf(str, ":BUS1:SPI:MISO:THR %e", devparms->math_decode_threshold[0]);
|
||||||
|
|
||||||
|
mainwindow->set_cue_cmd(str);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
spi_miso_threshold_dspinbox->setValue(devparms->math_decode_threshold[spi_miso_src_combobox->currentIndex() - 1]);
|
||||||
|
|
||||||
|
sprintf(str, ":DEC1:SPI:MISO:CHAN%i", spi_miso_src_combobox->currentIndex());
|
||||||
|
|
||||||
|
mainwindow->set_cue_cmd(str);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
spi_miso_threshold_dspinbox->setValue(0.0);
|
||||||
|
|
||||||
|
spi_miso_threshold_dspinbox->setEnabled(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
if((spi_cs_src_combobox->currentIndex() > 0) && (idx == 0))
|
||||||
|
{
|
||||||
|
spi_cs_threshold_dspinbox->setEnabled(true);
|
||||||
|
|
||||||
|
if(devparms->modelserie == 6)
|
||||||
|
{
|
||||||
|
spi_cs_threshold_dspinbox->setValue(devparms->math_decode_threshold[3]);
|
||||||
|
|
||||||
|
sprintf(str, ":BUS1:SPI:SS:THR %e", devparms->math_decode_threshold[3]);
|
||||||
|
|
||||||
|
mainwindow->set_cue_cmd(str);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
spi_cs_threshold_dspinbox->setValue(devparms->math_decode_threshold[spi_cs_src_combobox->currentIndex() - 1]);
|
||||||
|
|
||||||
|
sprintf(str, ":DEC1:SPI:CS:CHAN%i", spi_cs_src_combobox->currentIndex());
|
||||||
|
|
||||||
|
mainwindow->set_cue_cmd(str);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
spi_cs_threshold_dspinbox->setValue(0.0);
|
||||||
|
|
||||||
|
spi_cs_threshold_dspinbox->setEnabled(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void UI_decoder_window::toggle_decode()
|
||||||
|
{
|
||||||
|
if(devparms->math_decode_display == 1)
|
||||||
|
{
|
||||||
|
devparms->math_decode_display = 0;
|
||||||
|
|
||||||
|
if(devparms->modelserie == 6)
|
||||||
|
{
|
||||||
|
mainwindow->set_cue_cmd(":BUS1:DISP OFF");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mainwindow->set_cue_cmd(":DEC1:DISP OFF");
|
||||||
|
}
|
||||||
|
|
||||||
|
toggle_decode_button->setText("Start Decoding");
|
||||||
|
|
||||||
|
mainwindow->statusLabel->setText("Decode off");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
devparms->math_decode_display = 1;
|
||||||
|
|
||||||
|
if(devparms->modelserie == 6)
|
||||||
|
{
|
||||||
|
mainwindow->set_cue_cmd(":BUS1:DISP ON");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mainwindow->set_cue_cmd(":DEC1:DISP ON");
|
||||||
|
}
|
||||||
|
|
||||||
|
toggle_decode_button->setText("Stop Decoding");
|
||||||
|
|
||||||
|
mainwindow->statusLabel->setText("Decode on");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,144 @@
|
||||||
|
/*
|
||||||
|
***************************************************************************
|
||||||
|
*
|
||||||
|
* Author: Teunis van Beelen
|
||||||
|
*
|
||||||
|
* Copyright (C) 2016 Teunis van Beelen
|
||||||
|
*
|
||||||
|
* Email: teuniz@gmail.com
|
||||||
|
*
|
||||||
|
***************************************************************************
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
***************************************************************************
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef UI_DECODE_DIALOG_H
|
||||||
|
#define UI_DECODE_DIALOG_H
|
||||||
|
|
||||||
|
|
||||||
|
#include <QtGlobal>
|
||||||
|
#include <QApplication>
|
||||||
|
#include <QObject>
|
||||||
|
#include <QWidget>
|
||||||
|
#include <QDialog>
|
||||||
|
#include <QTabWidget>
|
||||||
|
#include <QLabel>
|
||||||
|
#include <QComboBox>
|
||||||
|
#include <QSpinBox>
|
||||||
|
#include <QDoubleSpinBox>
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#include "global.h"
|
||||||
|
#include "mainwindow.h"
|
||||||
|
#include "utils.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class UI_Mainwindow;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class UI_decoder_window : public QDialog
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
UI_decoder_window(QWidget *parent);
|
||||||
|
|
||||||
|
UI_Mainwindow *mainwindow;
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
QWidget *tab_par,
|
||||||
|
*tab_uart,
|
||||||
|
*tab_spi,
|
||||||
|
*tab_iic;
|
||||||
|
|
||||||
|
QTabWidget *tabholder;
|
||||||
|
|
||||||
|
QLabel *spi_clk_src_label,
|
||||||
|
*spi_mosi_src_label,
|
||||||
|
*spi_miso_src_label,
|
||||||
|
*spi_cs_src_label,
|
||||||
|
*spi_select_label,
|
||||||
|
*spi_mode_label,
|
||||||
|
*spi_timeout_label,
|
||||||
|
*spi_polarity_label,
|
||||||
|
*spi_edge_label,
|
||||||
|
*spi_endian_label,
|
||||||
|
*spi_width_label,
|
||||||
|
*spi_clk_threshold_label,
|
||||||
|
*spi_mosi_threshold_label,
|
||||||
|
*spi_miso_threshold_label,
|
||||||
|
*spi_cs_threshold_label,
|
||||||
|
*spi_trace_pos_label;
|
||||||
|
|
||||||
|
QComboBox *spi_clk_src_combobox,
|
||||||
|
*spi_mosi_src_combobox,
|
||||||
|
*spi_miso_src_combobox,
|
||||||
|
*spi_cs_src_combobox,
|
||||||
|
*spi_select_combobox,
|
||||||
|
*spi_mode_combobox,
|
||||||
|
*spi_polarity_combobox,
|
||||||
|
*spi_edge_combobox,
|
||||||
|
*spi_endian_combobox,
|
||||||
|
*spi_threshold_auto_combobox;
|
||||||
|
|
||||||
|
QSpinBox *spi_width_spinbox,
|
||||||
|
*spi_trace_pos_spinbox;
|
||||||
|
|
||||||
|
QDoubleSpinBox *spi_timeout_dspinbox,
|
||||||
|
*spi_clk_threshold_dspinbox,
|
||||||
|
*spi_mosi_threshold_dspinbox,
|
||||||
|
*spi_miso_threshold_dspinbox,
|
||||||
|
*spi_cs_threshold_dspinbox;
|
||||||
|
|
||||||
|
QPushButton *close_button,
|
||||||
|
*toggle_decode_button;
|
||||||
|
|
||||||
|
struct device_settings *devparms;
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
|
||||||
|
void spi_threshold_auto_clicked(int);
|
||||||
|
void spi_src_combobox_clicked(int);
|
||||||
|
void spi_mosi_threshold_dspinbox_changed();
|
||||||
|
void spi_miso_threshold_dspinbox_changed();
|
||||||
|
void spi_cs_threshold_dspinbox_changed();
|
||||||
|
void spi_clk_threshold_dspinbox_changed();
|
||||||
|
void tabholder_index_changed(int);
|
||||||
|
void spi_select_combobox_clicked(int);
|
||||||
|
void spi_mode_combobox_clicked(int);
|
||||||
|
void spi_polarity_combobox_clicked(int);
|
||||||
|
void spi_edge_combobox_clicked(int);
|
||||||
|
void spi_endian_combobox_clicked(int);
|
||||||
|
void spi_width_spinbox_changed();
|
||||||
|
void toggle_decode();
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -56,6 +56,7 @@ HEADERS += screen_thread.h
|
||||||
HEADERS += lan_connect_thread.h
|
HEADERS += lan_connect_thread.h
|
||||||
HEADERS += read_settings_thread.h
|
HEADERS += read_settings_thread.h
|
||||||
HEADERS += save_data_thread.h
|
HEADERS += save_data_thread.h
|
||||||
|
HEADERS += decode_dialog.h
|
||||||
|
|
||||||
HEADERS += third_party/kiss_fft/kiss_fft.h
|
HEADERS += third_party/kiss_fft/kiss_fft.h
|
||||||
HEADERS += third_party/kiss_fft/_kiss_fft_guts.h
|
HEADERS += third_party/kiss_fft/_kiss_fft_guts.h
|
||||||
|
|
@ -80,6 +81,7 @@ SOURCES += screen_thread.cpp
|
||||||
SOURCES += lan_connect_thread.cpp
|
SOURCES += lan_connect_thread.cpp
|
||||||
SOURCES += read_settings_thread.cpp
|
SOURCES += read_settings_thread.cpp
|
||||||
SOURCES += save_data_thread.cpp
|
SOURCES += save_data_thread.cpp
|
||||||
|
SOURCES += decode_dialog.cpp
|
||||||
|
|
||||||
SOURCES += third_party/kiss_fft/kiss_fft.c
|
SOURCES += third_party/kiss_fft/kiss_fft.c
|
||||||
SOURCES += third_party/kiss_fft/kiss_fftr.c
|
SOURCES += third_party/kiss_fft/kiss_fftr.c
|
||||||
|
|
|
||||||
38
global.h
38
global.h
|
|
@ -35,7 +35,7 @@
|
||||||
|
|
||||||
|
|
||||||
#define PROGRAM_NAME "DSRemote"
|
#define PROGRAM_NAME "DSRemote"
|
||||||
#define PROGRAM_VERSION "0.32_1610311104"
|
#define PROGRAM_VERSION "0.33_1611051503"
|
||||||
|
|
||||||
#define MAX_PATHLEN 4096
|
#define MAX_PATHLEN 4096
|
||||||
|
|
||||||
|
|
@ -165,6 +165,42 @@ struct device_settings
|
||||||
int countersrc; // 0=off, 1=ch1, 2=ch2, 3=ch3, 4=ch4
|
int countersrc; // 0=off, 1=ch1, 2=ch2, 3=ch3, 4=ch4
|
||||||
double counterfreq; // Value of frequency counter
|
double counterfreq; // Value of frequency counter
|
||||||
|
|
||||||
|
int math_decode_display; // 0=off, 1=on
|
||||||
|
int math_decode_mode; // 0=par, 1=uart, 2=spi, 3=iic
|
||||||
|
int math_decode_format; // 0=hex, 1=ascii, 2=dec, 3=bin, 4=line
|
||||||
|
int math_decode_pos; // vertical position of the decode trace,
|
||||||
|
// the screen is divided into 400 parts vertically which
|
||||||
|
// are marked as 0 to 400 from top to bottom respectively
|
||||||
|
// the range of <pos> is from 50 to 350
|
||||||
|
double math_decode_threshold[MAX_CHNS]; // threshold of decode channel 1 (SPI:MISO for modelserie 6)
|
||||||
|
// threshold of decode channel 2 (SPI:MOSI for modelserie 6)
|
||||||
|
// threshold of decode channel 3 (SPI:SCLK for modelserie 6)
|
||||||
|
// threshold of decode channel 4 (SPI:SS for modelserie 6)
|
||||||
|
// (-4 x VerticalScale - VerticalOffset) to
|
||||||
|
// (4 x VerticalScale - VerticalOffset)
|
||||||
|
int math_decode_threshold_auto; // 0=off, 1=on
|
||||||
|
|
||||||
|
int math_decode_spi_clk; // channel (0=off)
|
||||||
|
int math_decode_spi_miso; // channel (0=off)
|
||||||
|
int math_decode_spi_mosi; // channel (0=off)
|
||||||
|
int math_decode_spi_cs; // channel (0=off)
|
||||||
|
int math_decode_spi_select; // select cs level, 0=low, 1=high
|
||||||
|
int math_decode_spi_mode; // frame mode, 0=timeout, 1=cs (chip select)
|
||||||
|
double math_decode_spi_timeout; // timeout
|
||||||
|
int math_decode_spi_pol; // polarity of serial data line, 0=negative, 1=positive
|
||||||
|
int math_decode_spi_edge; // edge, 0=falling edge of clock, 1=rising edge of clock
|
||||||
|
int math_decode_spi_end; // endian, 0=lsb, 1=msb
|
||||||
|
int math_decode_spi_width; // databits, 8-32
|
||||||
|
|
||||||
|
int math_decode_uart_tx; // channel (0=off)
|
||||||
|
int math_decode_uart_rx; // channel (0=off)
|
||||||
|
int math_decode_uart_pol; // polarity, 0=negative, 1=positive
|
||||||
|
int math_decode_uart_end; // endian, 0=lsb, 1=msb
|
||||||
|
int math_decode_uart_baud; // baudrate
|
||||||
|
int math_decode_uart_width; // databits, 5-8
|
||||||
|
int math_decode_uart_stop; // stopbits, 0=1, 1=1.5, 2=2
|
||||||
|
int math_decode_uart_par; // parity, 0=none, 1=odd, 2=even
|
||||||
|
|
||||||
char *screenshot_buf;
|
char *screenshot_buf;
|
||||||
short *wavebuf[MAX_CHNS];
|
short *wavebuf[MAX_CHNS];
|
||||||
int wavebufsz;
|
int wavebufsz;
|
||||||
|
|
|
||||||
|
|
@ -2435,6 +2435,8 @@ void UI_Mainwindow::math_menu()
|
||||||
|
|
||||||
menu.addMenu(&submenufft);
|
menu.addMenu(&submenufft);
|
||||||
|
|
||||||
|
menu.addAction("Decode", this, SLOT(show_decode_window()));
|
||||||
|
|
||||||
menu.exec(mathMenuButton->mapToGlobal(QPoint(0,0)));
|
menu.exec(mathMenuButton->mapToGlobal(QPoint(0,0)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -3985,6 +3987,14 @@ void UI_Mainwindow::set_fft_voffset()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void UI_Mainwindow::show_decode_window()
|
||||||
|
{
|
||||||
|
UI_decoder_window w(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -88,6 +88,7 @@
|
||||||
#include "lan_connect_thread.h"
|
#include "lan_connect_thread.h"
|
||||||
#include "read_settings_thread.h"
|
#include "read_settings_thread.h"
|
||||||
#include "save_data_thread.h"
|
#include "save_data_thread.h"
|
||||||
|
#include "decode_dialog.h"
|
||||||
|
|
||||||
#include "third_party/kiss_fft/kiss_fftr.h"
|
#include "third_party/kiss_fft/kiss_fftr.h"
|
||||||
|
|
||||||
|
|
@ -437,6 +438,8 @@ private slots:
|
||||||
void select_fft_voffsetm4();
|
void select_fft_voffsetm4();
|
||||||
void set_fft_voffset();
|
void set_fft_voffset();
|
||||||
|
|
||||||
|
void show_decode_window();
|
||||||
|
|
||||||
void updateLabels();
|
void updateLabels();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
|
||||||
|
|
@ -574,6 +574,9 @@ UI_Mainwindow::UI_Mainwindow()
|
||||||
|
|
||||||
|
|
||||||
show();
|
show();
|
||||||
|
|
||||||
|
// UI_decoder_window wi(this);
|
||||||
|
// wi.exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1510,6 +1510,960 @@ void read_settings_thread::run()
|
||||||
devparms->fft_vscale = atof(device->buf);
|
devparms->fft_vscale = atof(device->buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
usleep(TMC_GDS_DELAY);
|
||||||
|
|
||||||
|
if(devparms->modelserie == 6)
|
||||||
|
{
|
||||||
|
if(tmc_write(":BUS1:MODE?") != 11)
|
||||||
|
{
|
||||||
|
line = __LINE__;
|
||||||
|
goto GDS_OUT_ERROR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(tmc_write(":DEC1:MODE?") != 11)
|
||||||
|
{
|
||||||
|
line = __LINE__;
|
||||||
|
goto GDS_OUT_ERROR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(tmc_read() < 1)
|
||||||
|
{
|
||||||
|
line = __LINE__;
|
||||||
|
goto GDS_OUT_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!strcmp(device->buf, "PAR"))
|
||||||
|
{
|
||||||
|
devparms->math_decode_mode = 0;
|
||||||
|
}
|
||||||
|
else if(!strcmp(device->buf, "UART"))
|
||||||
|
{
|
||||||
|
devparms->math_decode_mode = 1;
|
||||||
|
}
|
||||||
|
else if(!strcmp(device->buf, "RS232"))
|
||||||
|
{
|
||||||
|
devparms->math_decode_mode = 1;
|
||||||
|
}
|
||||||
|
else if(!strcmp(device->buf, "SPI"))
|
||||||
|
{
|
||||||
|
devparms->math_decode_mode = 2;
|
||||||
|
}
|
||||||
|
else if(!strcmp(device->buf, "IIC"))
|
||||||
|
{
|
||||||
|
devparms->math_decode_mode = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
usleep(TMC_GDS_DELAY);
|
||||||
|
|
||||||
|
if(devparms->modelserie == 6)
|
||||||
|
{
|
||||||
|
if(tmc_write(":BUS1:DISP?") != 11)
|
||||||
|
{
|
||||||
|
line = __LINE__;
|
||||||
|
goto GDS_OUT_ERROR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(tmc_write(":DEC1:DISP?") != 11)
|
||||||
|
{
|
||||||
|
line = __LINE__;
|
||||||
|
goto GDS_OUT_ERROR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(tmc_read() < 1)
|
||||||
|
{
|
||||||
|
line = __LINE__;
|
||||||
|
goto GDS_OUT_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
devparms->math_decode_display = atoi(device->buf);
|
||||||
|
|
||||||
|
usleep(TMC_GDS_DELAY);
|
||||||
|
|
||||||
|
if(devparms->modelserie == 6)
|
||||||
|
{
|
||||||
|
if(tmc_write(":BUS1:FORM?") != 11)
|
||||||
|
{
|
||||||
|
line = __LINE__;
|
||||||
|
goto GDS_OUT_ERROR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(tmc_write(":DEC1:FORM?") != 11)
|
||||||
|
{
|
||||||
|
line = __LINE__;
|
||||||
|
goto GDS_OUT_ERROR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(tmc_read() < 1)
|
||||||
|
{
|
||||||
|
line = __LINE__;
|
||||||
|
goto GDS_OUT_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!strcmp(device->buf, "HEX"))
|
||||||
|
{
|
||||||
|
devparms->math_decode_format = 0;
|
||||||
|
}
|
||||||
|
else if(!strcmp(device->buf, "ASC"))
|
||||||
|
{
|
||||||
|
devparms->math_decode_format = 1;
|
||||||
|
}
|
||||||
|
else if(!strcmp(device->buf, "DEC"))
|
||||||
|
{
|
||||||
|
devparms->math_decode_format = 2;
|
||||||
|
}
|
||||||
|
else if(!strcmp(device->buf, "BIN"))
|
||||||
|
{
|
||||||
|
devparms->math_decode_format = 3;
|
||||||
|
}
|
||||||
|
else if(!strcmp(device->buf, "LINE"))
|
||||||
|
{
|
||||||
|
devparms->math_decode_format = 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
usleep(TMC_GDS_DELAY);
|
||||||
|
|
||||||
|
if(devparms->modelserie == 6)
|
||||||
|
{
|
||||||
|
if(tmc_write(":BUS1:IIC:OFFS?") != 15)
|
||||||
|
{
|
||||||
|
line = __LINE__;
|
||||||
|
goto GDS_OUT_ERROR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(tmc_write(":DEC1:POS?") != 10)
|
||||||
|
{
|
||||||
|
line = __LINE__;
|
||||||
|
goto GDS_OUT_ERROR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(tmc_read() < 1)
|
||||||
|
{
|
||||||
|
line = __LINE__;
|
||||||
|
goto GDS_OUT_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
devparms->math_decode_pos = atoi(device->buf);
|
||||||
|
|
||||||
|
usleep(TMC_GDS_DELAY);
|
||||||
|
|
||||||
|
if(devparms->modelserie == 6)
|
||||||
|
{
|
||||||
|
if(tmc_write(":BUS1:SPI:MISO:THR?") != 19)
|
||||||
|
{
|
||||||
|
line = __LINE__;
|
||||||
|
goto GDS_OUT_ERROR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(tmc_write(":DEC1:THRE:CHAN1?") != 17)
|
||||||
|
{
|
||||||
|
line = __LINE__;
|
||||||
|
goto GDS_OUT_ERROR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(tmc_read() < 1)
|
||||||
|
{
|
||||||
|
line = __LINE__;
|
||||||
|
goto GDS_OUT_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
devparms->math_decode_threshold[0] = atof(device->buf);
|
||||||
|
|
||||||
|
usleep(TMC_GDS_DELAY);
|
||||||
|
|
||||||
|
if(devparms->modelserie == 6)
|
||||||
|
{
|
||||||
|
if(tmc_write(":BUS1:SPI:MOSI:THR?") != 19)
|
||||||
|
{
|
||||||
|
line = __LINE__;
|
||||||
|
goto GDS_OUT_ERROR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(tmc_write(":DEC1:THRE:CHAN2?") != 17)
|
||||||
|
{
|
||||||
|
line = __LINE__;
|
||||||
|
goto GDS_OUT_ERROR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(tmc_read() < 1)
|
||||||
|
{
|
||||||
|
line = __LINE__;
|
||||||
|
goto GDS_OUT_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
devparms->math_decode_threshold[1] = atof(device->buf);
|
||||||
|
|
||||||
|
usleep(TMC_GDS_DELAY);
|
||||||
|
|
||||||
|
if(devparms->modelserie == 6)
|
||||||
|
{
|
||||||
|
if(tmc_write(":BUS1:SPI:SCLK:THR?") != 19)
|
||||||
|
{
|
||||||
|
line = __LINE__;
|
||||||
|
goto GDS_OUT_ERROR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(tmc_write(":DEC1:THRE:CHAN3?") != 17)
|
||||||
|
{
|
||||||
|
line = __LINE__;
|
||||||
|
goto GDS_OUT_ERROR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(tmc_read() < 1)
|
||||||
|
{
|
||||||
|
line = __LINE__;
|
||||||
|
goto GDS_OUT_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
devparms->math_decode_threshold[2] = atof(device->buf);
|
||||||
|
|
||||||
|
usleep(TMC_GDS_DELAY);
|
||||||
|
|
||||||
|
if(devparms->modelserie == 6)
|
||||||
|
{
|
||||||
|
if(tmc_write(":BUS1:SPI:SS:THR?") != 17)
|
||||||
|
{
|
||||||
|
line = __LINE__;
|
||||||
|
goto GDS_OUT_ERROR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(tmc_write(":DEC1:THRE:CHAN4?") != 17)
|
||||||
|
{
|
||||||
|
line = __LINE__;
|
||||||
|
goto GDS_OUT_ERROR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(tmc_read() < 1)
|
||||||
|
{
|
||||||
|
line = __LINE__;
|
||||||
|
goto GDS_OUT_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
devparms->math_decode_threshold[3] = atof(device->buf);
|
||||||
|
|
||||||
|
if(devparms->modelserie != 6)
|
||||||
|
{
|
||||||
|
usleep(TMC_GDS_DELAY);
|
||||||
|
|
||||||
|
if(tmc_write(":DEC1:THRE:AUTO?") != 16)
|
||||||
|
{
|
||||||
|
line = __LINE__;
|
||||||
|
goto GDS_OUT_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(tmc_read() < 1)
|
||||||
|
{
|
||||||
|
line = __LINE__;
|
||||||
|
goto GDS_OUT_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
devparms->math_decode_threshold_auto = atoi(device->buf);
|
||||||
|
}
|
||||||
|
|
||||||
|
usleep(TMC_GDS_DELAY);
|
||||||
|
|
||||||
|
if(devparms->modelserie == 6)
|
||||||
|
{
|
||||||
|
if(tmc_write(":BUS1:RS232:RX?") != 15)
|
||||||
|
{
|
||||||
|
line = __LINE__;
|
||||||
|
goto GDS_OUT_ERROR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(tmc_write(":DEC1:UART:RX?") != 14)
|
||||||
|
{
|
||||||
|
line = __LINE__;
|
||||||
|
goto GDS_OUT_ERROR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(tmc_read() < 1)
|
||||||
|
{
|
||||||
|
line = __LINE__;
|
||||||
|
goto GDS_OUT_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!strcmp(device->buf, "CHAN1"))
|
||||||
|
{
|
||||||
|
devparms->math_decode_uart_rx = 1;
|
||||||
|
}
|
||||||
|
else if(!strcmp(device->buf, "CHAN2"))
|
||||||
|
{
|
||||||
|
devparms->math_decode_uart_rx = 2;
|
||||||
|
}
|
||||||
|
else if(!strcmp(device->buf, "CHAN3"))
|
||||||
|
{
|
||||||
|
devparms->math_decode_uart_rx = 3;
|
||||||
|
}
|
||||||
|
else if(!strcmp(device->buf, "CHAN4"))
|
||||||
|
{
|
||||||
|
devparms->math_decode_uart_rx = 4;
|
||||||
|
}
|
||||||
|
else if(!strcmp(device->buf, "OFF"))
|
||||||
|
{
|
||||||
|
devparms->math_decode_uart_rx = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
devparms->math_decode_uart_rx = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
usleep(TMC_GDS_DELAY);
|
||||||
|
|
||||||
|
if(devparms->modelserie == 6)
|
||||||
|
{
|
||||||
|
if(tmc_write(":BUS1:RS232:TX?") != 15)
|
||||||
|
{
|
||||||
|
line = __LINE__;
|
||||||
|
goto GDS_OUT_ERROR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(tmc_write(":DEC1:UART:TX?") != 14)
|
||||||
|
{
|
||||||
|
line = __LINE__;
|
||||||
|
goto GDS_OUT_ERROR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(tmc_read() < 1)
|
||||||
|
{
|
||||||
|
line = __LINE__;
|
||||||
|
goto GDS_OUT_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!strcmp(device->buf, "CHAN1"))
|
||||||
|
{
|
||||||
|
devparms->math_decode_uart_tx = 1;
|
||||||
|
}
|
||||||
|
else if(!strcmp(device->buf, "CHAN2"))
|
||||||
|
{
|
||||||
|
devparms->math_decode_uart_tx = 2;
|
||||||
|
}
|
||||||
|
else if(!strcmp(device->buf, "CHAN3"))
|
||||||
|
{
|
||||||
|
devparms->math_decode_uart_tx = 3;
|
||||||
|
}
|
||||||
|
else if(!strcmp(device->buf, "CHAN4"))
|
||||||
|
{
|
||||||
|
devparms->math_decode_uart_tx = 4;
|
||||||
|
}
|
||||||
|
else if(!strcmp(device->buf, "OFF"))
|
||||||
|
{
|
||||||
|
devparms->math_decode_uart_tx = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
devparms->math_decode_uart_tx = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
usleep(TMC_GDS_DELAY);
|
||||||
|
|
||||||
|
if(devparms->modelserie == 6)
|
||||||
|
{
|
||||||
|
if(tmc_write(":BUS1:RS232:POL?") != 16)
|
||||||
|
{
|
||||||
|
line = __LINE__;
|
||||||
|
goto GDS_OUT_ERROR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(tmc_write(":DEC1:UART:POL?") != 15)
|
||||||
|
{
|
||||||
|
line = __LINE__;
|
||||||
|
goto GDS_OUT_ERROR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(tmc_read() < 1)
|
||||||
|
{
|
||||||
|
line = __LINE__;
|
||||||
|
goto GDS_OUT_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!strcmp(device->buf, "POS"))
|
||||||
|
{
|
||||||
|
devparms->math_decode_uart_pol = 1;
|
||||||
|
}
|
||||||
|
else if(!strcmp(device->buf, "NEG"))
|
||||||
|
{
|
||||||
|
devparms->math_decode_uart_pol = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
usleep(TMC_GDS_DELAY);
|
||||||
|
|
||||||
|
if(devparms->modelserie == 6)
|
||||||
|
{
|
||||||
|
if(tmc_write(":BUS1:RS232:END?") != 16)
|
||||||
|
{
|
||||||
|
line = __LINE__;
|
||||||
|
goto GDS_OUT_ERROR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(tmc_write(":DEC1:UART:END?") != 15)
|
||||||
|
{
|
||||||
|
line = __LINE__;
|
||||||
|
goto GDS_OUT_ERROR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(tmc_read() < 1)
|
||||||
|
{
|
||||||
|
line = __LINE__;
|
||||||
|
goto GDS_OUT_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!strcmp(device->buf, "MSB"))
|
||||||
|
{
|
||||||
|
devparms->math_decode_uart_pol = 1;
|
||||||
|
}
|
||||||
|
else if(!strcmp(device->buf, "LSB"))
|
||||||
|
{
|
||||||
|
devparms->math_decode_uart_pol = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
usleep(TMC_GDS_DELAY);
|
||||||
|
|
||||||
|
if(devparms->modelserie == 6)
|
||||||
|
{
|
||||||
|
if(tmc_write(":BUS1:RS232:BAUD?") != 17)
|
||||||
|
{
|
||||||
|
line = __LINE__;
|
||||||
|
goto GDS_OUT_ERROR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(tmc_write(":DEC1:UART:BAUD?") != 16)
|
||||||
|
{
|
||||||
|
line = __LINE__;
|
||||||
|
goto GDS_OUT_ERROR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(tmc_read() < 1)
|
||||||
|
{
|
||||||
|
line = __LINE__;
|
||||||
|
goto GDS_OUT_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
devparms->math_decode_uart_baud = atoi(device->buf);
|
||||||
|
|
||||||
|
usleep(TMC_GDS_DELAY);
|
||||||
|
|
||||||
|
if(devparms->modelserie == 6)
|
||||||
|
{
|
||||||
|
if(tmc_write(":BUS1:RS232:DBIT?") != 17)
|
||||||
|
{
|
||||||
|
line = __LINE__;
|
||||||
|
goto GDS_OUT_ERROR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(tmc_write(":DEC1:UART:WIDT?") != 16)
|
||||||
|
{
|
||||||
|
line = __LINE__;
|
||||||
|
goto GDS_OUT_ERROR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(tmc_read() < 1)
|
||||||
|
{
|
||||||
|
line = __LINE__;
|
||||||
|
goto GDS_OUT_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
devparms->math_decode_uart_width = atoi(device->buf);
|
||||||
|
|
||||||
|
usleep(TMC_GDS_DELAY);
|
||||||
|
|
||||||
|
if(devparms->modelserie == 6)
|
||||||
|
{
|
||||||
|
if(tmc_write(":BUS1:RS232:SBIT?") != 17)
|
||||||
|
{
|
||||||
|
line = __LINE__;
|
||||||
|
goto GDS_OUT_ERROR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(tmc_write(":DEC1:UART:STOP?") != 16)
|
||||||
|
{
|
||||||
|
line = __LINE__;
|
||||||
|
goto GDS_OUT_ERROR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(tmc_read() < 1)
|
||||||
|
{
|
||||||
|
line = __LINE__;
|
||||||
|
goto GDS_OUT_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
devparms->math_decode_uart_stop = atoi(device->buf);
|
||||||
|
|
||||||
|
usleep(TMC_GDS_DELAY);
|
||||||
|
|
||||||
|
if(devparms->modelserie == 6)
|
||||||
|
{
|
||||||
|
if(tmc_write(":BUS1:RS232:PAR?") != 16)
|
||||||
|
{
|
||||||
|
line = __LINE__;
|
||||||
|
goto GDS_OUT_ERROR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(tmc_write(":DEC1:UART:PAR?") != 15)
|
||||||
|
{
|
||||||
|
line = __LINE__;
|
||||||
|
goto GDS_OUT_ERROR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(tmc_read() < 1)
|
||||||
|
{
|
||||||
|
line = __LINE__;
|
||||||
|
goto GDS_OUT_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!strcmp(device->buf, "ODD"))
|
||||||
|
{
|
||||||
|
devparms->math_decode_uart_par = 1;
|
||||||
|
}
|
||||||
|
else if(!strcmp(device->buf, "EVEN"))
|
||||||
|
{
|
||||||
|
devparms->math_decode_uart_par = 2;
|
||||||
|
}
|
||||||
|
else if(!strcmp(device->buf, "NONE"))
|
||||||
|
{
|
||||||
|
devparms->math_decode_uart_par = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
devparms->math_decode_uart_par = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
usleep(TMC_GDS_DELAY);
|
||||||
|
|
||||||
|
if(devparms->modelserie == 6)
|
||||||
|
{
|
||||||
|
if(tmc_write(":BUS1:SPI:SCLK:SOUR?") != 20)
|
||||||
|
{
|
||||||
|
line = __LINE__;
|
||||||
|
goto GDS_OUT_ERROR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(tmc_write(":DEC1:SPI:CLK?") != 14)
|
||||||
|
{
|
||||||
|
line = __LINE__;
|
||||||
|
goto GDS_OUT_ERROR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(tmc_read() < 1)
|
||||||
|
{
|
||||||
|
line = __LINE__;
|
||||||
|
goto GDS_OUT_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!strcmp(device->buf, "CHAN1"))
|
||||||
|
{
|
||||||
|
devparms->math_decode_spi_clk = 1;
|
||||||
|
}
|
||||||
|
else if(!strcmp(device->buf, "CHAN2"))
|
||||||
|
{
|
||||||
|
devparms->math_decode_spi_clk = 2;
|
||||||
|
}
|
||||||
|
else if(!strcmp(device->buf, "CHAN3"))
|
||||||
|
{
|
||||||
|
devparms->math_decode_spi_clk = 3;
|
||||||
|
}
|
||||||
|
else if(!strcmp(device->buf, "CHAN4"))
|
||||||
|
{
|
||||||
|
devparms->math_decode_spi_clk = 4;
|
||||||
|
}
|
||||||
|
else if(!strcmp(device->buf, "OFF"))
|
||||||
|
{
|
||||||
|
devparms->math_decode_spi_clk = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
devparms->math_decode_spi_clk = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
usleep(TMC_GDS_DELAY);
|
||||||
|
|
||||||
|
if(devparms->modelserie == 6)
|
||||||
|
{
|
||||||
|
if(tmc_write(":BUS1:SPI:MISO:SOUR?") != 20)
|
||||||
|
{
|
||||||
|
line = __LINE__;
|
||||||
|
goto GDS_OUT_ERROR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(tmc_write(":DEC1:SPI:MISO?") != 15)
|
||||||
|
{
|
||||||
|
line = __LINE__;
|
||||||
|
goto GDS_OUT_ERROR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(tmc_read() < 1)
|
||||||
|
{
|
||||||
|
line = __LINE__;
|
||||||
|
goto GDS_OUT_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!strcmp(device->buf, "CHAN1"))
|
||||||
|
{
|
||||||
|
devparms->math_decode_spi_miso = 1;
|
||||||
|
}
|
||||||
|
else if(!strcmp(device->buf, "CHAN2"))
|
||||||
|
{
|
||||||
|
devparms->math_decode_spi_miso = 2;
|
||||||
|
}
|
||||||
|
else if(!strcmp(device->buf, "CHAN3"))
|
||||||
|
{
|
||||||
|
devparms->math_decode_spi_miso = 3;
|
||||||
|
}
|
||||||
|
else if(!strcmp(device->buf, "CHAN4"))
|
||||||
|
{
|
||||||
|
devparms->math_decode_spi_miso = 4;
|
||||||
|
}
|
||||||
|
else if(!strcmp(device->buf, "OFF"))
|
||||||
|
{
|
||||||
|
devparms->math_decode_spi_miso = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
devparms->math_decode_spi_miso = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
usleep(TMC_GDS_DELAY);
|
||||||
|
|
||||||
|
if(devparms->modelserie == 6)
|
||||||
|
{
|
||||||
|
if(tmc_write(":BUS1:SPI:MOSI:SOUR?") != 20)
|
||||||
|
{
|
||||||
|
line = __LINE__;
|
||||||
|
goto GDS_OUT_ERROR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(tmc_write(":DEC1:SPI:MOSI?") != 15)
|
||||||
|
{
|
||||||
|
line = __LINE__;
|
||||||
|
goto GDS_OUT_ERROR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(tmc_read() < 1)
|
||||||
|
{
|
||||||
|
line = __LINE__;
|
||||||
|
goto GDS_OUT_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!strcmp(device->buf, "CHAN1"))
|
||||||
|
{
|
||||||
|
devparms->math_decode_spi_mosi = 1;
|
||||||
|
}
|
||||||
|
else if(!strcmp(device->buf, "CHAN2"))
|
||||||
|
{
|
||||||
|
devparms->math_decode_spi_mosi = 2;
|
||||||
|
}
|
||||||
|
else if(!strcmp(device->buf, "CHAN3"))
|
||||||
|
{
|
||||||
|
devparms->math_decode_spi_mosi = 3;
|
||||||
|
}
|
||||||
|
else if(!strcmp(device->buf, "CHAN4"))
|
||||||
|
{
|
||||||
|
devparms->math_decode_spi_mosi = 4;
|
||||||
|
}
|
||||||
|
else if(!strcmp(device->buf, "OFF"))
|
||||||
|
{
|
||||||
|
devparms->math_decode_spi_mosi = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
devparms->math_decode_spi_mosi = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
usleep(TMC_GDS_DELAY);
|
||||||
|
|
||||||
|
if(devparms->modelserie == 6)
|
||||||
|
{
|
||||||
|
if(tmc_write(":BUS1:SPI:SS:SOUR?") != 18)
|
||||||
|
{
|
||||||
|
line = __LINE__;
|
||||||
|
goto GDS_OUT_ERROR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(tmc_write(":DEC1:SPI:CS?") != 13)
|
||||||
|
{
|
||||||
|
line = __LINE__;
|
||||||
|
goto GDS_OUT_ERROR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(tmc_read() < 1)
|
||||||
|
{
|
||||||
|
line = __LINE__;
|
||||||
|
goto GDS_OUT_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!strcmp(device->buf, "CHAN1"))
|
||||||
|
{
|
||||||
|
devparms->math_decode_spi_cs = 1;
|
||||||
|
}
|
||||||
|
else if(!strcmp(device->buf, "CHAN2"))
|
||||||
|
{
|
||||||
|
devparms->math_decode_spi_cs = 2;
|
||||||
|
}
|
||||||
|
else if(!strcmp(device->buf, "CHAN3"))
|
||||||
|
{
|
||||||
|
devparms->math_decode_spi_cs = 3;
|
||||||
|
}
|
||||||
|
else if(!strcmp(device->buf, "CHAN4"))
|
||||||
|
{
|
||||||
|
devparms->math_decode_spi_cs = 4;
|
||||||
|
}
|
||||||
|
else if(!strcmp(device->buf, "OFF"))
|
||||||
|
{
|
||||||
|
devparms->math_decode_spi_cs = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
devparms->math_decode_spi_cs = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
usleep(TMC_GDS_DELAY);
|
||||||
|
|
||||||
|
if(devparms->modelserie == 6)
|
||||||
|
{
|
||||||
|
if(tmc_write(":BUS1:SPI:SS:POL?") != 17)
|
||||||
|
{
|
||||||
|
line = __LINE__;
|
||||||
|
goto GDS_OUT_ERROR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(tmc_write(":DEC1:SPI:SEL?") != 14)
|
||||||
|
{
|
||||||
|
line = __LINE__;
|
||||||
|
goto GDS_OUT_ERROR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(tmc_read() < 1)
|
||||||
|
{
|
||||||
|
line = __LINE__;
|
||||||
|
goto GDS_OUT_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!strcmp(device->buf, "NCS"))
|
||||||
|
{
|
||||||
|
devparms->math_decode_spi_select = 0;
|
||||||
|
}
|
||||||
|
else if(!strcmp(device->buf, "CS"))
|
||||||
|
{
|
||||||
|
devparms->math_decode_spi_select = 1;
|
||||||
|
}
|
||||||
|
else if(!strcmp(device->buf, "NEG"))
|
||||||
|
{
|
||||||
|
devparms->math_decode_spi_select = 0;
|
||||||
|
}
|
||||||
|
else if(!strcmp(device->buf, "POS"))
|
||||||
|
{
|
||||||
|
devparms->math_decode_spi_select = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(devparms->modelserie != 6)
|
||||||
|
{
|
||||||
|
usleep(TMC_GDS_DELAY);
|
||||||
|
|
||||||
|
if(tmc_write(":DEC1:SPI:MODE?") != 15)
|
||||||
|
{
|
||||||
|
line = __LINE__;
|
||||||
|
goto GDS_OUT_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(tmc_read() < 1)
|
||||||
|
{
|
||||||
|
line = __LINE__;
|
||||||
|
goto GDS_OUT_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!strcmp(device->buf, "TIM"))
|
||||||
|
{
|
||||||
|
devparms->math_decode_spi_mode = 0;
|
||||||
|
}
|
||||||
|
else if(!strcmp(device->buf, "CS"))
|
||||||
|
{
|
||||||
|
devparms->math_decode_spi_mode = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(devparms->modelserie != 6)
|
||||||
|
{
|
||||||
|
usleep(TMC_GDS_DELAY);
|
||||||
|
|
||||||
|
if(tmc_write(":DEC1:SPI:TIM?") != 14)
|
||||||
|
{
|
||||||
|
line = __LINE__;
|
||||||
|
goto GDS_OUT_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(tmc_read() < 1)
|
||||||
|
{
|
||||||
|
line = __LINE__;
|
||||||
|
goto GDS_OUT_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
devparms->math_decode_spi_timeout = atof(device->buf);
|
||||||
|
}
|
||||||
|
|
||||||
|
usleep(TMC_GDS_DELAY);
|
||||||
|
|
||||||
|
if(devparms->modelserie == 6)
|
||||||
|
{
|
||||||
|
if(tmc_write(":BUS1:SPI:MOSI:POL?") != 19)
|
||||||
|
{
|
||||||
|
line = __LINE__;
|
||||||
|
goto GDS_OUT_ERROR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(tmc_write(":DEC1:SPI:POL?") != 14)
|
||||||
|
{
|
||||||
|
line = __LINE__;
|
||||||
|
goto GDS_OUT_ERROR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(tmc_read() < 1)
|
||||||
|
{
|
||||||
|
line = __LINE__;
|
||||||
|
goto GDS_OUT_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!strcmp(device->buf, "NEG"))
|
||||||
|
{
|
||||||
|
devparms->math_decode_spi_pol = 0;
|
||||||
|
}
|
||||||
|
else if(!strcmp(device->buf, "POS"))
|
||||||
|
{
|
||||||
|
devparms->math_decode_spi_pol = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
usleep(TMC_GDS_DELAY);
|
||||||
|
|
||||||
|
if(devparms->modelserie == 6)
|
||||||
|
{
|
||||||
|
if(tmc_write(":BUS1:SPI:SCLK:SLOP?") != 20)
|
||||||
|
{
|
||||||
|
line = __LINE__;
|
||||||
|
goto GDS_OUT_ERROR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(tmc_write(":DEC1:SPI:EDGE?") != 15)
|
||||||
|
{
|
||||||
|
line = __LINE__;
|
||||||
|
goto GDS_OUT_ERROR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(tmc_read() < 1)
|
||||||
|
{
|
||||||
|
line = __LINE__;
|
||||||
|
goto GDS_OUT_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!strcmp(device->buf, "NEG"))
|
||||||
|
{
|
||||||
|
devparms->math_decode_spi_edge = 0;
|
||||||
|
}
|
||||||
|
else if(!strcmp(device->buf, "POS"))
|
||||||
|
{
|
||||||
|
devparms->math_decode_spi_edge = 1;
|
||||||
|
}
|
||||||
|
else if(!strcmp(device->buf, "FALL"))
|
||||||
|
{
|
||||||
|
devparms->math_decode_spi_edge = 0;
|
||||||
|
}
|
||||||
|
else if(!strcmp(device->buf, "RISE"))
|
||||||
|
{
|
||||||
|
devparms->math_decode_spi_edge = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
usleep(TMC_GDS_DELAY);
|
||||||
|
|
||||||
|
if(devparms->modelserie == 6)
|
||||||
|
{
|
||||||
|
if(tmc_write(":BUS1:SPI:DBIT?") != 15)
|
||||||
|
{
|
||||||
|
line = __LINE__;
|
||||||
|
goto GDS_OUT_ERROR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(tmc_write(":DEC1:SPI:WIDT?") != 15)
|
||||||
|
{
|
||||||
|
line = __LINE__;
|
||||||
|
goto GDS_OUT_ERROR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(tmc_read() < 1)
|
||||||
|
{
|
||||||
|
line = __LINE__;
|
||||||
|
goto GDS_OUT_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
devparms->math_decode_spi_width = atoi(device->buf);
|
||||||
|
|
||||||
err_num = 0;
|
err_num = 0;
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
Ładowanie…
Reference in New Issue