Skip to content

Commit 337866c

Browse files
committed
Filter Plotting packets
Allows filtering out plotting packets, so you can see the non {} packets as a normal output
1 parent 91e60ea commit 337866c

4 files changed

Lines changed: 26 additions & 4 deletions

File tree

mainwindow.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -430,9 +430,9 @@ void MainWindow::readData()
430430

431431
//Huh strange. Qt 5.6, returns "\r{P1|PWM|255,0,0|0}\n" instead of "{P1|PWM|255,0,0|0}\r\n" as it was before
432432
//Hence a quick solution to the problem
433-
data.remove(0, 1);
433+
/* data.remove(0, 1);
434434
data.remove(data.length()-1, 1);
435-
data.append("\r\n");
435+
data.append("\r\n");*/
436436

437437
if(terminal->isVisible())
438438
terminal->appendOutput( data );

plotter.ui

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<item>
1818
<widget class="QTabWidget" name="tabWidget">
1919
<property name="currentIndex">
20-
<number>1</number>
20+
<number>0</number>
2121
</property>
2222
<widget class="QWidget" name="tab">
2323
<attribute name="title">
@@ -102,7 +102,7 @@
102102
<property name="geometry">
103103
<rect>
104104
<x>0</x>
105-
<y>-385</y>
105+
<y>0</y>
106106
<width>351</width>
107107
<height>678</height>
108108
</rect>

terminal.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,18 @@ void Terminal::appendOutput(QString data)
117117
{
118118
// ui->terminalBrowser->append( data );
119119

120+
if(ui->filterPlotPacketsCheckBox->isChecked())
121+
{
122+
QString tempStr( data.mid(1,data.size()-4) );
123+
124+
QRegExp rx_timeplot("[a-zA-Z0-9]+(\\|[a-zA-Z0-9 ]+\\|\\d{1,3},\\d{1,3},\\d{1,3}\\|(\\-*\\d+(\\.{0,1}\\d+)*|nan|inf))+");
125+
QRegExp rx_xy_plot("[a-zA-Z0-9]+\\|[a-zA-Z0-9 ]+\\|\\d{1,3},\\d{1,3},\\d{1,3}\\|(\\-*\\d+\\s\\-*\\d+\\s*)+");
126+
if(rx_timeplot.exactMatch(tempStr) || rx_xy_plot.exactMatch(tempStr))
127+
{
128+
return;
129+
}
130+
}
131+
120132
QTextCursor oldCursor = ui->terminalBrowser->textCursor();
121133
int oldScrollValue = ui->terminalBrowser->verticalScrollBar()->value();
122134

terminal.ui

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,16 @@
4343
</property>
4444
</spacer>
4545
</item>
46+
<item>
47+
<widget class="QCheckBox" name="filterPlotPacketsCheckBox">
48+
<property name="toolTip">
49+
<string>For convinience filters out all the packets sent for plotting. Clears up terminal for easier debugging even while plotting</string>
50+
</property>
51+
<property name="text">
52+
<string>Filter Plotting Packets</string>
53+
</property>
54+
</widget>
55+
</item>
4656
<item>
4757
<widget class="QCheckBox" name="autoScrollCheckBox">
4858
<property name="text">

0 commit comments

Comments
 (0)