Skip to content

Commit

Permalink
Read state change values from equals sign rather than fixed length
Browse files Browse the repository at this point in the history
...of two rightmost characters.
Allows reading three-digit+ values.
  • Loading branch information
SeongGino authored May 28, 2024
1 parent 80f742c commit 8288cc2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion qhookermain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ bool qhookerMain::GameStarted(QString input)
if(portNum >= 0 && portNum < serialFoundList.count()) {
// if contains %s%, s needs to be replaced by state.
if(action[i].contains("%s%")) {
action[i] = action[i].replace("%s%", "%1").arg(buffer[0].rightRef(2).toInt());
action[i] = action[i].replace("%s%", "%1").arg(buffer[0].mid(buffer[0].indexOf('=')+2).toInt());
}
serialPort[portNum].write(action[i].mid(action[i].indexOf("cmw")+6).toLocal8Bit());
if(!serialPort[portNum].waitForBytesWritten(2000)) {
Expand Down

0 comments on commit 8288cc2

Please sign in to comment.