Checksum optimizations
This commit is contained in:
parent
d62be051dd
commit
690388624f
@ -96,10 +96,10 @@ bool Sender::sendLine(QString line)
|
|||||||
sentCommands.clear();
|
sentCommands.clear();
|
||||||
if(printer->isOpen())
|
if(printer->isOpen())
|
||||||
{
|
{
|
||||||
if(sendingChecksum && !resending)
|
if(sendingChecksum)
|
||||||
{
|
{
|
||||||
if(line.contains("M110")) totalLineNum = 0;
|
if(line.contains("M110")) totalLineNum = 0;
|
||||||
|
sentCommands.append(line);
|
||||||
//Checksum algorithm from RepRap wiki
|
//Checksum algorithm from RepRap wiki
|
||||||
line = "N"+QString::number(totalLineNum)+line+"*";
|
line = "N"+QString::number(totalLineNum)+line+"*";
|
||||||
int cs = 0;
|
int cs = 0;
|
||||||
@ -107,7 +107,6 @@ bool Sender::sendLine(QString line)
|
|||||||
cs &= 0xff;
|
cs &= 0xff;
|
||||||
line += QString::number(cs);
|
line += QString::number(cs);
|
||||||
totalLineNum++;
|
totalLineNum++;
|
||||||
sentCommands.append(line);
|
|
||||||
}
|
}
|
||||||
if(printer->write(line.toUtf8()+'\n')) return true;
|
if(printer->write(line.toUtf8()+'\n')) return true;
|
||||||
else return false;
|
else return false;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user