Changeset - d52402a7de11
[Not reviewed]
Merge add-textview
0 11 3
Hasan Yavuz ÖZDERYA - 10 years ago 2015-07-05 20:27:02
hy@ozderya.net
Merge
14 files changed with 170 insertions and 9 deletions:
0 comments (0 inline, 0 general)
.hgtags
Show inline comments
 
cdddeef73834c62a8ba5f3ac4c000cd4cb059e06 v0.1
 
73524cc41d6c6f4a664b39a74ae202be21b58eaf v0.2
 
1332b87e543fd947b57d45ccf62e9a0886e09cb5 v0.3
CMakeLists.txt
Show inline comments
 
@@ -49,14 +49,14 @@ endif (QWT_USE_STATIC)
 
include_directories(${QWT_INCLUDE_DIR})
 

	
 
# wrap UI files
 
qt5_wrap_ui(UI_FILES mainwindow.ui portcontrol.ui about_dialog.ui)
 

	
 
# Tell CMake to create the helloworld executable
 
add_executable(serialplot main.cpp mainwindow.cpp portcontrol.cpp
 
  customcheckablebutton.cpp ${UI_FILES})
 
add_executable(serialplot WIN32 main.cpp mainwindow.cpp portcontrol.cpp
 
  customcheckablebutton.cpp ${UI_FILES} misc/windows_icon.rc)
 

	
 
# Use the Widgets module from Qt 5.
 
target_link_libraries(serialplot ${QWT_LIBRARY})
 
qt5_use_modules(serialplot Widgets SerialPort Svg)
 

	
 
# set compiler flags
 
@@ -73,13 +73,13 @@ elseif(COMPILER_SUPPORTS_CXX0X)
 
