Fixed parsing and processing of modifiers in custom frame sender

window. Added serialbus to project (Qt5.6 dependency)
This commit is contained in:
Collin Kidder
2016-02-25 21:09:48 -05:00
parent 6e64ab7134
commit f8e72986f0
2 changed files with 41 additions and 46 deletions
+1 -1
View File
@@ -6,7 +6,7 @@
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets serialport printsupport qml
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets serialport printsupport qml serialbus
CONFIG(release, debug|release):DEFINES += QT_NO_DEBUG_OUTPUT
+12 -17
View File
@@ -430,7 +430,7 @@ int FrameSenderWindow::fetchOperand(int idx, ModifierOperand op)
if (op.notOper) return ~op.databyte;
else return op.databyte;
}
else if (op.ID == -2)
else if (op.ID == -2) //fetch data from a data byte within the output frame
{
if (op.notOper) return ~sendingData.at(idx).data[op.databyte];
else return sendingData.at(idx).data[op.databyte];
@@ -473,6 +473,8 @@ void FrameSenderWindow::processModifierText(int line)
QString modString;
bool firstOp = true;
bool abort = false;
QString token;
ModifierOp thisOp;
//Example line:
//d0 = D0 + 1,d1 = id:0x200:d3 + id:0x200:d4 AND 0xF0 - Original version
@@ -493,6 +495,7 @@ void FrameSenderWindow::processModifierText(int line)
{
Modifier thisMod;
thisMod.destByte = 0;
firstOp = true;
QString leftSide = Utility::grabAlphaNumeric(mods[i]);
if (leftSide.startsWith("D") && leftSide.length() == 2)
@@ -511,13 +514,8 @@ void FrameSenderWindow::processModifierText(int line)
continue;
}
abort = false;
while (!abort)
{
QString token = Utility::grabAlphaNumeric(mods[i]);
ModifierOp thisOp;
if (firstOp)
{
token = Utility::grabAlphaNumeric(mods[i]);
if (token[0] == '~')
{
thisOp.first.notOper = true;
@@ -525,14 +523,8 @@ void FrameSenderWindow::processModifierText(int line)
}
else thisOp.first.notOper = false;
parseOperandString(token.split(":"), thisOp.first);
firstOp = false;
}
else
{
thisOp.first.ID = -1; //shadow register
}
if (mods[i].length() == 0) //if this thing had no actual operation or second operand then fake it
{
if (mods[i].length() < 2) {
abort = true;
thisOp.operation = ADDITION;
thisOp.second.ID = 0;
@@ -540,7 +532,8 @@ void FrameSenderWindow::processModifierText(int line)
thisOp.second.notOper = false;
thisMod.operations.append(thisOp);
}
else //otherwise try to grab them
while (!abort)
{
QString operation = Utility::grabOperation(mods[i]);
if (operation == "")
@@ -562,7 +555,9 @@ void FrameSenderWindow::processModifierText(int line)
parseOperandString(secondOp.split(":"), thisOp.second);
thisMod.operations.append(thisOp);
}
}
thisOp.first.ID = -1; //shadow register
if (mods[i].length() < 2) abort = true;
}
sendingData[line].modifiers.append(thisMod);