Skip to content

Commit 9c952c2

Browse files
committed
Allow Arduino Serial Plotter style input
1 parent dc93651 commit 9c952c2

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/asciireader.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@ unsigned AsciiReader::readData()
163163
SamplePack* AsciiReader::parseLine(const QString& line) const
164164
{
165165
auto separatedValues = line.split(delimiter, QString::SkipEmptyParts);
166+
QString strippedValue;
166167
unsigned numComingChannels = separatedValues.length();
167168

168169
// check number of channels (skipped if auto num channels is enabled)
@@ -177,17 +178,18 @@ SamplePack* AsciiReader::parseLine(const QString& line) const
177178
auto samples = new SamplePack(1, numComingChannels);
178179
for (unsigned ci = 0; ci < numComingChannels; ci++)
179180
{
181+
strippedValue = separatedValues[ci].split(':', QString::SkipEmptyParts).back();
180182
bool ok;
181183
if (isHexData)
182184
{
183-
samples->data(ci)[0] = separatedValues[ci].toInt(&ok,16);
185+
samples->data(ci)[0] = strippedValue.toInt(&ok,16);
184186
}
185187
else
186188
{
187-
samples->data(ci)[0] = separatedValues[ci].toDouble(&ok);
189+
samples->data(ci)[0] = strippedValue.toDouble(&ok);
188190
if (!ok)
189191
{
190-
samples->data(ci)[0] = separatedValues[ci].toInt(&ok,0);
192+
samples->data(ci)[0] = strippedValue.toInt(&ok,0);
191193
}
192194
}
193195
if (!ok)

0 commit comments

Comments
 (0)