else()
 
  message(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.")
 
endif()
 

	
 
# version number
 
set(MAJOR_VERSION 0)
 
set(MINOR_VERSION 2)
 
set(MINOR_VERSION 3)
 
set(PATCH_VERSION 0)
 
set(VERSION_STRING "${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION}")
 

	
 
# get revision number from mercurial
 
find_program(MERCURIAL hg)
 

	
 
@@ -110,16 +110,24 @@ add_custom_target(run
 
    WORKING_DIRECTORY ${CMAKE_PROJECT_DIR}
 
)
 

	
 
# installing
 
install(TARGETS serialplot DESTINATION bin)
 

	
 
# for windows put libraries to install directory
 
if (WIN32)
 
  file(GLOB WINDOWS_INSTALL_LIBRARIES
 
    "${CMAKE_BINARY_DIR}/windows_install_libraries/*.*")
 
  install(FILES ${WINDOWS_INSTALL_LIBRARIES} DESTINATION bin)
 
endif (WIN32)
 

	
 
# install menu item and icon
 
find_program(XDG-DESKTOP-MENU xdg-desktop-menu)
 
find_program(XDG-ICON-RESOURCE xdg-icon-resource)
 

	
 
if (UNIX)
 
# first copy files to share/serialplot/
 
install(FILES
 
  ${CMAKE_SOURCE_DIR}/misc/serialplot.desktop
 
  ${CMAKE_SOURCE_DIR}/misc/serialplot.png
 
  DESTINATION share/serialplot)
 

	
 
@@ -129,43 +137,63 @@ install(FILES
 
  DESTINATION share/doc/serialplot/)
 

	
 
install(CODE "
 
  execute_process(COMMAND ${XDG-DESKTOP-MENU} install --novendor ${CMAKE_INSTALL_PREFIX}/share/serialplot/serialplot.desktop)
 
  execute_process(COMMAND ${XDG-ICON-RESOURCE} install --novendor --size 256 ${CMAKE_INSTALL_PREFIX}/share/serialplot/serialplot.png)
 
")
 
endif (UNIX)
 

	
 
# uninstalling
 
configure_file(
 
  "${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in"
 
  "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
 
  IMMEDIATE @ONLY)
 

	
 
if (UNIX)
 
add_custom_target(uninstall
 
  COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake
 
  COMMAND ${XDG-DESKTOP-MENU} uninstall --novendor serialplot.desktop
 
  COMMAND ${XDG-ICON-RESOURCE} uninstall --novendor --size 256 serialplot)
 
endif (UNIX)
 

	
 
# packaging
 
if (UNIX)
 
set(CPACK_GENERATOR "DEB")
 
elseif (WIN32)
 
  set(CPACK_GENERATOR "NSIS")
 
endif (UNIX)
 

	
 
include(InstallRequiredSystemLibraries)
 

	
 
set(CPACK_PACKAGE_NAME "serialplot")
 
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Small and simple software for plotting data from serial port")
 
set(CPACK_PACKAGE_CONTACT "Hasan Yavuz Özderya <hy@ozderya.net>")
 
set(CPACK_PACKAGE_VERSION_MAJOR ${MAJOR_VERSION})
 
set(CPACK_PACKAGE_VERSION_MINOR ${MINOR_VERSION})
 
set(CPACK_PACKAGE_VERSION_PATCH ${PATCH_VERSION})
 
set(CPACK_STRIP_FILES TRUE)
 
set(CPACK_PACKAGE_EXECUTABLES "serialplot")
 
set(CPACK_DEBIAN_PACKAGE_DEPENDS "libqt5widgets5 (>= 5.2.1), libqt5serialport5 (>= 5.2.1), libc6 (>= 2.19)")
 
if (NOT QWT_USE_STATIC)
 
  set(CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS}, libqwt6-qt5 (>= 6.1.1)")
 
endif (NOT QWT_USE_STATIC)
 
set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${CMAKE_SOURCE_DIR}/debian/postinst" "${CMAKE_SOURCE_DIR}/debian/postrm")
 

	
 
if (UNIX)
 
  set(CPACK_PACKAGE_EXECUTABLES "serialplot")
 
elseif (WIN32)
 
  set(CPACK_PACKAGE_EXECUTABLES "serialplot;SerialPlot")
 
  set(CPACK_CREATE_DESKTOP_LINKS "serialplot")
 
  set(CPACK_NSIS_MODIFY_PATH "ON")
 
  set(CPACK_PACKAGE_ICON "${CMAKE_SOURCE_DIR}/misc/serialplot.bmp")
 
  string(REPLACE "/" "\\\\" CPACK_PACKAGE_ICON ${CPACK_PACKAGE_ICON})
 
  set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/COPYING")
 
  set(CPACK_NSIS_MENU_LINKS
 
    "https://bitbucket.org/hyOzd/serialplot" "SerialPlot source code on bitbucket.org")
 
endif (UNIX)
 

	
 
if (UNIX)
 
# set debian package name
 
string(TOLOWER "${CPACK_PACKAGE_NAME}" CPACK_PACKAGE_NAME_LOWERCASE)
 
find_program(DPKG_PROGRAM dpkg DOC "dpkg program of Debian-based systems")
 
if(DPKG_PROGRAM)
 
  execute_process(
 
    COMMAND ${DPKG_PROGRAM} --print-architecture
 
@@ -174,8 +202,9 @@ if(DPKG_PROGRAM)
 
  set(CPACK_PACKAGE_FILE_NAME
 
	"${CPACK_PACKAGE_NAME_LOWERCASE}_${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}_${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}")
 
else(DPKG_PROGRAM)
 
  set(CPACK_PACKAGE_FILE_NAME
 
	"${CPACK_PACKAGE_NAME_LOWERCASE}_${PROJECT_VERSION}-${PROJECT_VERSION_REVISION}_${CMAKE_SYSTEM_NAME}")
 
endif(DPKG_PROGRAM)
 
endif (UNIX)
 

	
 
include(CPack)
README.md
Show inline comments
 
@@ -7,12 +7,18 @@ Small and simple software for plotting d
 
## Features
 
* Reading data from serial port
 
* Binary data formats (u)int8, (u)int16, (u)int32, float
 
* ASCII input (Comma Separated Values)
 
* Synchronized multi channel plotting
 

	
 
## Installation
 

	
 
You can obtain installation packages from
 
[downloads](https://bitbucket.org/hyOzd/serialplot/downloads). As of
 
moment there is only Debian and Windows 64 bits packages.
 

	
 
## Dependencies
 
- Qt 5, including SerialPort module
 
- Qwt 6.1
 

	
 
## Building
 

	
 
@@ -56,7 +62,7 @@ You can also build with QtCreator IDE us
 

	
 
## Known Issues
 
- Port error 13 happens when closing. This is a Qt issue. It's known
 
  to not happen with Qt 5.4.1 . Not fatal.
 

	
 
## License
 
This software is licensed under GPLv3. See file COPYING for details.
 
\ No newline at end of file
 
This software is licensed under GPLv3. See file COPYING for details.
about_dialog.ui
Show inline comments
 
@@ -14,13 +14,13 @@
 
   <string>About</string>
 
  </property>
 
  <layout class="QVBoxLayout" name="verticalLayout">
 
   <item>
 
    <widget class="QLabel" name="lbAbout">
 
     <property name="text">
 
      <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p align=&quot;center&quot;&gt;&lt;span style=&quot; font-size:14pt;&quot;&gt;SerialPlot&lt;/span&gt;&lt;/p&gt;&lt;p align=&quot;center&quot;&gt;&lt;span style=&quot; font-size:10pt;&quot;&gt;$VERSION_STRING$&lt;/span&gt;&lt;/p&gt;&lt;p align=&quot;center&quot;&gt;Developed by Hasan Yavuz Özderya&lt;/p&gt;&lt;p align=&quot;center&quot;&gt;Using Qt and Qwt (&lt;a href=&quot;http://qwt.sf.net&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;http://qwt.sf.net&lt;/span&gt;&lt;/a&gt;)&lt;/p&gt;&lt;p align=&quot;center&quot;&gt;&lt;br/&gt;&lt;/p&gt;&lt;p align=&quot;center&quot;&gt;This software is GPL licensed. You can obtain source code from &lt;a href=&quot;https://bitbucket.org/hyOzd/serialplot&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;https://bitbucket.org/hyOzd/serialplot&lt;/span&gt;&lt;/a&gt;.&lt;/p&gt;&lt;p align=&quot;center&quot;&gt;&lt;br/&gt;&lt;/p&gt;&lt;p align=&quot;right&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt;RevID: $VERSION_REVISION$&lt;br/&gt;&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
 
      <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p align=&quot;center&quot;&gt;&lt;span style=&quot; font-size:14pt;&quot;&gt;SerialPlot&lt;/span&gt;&lt;/p&gt;&lt;p align=&quot;center&quot;&gt;&lt;span style=&quot; font-size:10pt;&quot;&gt;$VERSION_STRING$&lt;/span&gt;&lt;/p&gt;&lt;p align=&quot;center&quot;&gt;Developed by Hasan Yavuz Özderya&lt;/p&gt;&lt;p align=&quot;center&quot;&gt;Using Qt (&lt;a href=&quot;https://www.qt.io/&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;https://www.qt.io/&lt;/span&gt;&lt;/a&gt;) and Qwt (&lt;a href=&quot;http://qwt.sf.net&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;http://qwt.sf.net&lt;/span&gt;&lt;/a&gt;)&lt;/p&gt;&lt;p align=&quot;center&quot;&gt;&lt;br/&gt;&lt;/p&gt;&lt;p align=&quot;center&quot;&gt;This software is GPL licensed. You can obtain source code from &lt;a href=&quot;https://bitbucket.org/hyOzd/serialplot&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;https://bitbucket.org/hyOzd/serialplot&lt;/span&gt;&lt;/a&gt;.&lt;/p&gt;&lt;p align=&quot;center&quot;&gt;&lt;br/&gt;&lt;/p&gt;&lt;p align=&quot;right&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt;RevID: $VERSION_REVISION$&lt;br/&gt;&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
 
     </property>
 
     <property name="wordWrap">
 
      <bool>true</bool>
 
     </property>
 
     <property name="openExternalLinks">
 
      <bool>true</bool>
cmake/modules/FindQwt.cmake
Show inline comments
 
@@ -19,13 +19,13 @@
 

	
 
#
 
# Note: This module will only find local Qwt installations in
 
# /usr/local/qwt-VERSION directories.
 
#
 

	
 
file(GLOB qwt_glob_dir "/usr/local/qwt*/")
 
file(GLOB qwt_glob_dir "/usr/local/qwt*/" "c:/Qwt*")
 

	
 
if(qwt_glob_dir)
 
  foreach(qwt_path ${qwt_glob_dir})
 
	# find the qwt_global.h file
 
	unset(qwt_root CACHE)
 
	find_path(qwt_root
floatswap.h
Show inline comments
 
#include <byteswap.h>
 
#include <QtGlobal>
 

	
 
template <> inline float qbswap<float>(float source)
 
{
 
    float result;
 
    char* s = (char*) &source;
mainwindow.cpp
Show inline comments
 
@@ -33,12 +33,17 @@
 
#include <iostream>
 

	
 
#include "utils.h"
 
#include "version.h"
 
#include "floatswap.h"
 

	
 
#if defined(Q_OS_WIN) && defined(QT_STATIC)
 
#include <QtPlugin>
 
Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin)
 
#endif
 

	
 
MainWindow::MainWindow(QWidget *parent) :
 
    QMainWindow(parent),
 
    ui(new Ui::MainWindow),
 
    portControl(&serialPort)
 
{
 
    ui->setupUi(this);
 
@@ -53,12 +58,15 @@ MainWindow::MainWindow(QWidget *parent) 
 
    QObject::connect(ui->actionHelpAbout, &QAction::triggered,
 
              &aboutDialog, &QWidget::show);
 

	
 
    QObject::connect(ui->actionExportCsv, &QAction::triggered,
 
                     this, &MainWindow::onExportCsv);
 

	
 
    QObject::connect(ui->actionQuit, &QAction::triggered,
 
                     this, &MainWindow::close);
 

	
 
    QObject::connect(&portControl, &PortControl::portToggled,
 
                     this, &MainWindow::onPortToggled);
 

	
 
    QObject::connect(&portControl, &PortControl::skipByteRequested,
 
                     this, &MainWindow::skipByte);
 

	
 
@@ -134,28 +142,51 @@ MainWindow::MainWindow(QWidget *parent) 
 
    }
 
    else
 
    {
 
        selectNumberFormat(NumberFormat_uint8);
 
    }
 

	
 

	
 
    // init text view
 
    ui->ptTextView->setEnabled(ui->cbEnableTextView->isChecked());
 
    // TODO: does this work in binary mode? (no new lines)
 
    ui->ptTextView->setMaximumBlockCount(10000);
 
    QObject::connect(ui->cbEnableTextView, &QCheckBox::toggled,
 
                     ui->ptTextView, &QWidget::setEnabled);
 
    QObject::connect(ui->pbClearTextView, &QPushButton::clicked,
 
                     ui->ptTextView, &QPlainTextEdit::clear);
 

	
 

	
 
    // Init sps (sample per second) counter
 
    sampleCount = 0;
 
    spsLabel.setText("0sps");
 
    spsLabel.setToolTip("samples per second (total of all channels)");
 
    ui->statusBar->addPermanentWidget(&spsLabel);
 
    spsTimer.start(SPS_UPDATE_TIMEOUT * 1000);
 
    QObject::connect(&spsTimer, &QTimer::timeout,
 
                     this, &MainWindow::spsTimerTimeout);
 

	
 
    // Init demo mode
 
    demoCount = 0;
 
    demoTimer.setInterval(100);
 
    QObject::connect(&demoTimer, &QTimer::timeout,
 
                     this, &MainWindow::demoTimerTimeout);
 
    QObject::connect(ui->actionDemoMode, &QAction::toggled,
 
                     this, &MainWindow::enableDemo);
 

	
 
    {   // init demo indicator
 
        QwtText demoText(" DEMO RUNNING ");  // looks better with spaces
 
        demoText.setColor(QColor("white"));
 
        demoText.setBackgroundBrush(Qt::darkRed);
 
        demoText.setBorderRadius(4);
 
        demoText.setRenderFlags(Qt::AlignLeft | Qt::AlignTop);
 
        demoIndicator.setText(demoText);
 
        demoIndicator.hide();
 
        demoIndicator.attach(ui->plot);
 
    }
 

	
 
}
 

	
 
MainWindow::~MainWindow()
 
{
 
    for (auto curve : curves)
 
    {
 
@@ -243,12 +274,19 @@ void MainWindow::onDataReady()
 

	
 
void MainWindow::onDataReadyASCII()
 
{
 
    while(serialPort.canReadLine())
 
    {
 
        QByteArray line = serialPort.readLine();
 

	
 
        // discard data if paused
 
        if (ui->actionPause->isChecked())
 
        {
 
            return;
 
        }
 

	
 
        line = line.trimmed();
 

	
 
        if (ui->cbEnableTextView->isChecked())
 
        {
 
            ui->ptTextView->appendPlainText(line);
 
        }
 
@@ -369,12 +407,14 @@ void MainWindow::addChannelData(unsigned
 
        }
 
    }
 

	
 
    // update plot
 
    curves[channel]->setSamples(dataX, (*channelDataArray));
 
    ui->plot->replot(); // TODO: replot after all channel data updated
 

	
 
    sampleCount += data.size();
 
}
 

	
 
void MainWindow::clearPlot()
 
{
 
    for (unsigned int ci = 0; ci < numOfChannels; ci++)
 
    {
 
@@ -561,12 +601,18 @@ template<typename T> double MainWindow::
 

	
 
bool MainWindow::isDemoRunning()
 
{
 
    return ui->actionDemoMode->isChecked();
 
}
 

	
 
void MainWindow::spsTimerTimeout()
 
{
 
    spsLabel.setText(QString::number(sampleCount/SPS_UPDATE_TIMEOUT) + "sps");
 
    sampleCount = 0;
 
}
 

	
 
void MainWindow::demoTimerTimeout()
 
{
 
    demoCount++;
 
    if (demoCount > 100) demoCount = 0;
 

	
 
    if (!ui->actionPause->isChecked())
 
@@ -585,22 +631,26 @@ void MainWindow::enableDemo(bool enabled
 
    if (enabled)
 
    {
 
        if (!serialPort.isOpen())
 
        {
 
            demoTimer.start();
 
            ui->actionDemoMode->setChecked(true);
 
            demoIndicator.show();
 
            ui->plot->replot();
 
        }
 
        else
 
        {
 
            ui->actionDemoMode->setChecked(false);
 
        }
 
    }
 
    else
 
    {
 
        demoTimer.stop();
 
        ui->actionDemoMode->setChecked(false);
 
        demoIndicator.hide();
 
        ui->plot->replot();
 
    }
 
}
 

	
 
/*
 
  Below crude drawing demostrates how color selection occurs for
 
  given channel index
mainwindow.h
Show inline comments
 
@@ -19,21 +19,23 @@
 

	
 
#ifndef MAINWINDOW_H
 
#define MAINWINDOW_H
 

	
 
#include <QMainWindow>
 
#include <QButtonGroup>
 
#include <QLabel>
 
#include <QString>
 
#include <QVector>
 
#include <QList>
 
#include <QSerialPort>
 
#include <QSignalMapper>
 
#include <QTimer>
 
#include <QColor>
 
#include <QtGlobal>
 
#include <qwt_plot_curve.h>
 
#include <qwt_plot_textlabel.h>
 

	
 
#include "portcontrol.h"
 
#include "ui_about_dialog.h"
 

	
 
namespace Ui {
 
class MainWindow;
 
@@ -77,28 +79,34 @@ private:
 

	
 
    QList<QwtPlotCurve*> curves;
 
    typedef QVector<double> DataArray;
 
    DataArray dataX;   // array that simply contains numbers 0..numberOfSamples
 
    QList<DataArray> channelsData;
 

	
 
    // `data` contains channel specific data
 
    // `data` contains i th channels data
 
    void addChannelData(unsigned int channel, DataArray data);
 

	
 
    NumberFormat numberFormat;
 
    unsigned int sampleSize; // number of bytes in the selected number format
 
    double (MainWindow::*readSample)();
 

	
 
    // note that serialPort should already have enough bytes present
 
    template<typename T> double readSampleAs();
 

	
 
    bool skipByteRequested;
 

	
 
    const int SPS_UPDATE_TIMEOUT = 1;  // second
 
    QLabel spsLabel;
 
    unsigned int sampleCount;
 
    QTimer spsTimer;
 

	
 
    // demo
 
    QTimer demoTimer;
 
    int demoCount;
 
    bool isDemoRunning();
 
    QwtPlotTextLabel demoIndicator;
 

	
 
    QColor makeColor(unsigned int channelIndex);
 

	
 
private slots:
 
    void onPortToggled(bool open);
 
    void onDataReady();      // used with binary number formats
 
@@ -114,12 +122,14 @@ private slots:
 
    void onNumOfChannelsChanged(int value);
 
    void onNumberFormatButtonToggled(int numberFormatId, bool checked);
 
    void selectNumberFormat(NumberFormat numberFormatId);
 

	
 
    void clearPlot();
 

	
 
    void spsTimerTimeout();
 

	
 
    void demoTimerTimeout();
 
    void enableDemo(bool enabled);
 

	
 
    void onExportCsv();
 
};
 

	
mainwindow.ui
Show inline comments
 
@@ -103,26 +103,35 @@
 
            <property name="title">
 
             <string>Number Format:</string>
 
            </property>
 
            <layout class="QGridLayout" name="gridLayout_2">
 
             <item row="2" column="0">
 
              <widget class="QRadioButton" name="rbUint32">
 
               <property name="toolTip">
 
                <string>unsigned 4 bytes integer</string>
 
               </property>
 
               <property name="text">
 
                <string>uint32</string>
 
               </property>
 
              </widget>
 
             </item>
 
             <item row="0" column="1">
 
              <widget class="QRadioButton" name="rbInt8">
 
               <property name="toolTip">
 
                <string>signed 1 byte integer</string>
 
               </property>
 
               <property name="text">
 
                <string>int8</string>
 
               </property>
 
              </widget>
 
             </item>
 
             <item row="0" column="0">
 
              <widget class="QRadioButton" name="rbUint8">
 
               <property name="toolTip">
 
                <string>unsigned 1 byte integer</string>
 
               </property>
 
               <property name="text">
 
                <string>uint8</string>
 
               </property>
 
               <property name="checked">
 
                <bool>true</bool>
 
               </property>
 
@@ -137,33 +146,45 @@
 
                <string>ASCII(CSV)</string>
 
               </property>
 
              </widget>
 
             </item>
 
             <item row="1" column="1">
 
              <widget class="QRadioButton" name="rbInt16">
 
               <property name="toolTip">
 
                <string>signed 2 bytes integer</string>
 
               </property>
 
               <property name="text">
 
                <string>int16</string>
 
               </property>
 
              </widget>
 
             </item>
 
             <item row="2" column="1">
 
              <widget class="QRadioButton" name="rbInt32">
 
               <property name="toolTip">
 
                <string>signed 4 bytes integer</string>
 
               </property>
 
               <property name="text">
 
                <string>int32</string>
 
               </property>
 
              </widget>
 
             </item>
 
             <item row="3" column="0">
 
              <widget class="QRadioButton" name="rbFloat">
 
               <property name="toolTip">
 
                <string>4 bytes floating point number</string>
 
               </property>
 
               <property name="text">
 
                <string>float</string>
 
               </property>
 
              </widget>
 
             </item>
 
             <item row="1" column="0">
 
              <widget class="QRadioButton" name="rbUint16">
 
               <property name="toolTip">
 
                <string>unsigned 2 bytes integer</string>
 
               </property>
 
               <property name="text">
 
                <string>uint16</string>
 
               </property>
 
              </widget>
 
             </item>
 
            </layout>
 
@@ -200,22 +221,28 @@
 
            <property name="title">
 
             <string>Byte Order:</string>
 
            </property>
 
            <layout class="QVBoxLayout" name="verticalLayout">
 
             <item>
 
              <widget class="QRadioButton" name="rbLittleE">
 
               <property name="toolTip">
 
                <string>least significant byte first</string>
 
               </property>
 
               <property name="text">
 
                <string>Little Endian</string>
 
               </property>
 
               <property name="checked">
 
                <bool>true</bool>
 
               </property>
 
              </widget>
 
             </item>
 
             <item>
 
              <widget class="QRadioButton" name="rbBigE">
 
               <property name="toolTip">
 
                <string>most significant byte first</string>
 
               </property>
 
               <property name="text">
 
                <string>Big Endian</string>
 
               </property>
 
              </widget>
 
             </item>
 
            </layout>
 
@@ -292,19 +319,25 @@
 
            <property name="maximumSize">
 
             <size>
 
              <width>75</width>
 
              <height>16777215</height>
 
             </size>
 
            </property>
 
            <property name="toolTip">
 
             <string>lower limit of Y axis</string>
 
            </property>
 
            <property name="value">
 
             <double>0.000000000000000</double>
 
            </property>
 
           </widget>
 
          </item>
 
          <item row="0" column="1">
 
           <widget class="QSpinBox" name="spNumOfSamples">
 
            <property name="toolTip">
 
             <string>length of X axis</string>
 
            </property>
 
            <property name="keyboardTracking">
 
             <bool>false</bool>
 
            </property>
 
            <property name="minimum">
 
             <number>2</number>
 
            </property>
 
@@ -361,12 +394,15 @@
 
            <property name="maximumSize">
 
             <size>
 
              <width>75</width>
 
              <height>16777215</height>
 
             </size>
 
            </property>
 
            <property name="toolTip">
 
             <string>upper limit of Y axis</string>
 
            </property>
 
            <property name="maximum">
 
             <double>1000.000000000000000</double>
 
            </property>
 
            <property name="value">
 
             <double>1000.000000000000000</double>
 
            </property>
 
@@ -489,12 +525,14 @@
 
   </widget>
 
   <widget class="QMenu" name="menuFile">
 
    <property name="title">
 
     <string>File</string>
 
    </property>
 
    <addaction name="actionExportCsv"/>
 
    <addaction name="separator"/>
 
    <addaction name="actionQuit"/>
 
   </widget>
 
   <addaction name="menuFile"/>
 
   <addaction name="menuHelp"/>
 
  </widget>
 
  <widget class="QToolBar" name="mainToolBar">
 
   <attribute name="toolBarArea">
 
@@ -547,12 +585,20 @@
 
    <string>Export CSV</string>
 
   </property>
 
   <property name="toolTip">
 
    <string>Export plot data to CSV</string>
 
   </property>
 
  </action>
 
  <action name="actionQuit">
 
   <property name="text">
 
    <string>Quit</string>
 
   </property>
 
   <property name="shortcut">
 
    <string>Ctrl+Q</string>
 
   </property>
 
  </action>
 
 </widget>
 
 <layoutdefault spacing="6" margin="11"/>
 
 <customwidgets>
 
  <customwidget>
 
   <class>QwtPlot</class>
 
   <extends>QFrame</extends>
misc/pseudo_device.py
Show inline comments
 
@@ -58,12 +58,22 @@ def float_sine(port):
 
        # cos = math.sin(2 * math.pi * (i / period + 1 / 4))
 
        data = struct.pack('ff', sin, -sin)
 
        os.write(port, data)
 
        i = (i + 1) % period
 
        time.sleep(0.1)
 

	
 
def uint32_test(port, little):
 
    """Puts 32 bit unsigned integer data through pseudo terminal"""
 
    i = 0
 
    maxi = 200
 
    while True:
 
        data = struct.pack('>I', i)
 
        os.write(port, data)
 
        time.sleep(0.05)
 
        i = i+1 if i <= maxi else 0
 

	
 
def run():
 
    # create the pseudo terminal
 
    master, slave = pty.openpty()
 

	
 
    master_name = os.ttyname(master)
 
    slave_name = os.ttyname(slave)
misc/serialplot.bmp
Show inline comments
 
new file 100644
 
binary diff not shown
Show images
misc/serialplot.ico
Show inline comments
 
new file 100644
 
binary diff not shown
misc/windows_icon.rc
Show inline comments
 
new file 100644
 
IDI_ICON1               ICON    DISCARDABLE     "serialplot.ico"
 
\ No newline at end of file
portcontrol.ui
Show inline comments
 
@@ -66,12 +66,15 @@
 
         <property name="maximumSize">
 
          <size>
 
           <width>30</width>
 
           <height>16777215</height>
 
          </size>
 
         </property>
 
         <property name="toolTip">
 
          <string>Reload port list</string>
 
         </property>
 
         <property name="text">
 
          <string>↺</string>
 
         </property>
 
        </widget>
 
       </item>
 
      </layout>
 
@@ -277,22 +280,28 @@
 
       <property name="minimumSize">
 
        <size>
 
         <width>0</width>
 
         <height>50</height>
 
        </size>
 
       </property>
 
       <property name="toolTip">
 
        <string>Toggle port status</string>
 
       </property>
 
       <property name="text">
 
        <string>Open</string>
 
       </property>
 
       <property name="checkable">
 
        <bool>true</bool>
 
       </property>
 
      </widget>
 
     </item>
 
     <item>
 
      <widget class="QPushButton" name="pbSkipByte">
 
       <property name="toolTip">
 
        <string>Skip reading 1 byte to correct the alignment</string>
 
       </property>
 
       <property name="text">
 
        <string>Skip Byte</string>
 
       </property>
 
      </widget>
 
     </item>
 
     <item>
0 comments (0 inline, 0 general)