Skip to content

Commit

Permalink
Add support for G33/G76
Browse files Browse the repository at this point in the history
  • Loading branch information
Schildkroet committed Feb 7, 2021
1 parent 8dd2634 commit b223169
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 5 deletions.
4 changes: 2 additions & 2 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ Linux: QT 5.12.2 with GCC
Downloads:
----------

* Windows: [Candle_2.1.zip](https://github.com/Schildkroet/Candle2/releases/download/V2.1/Candle2.1.zip)
* Linux: [Candle_2.1_linux.zip](https://github.com/Schildkroet/Candle2/releases/download/V2.1/Candle2.1_linux.zip)
* Windows: [Candle_2.2.zip](https://github.com/Schildkroet/Candle2/releases/download/V2.1/Candle2.2.zip)
* Linux: [Candle_2.2_Linux.zip](https://github.com/Schildkroet/Candle2/releases/download/V2.1/Candle2.2_Linux.zip)


Candle 2 GUI
Expand Down
8 changes: 5 additions & 3 deletions src/frmmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -718,7 +718,7 @@ void frmMain::onProcessData()
break;
}

if(m_serialHandWheel.isOpen() && m_serialHandWheel.canReadLine() && m_transferCompleted)
if(m_serialHandWheel.isOpen() && SerialIf_IsOpen() && m_serialHandWheel.canReadLine() && m_transferCompleted)
{
QString msg = m_serialHandWheel.readLine();
//qDebug() << "HW: " << msg;
Expand Down Expand Up @@ -801,15 +801,17 @@ void frmMain::onSendSerial()

void frmMain::onTimerUpdateSpindleParser()
{
static bool updateSpinde = false;

if (SerialIf_IsOpen() && !m_homing && !ui->cmdFilePause->isChecked() && mCommandsWait.size() == 0)
{
if (m_updateSpindleSpeed)
{
m_updateSpindleSpeed = false;
sendCommand(QString("S%1").arg(ui->slbSpindle->value()), -2, m_settings->showUICommands());
}

if (m_updateParserStatus)
updateSpinde = !updateSpinde;
if (m_updateParserStatus || updateSpinde)
{
m_updateParserStatus = false;
sendCommand("$G", -3, false);
Expand Down
38 changes: 38 additions & 0 deletions src/parser/gcodeparser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -407,13 +407,51 @@ PointSegment * GcodeParser::handleGCode(float code, const QStringList &args)
else if (code == 19.0f) this->m_currentPlane = PointSegment::YZ;
else if (code == 20.0f) this->m_isMetric = false;
else if (code == 21.0f) this->m_isMetric = true;
else if (code == 33.0f) ps = addLinearPointSegment(nextPoint, false);
else if (code == 90.0f) this->m_inAbsoluteMode = true;
else if (code == 90.1f) this->m_inAbsoluteIJKMode = true;
else if (code == 91.0f) this->m_inAbsoluteMode = false;
else if (code == 91.1f) this->m_inAbsoluteIJKMode = false;
else if (code == 98.0f) this->m_retractOldZ = true;
else if (code == 99.0f) this->m_retractOldZ = false;

else if (code == 76.0f)
{
// Currently only display the final cut
QVector3D dl_start(m_currentPoint);
QVector3D dl_end(m_currentPoint);
dl_end.setZ(nextPoint.z());
char c;
double p = qQNaN();
double j = qQNaN();
double k = qQNaN();

for (int i = 0; i < args.length(); i++) {
if (args.at(i).length() > 0) {
c = args.at(i).at(0).toUpper().toLatin1();
switch (c) {
case 'I':
p = args.at(i).mid(1).toDouble();
break;
case 'J':
j = args.at(i).mid(1).toDouble();
break;
case 'K':
k = args.at(i).mid(1).toDouble();
break;
}
}
}

float fin_depth = m_currentPoint.x() + p - k;

dl_start.setX(fin_depth);
addLinearPointSegment(dl_start, true);
dl_start.setZ(dl_end.z());
addLinearPointSegment(dl_start, false);
ps = addLinearPointSegment(dl_end, true);
}

else if (code == 81.0f || code == 82.0f || code == 83.0f)
{
// New point at X/Y
Expand Down

0 comments on commit b223169

Please sign in to comment.