From 0f54ae93e42417dee5065bd1a3a1a7426f27c2e3 Mon Sep 17 00:00:00 2001 From: Teuniz Date: Tue, 22 Nov 2016 21:06:24 +0100 Subject: [PATCH] Work in progress. --- dsremote.pro | 9 +-- global.h | 7 ++- images.qrc | 2 +- images/{r.png => r_dsremote.png} | Bin install/dsremote.desktop | 2 +- mainwindow.cpp | 6 ++ mainwindow.h | 1 + mainwindow_constr.cpp | 2 +- serial_decoder.cpp | 94 +++++++++++++++++++++++++++++++ 9 files changed, 115 insertions(+), 8 deletions(-) rename images/{r.png => r_dsremote.png} (100%) create mode 100644 serial_decoder.cpp diff --git a/dsremote.pro b/dsremote.pro index 4da3fe1..1cbee44 100644 --- a/dsremote.pro +++ b/dsremote.pro @@ -68,6 +68,7 @@ SOURCES += mainwindow_constr.cpp SOURCES += timer_handlers.cpp SOURCES += save_data.cpp SOURCES += interface.cpp +SOURCES += serial_decoder.cpp SOURCES += about_dialog.cpp SOURCES += utils.c SOURCES += connection.cpp @@ -93,19 +94,19 @@ target.files = dsremote INSTALLS += target icon_a.path = /usr/share/icons -icon_a.files = images/r.png +icon_a.files = images/r_dsremote.png INSTALLS += icon_a icon_b.path += /usr/share/pixmaps -icon_b.files = images/r.png +icon_b.files = images/r_dsremote.png INSTALLS += icon_b icon_c.path += /usr/share/icons/hicolor/48x48/apps -icon_c.files = images/r.png +icon_c.files = images/r_dsremote.png INSTALLS += icon_c icon_d.path += /usr/share/icons/hicolor/48x48/mimetypes -icon_d.files = images/r.png +icon_d.files = images/r_dsremote.png INSTALLS += icon_d desktop_link.path += /usr/share/applications diff --git a/global.h b/global.h index 1da276b..e772394 100644 --- a/global.h +++ b/global.h @@ -35,7 +35,7 @@ #define PROGRAM_NAME "DSRemote" -#define PROGRAM_VERSION "0.33_1611131103" +#define PROGRAM_VERSION "0.33_1611222104" #define MAX_PATHLEN 4096 @@ -87,6 +87,11 @@ #define DECODE_MODE_TAB_SPI 2 #define DECODE_MODE_TAB_I2C 3 +#define DECODE_MODE_PAR 0 +#define DECODE_MODE_UART 1 +#define DECODE_MODE_SPI 2 +#define DECODE_MODE_I2C 3 + diff --git a/images.qrc b/images.qrc index f258d9d..4143a0c 100644 --- a/images.qrc +++ b/images.qrc @@ -1,6 +1,6 @@ - images/r.png + images/r_dsremote.png images/playpause.png images/record.png images/stop.png diff --git a/images/r.png b/images/r_dsremote.png similarity index 100% rename from images/r.png rename to images/r_dsremote.png diff --git a/install/dsremote.desktop b/install/dsremote.desktop index 981f378..042cccb 100644 --- a/install/dsremote.desktop +++ b/install/dsremote.desktop @@ -5,7 +5,7 @@ Type=Application Name=DSRemote GenericName=Oscilloscope Comment=Operate your Rigol oscilloscope from your Linux desktop. -Icon=r +Icon=r_dsremote Exec=dsremote Terminal=false Categories=Science;Application; diff --git a/mainwindow.cpp b/mainwindow.cpp index fdf17e5..d11f818 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -31,6 +31,7 @@ #include "timer_handlers.cpp" #include "save_data.cpp" #include "interface.cpp" +#include "serial_decoder.cpp" @@ -2533,6 +2534,11 @@ void UI_Mainwindow::screenUpdate() } else { + if(devparms.math_decode_display) + { + serial_decoder(); + } + waveForm->update(); } diff --git a/mainwindow.h b/mainwindow.h index a9d25d0..d4a8cf2 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -234,6 +234,7 @@ private: int get_metric_factor(double); void get_device_model(const char *); double get_stepsize_divide_by_1000(double); + void serial_decoder(void); private slots: diff --git a/mainwindow_constr.cpp b/mainwindow_constr.cpp index acabe70..84da692 100644 --- a/mainwindow_constr.cpp +++ b/mainwindow_constr.cpp @@ -38,7 +38,7 @@ UI_Mainwindow::UI_Mainwindow() setMinimumSize(1170, 630); setWindowTitle(PROGRAM_NAME " " PROGRAM_VERSION); - setWindowIcon(QIcon(":/images/r.png")); + setWindowIcon(QIcon(":/images/r_dsremote.png")); appfont = new QFont; diff --git a/serial_decoder.cpp b/serial_decoder.cpp new file mode 100644 index 0000000..e645976 --- /dev/null +++ b/serial_decoder.cpp @@ -0,0 +1,94 @@ +/* +*************************************************************************** +* +* 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 . +* +*************************************************************************** +*/ + + + + +void UI_Mainwindow::serial_decoder(void) +{ +// int i, j, +// threshold[MAX_CHNS]; +// +// short s_max, s_min; +// +// if(devparms.math_decode_threshold_auto) +// { +// for(j=0; j s_max) s_max = devparms.wavebuf[j][i]; +// if(devparms.wavebuf[j][i] < s_min) s_min = devparms.wavebuf[j][i]; +// } +// +// threshold[j] = (s_max + s_min) / 2; +// } +// } +// else +// { +// for(j=0; j