Skip to content

Commit

Permalink
Small bugfixes and UI improvements
Browse files Browse the repository at this point in the history
Signed-off-by: Patrick Felixberger <[email protected]>
  • Loading branch information
Schildkroet committed Feb 23, 2024
1 parent 365c808 commit 638a290
Show file tree
Hide file tree
Showing 5 changed files with 212 additions and 22 deletions.
5 changes: 4 additions & 1 deletion src/frmabout.ui
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,10 @@
<item>
<widget class="QLabel" name="lblAbout">
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Candle 2&lt;br/&gt;Version: 2.5&lt;br/&gt;License: GNU GENERAL PUBLIC LICENSE&lt;a href=&quot;https://github.com/Schildkroet/Candle2/&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;&lt;br/&gt;&lt;/span&gt;&lt;/a&gt;© 2015-2016 Hayrullin Denis Ravilevich&lt;br/&gt;© 2018-2023 Patrick F.&lt;/p&gt;&lt;p&gt;Visit: &lt;a href=&quot;https://github.com/Schildkroet/Candle2/&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;https://github.com/Schildkroet/Candle2/&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
<string>&lt;html&gt;&lt;head&gt;&lt;title&gt;About&lt;/title&gt;&lt;/head&gt;&lt;body&gt;&lt;p&gt;Candle 2&lt;br/&gt;Version: 2.6&lt;br/&gt;License: GNU GENERAL PUBLIC LICENSE&lt;br/&gt;© 2015-2016 Hayrullin Denis Ravilevich&lt;br/&gt;© 2018-2024 Patrick F.&lt;/p&gt;&lt;p&gt;Visit: &lt;a href=&quot;https://github.com/Schildkroet/Candle2/&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;https://github.com/Schildkroet/Candle2/&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="textFormat">
<enum>Qt::AutoText</enum>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
Expand Down
61 changes: 49 additions & 12 deletions src/frmmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ frmMain::frmMain(QWidget *parent) :
<< "Door" // TODO: Update "Door" state
<< "Jog"
<< "Dwell"
<< "Tool";
<< "Tool"
<< "Busy";

m_statusCaptions << tr("Unknown")
<< tr("Idle")
Expand Down Expand Up @@ -500,6 +501,7 @@ void frmMain::updateControlsState()
ui->tabWidget->setTabEnabled(1, portOpened);
ui->tabWidget->setTabEnabled(2, portOpened);
ui->tabWidget->setTabEnabled(3, portOpened);
ui->tabWidget->setTabEnabled(4, portOpened);

ui->chkTestMode->setEnabled(portOpened && !m_processingFile);
ui->cmdHome->setEnabled(!m_processingFile);
Expand Down Expand Up @@ -842,22 +844,33 @@ void frmMain::onTimerUpdateSpindleParser()

void frmMain::onTimerStatusQuery()
{
if (SerialIf_IsOpen() && m_resetCompleted && m_statusReceived)
static int Timeout = 4;

if(SerialIf_IsOpen() && m_resetCompleted)
{
// Status report: ?
if(m_Protocol == PROT_GRBL1_1)
if(m_statusReceived || (Timeout <= 0))
{
SerialIf_Write("?");
Timeout = 4;

// Status report: ?
if(m_Protocol == PROT_GRBL1_1)
{
SerialIf_Write("?");
}
else if(m_Protocol == PROT_GRIP)
{
QByteArray data("?");
//GrIP_Transmit(MSG_SYSTEM_CMD, 0, (const uint8_t*)data.constData(), data.length());
Pdu_t p = {(uint8_t*)data.data(), (uint16_t)data.length()};
GrIP_Transmit(MSG_SYSTEM_CMD, 0, &p);
}

m_statusReceived = false;
}
else if(m_Protocol == PROT_GRIP)
else
{
QByteArray data("?");
//GrIP_Transmit(MSG_SYSTEM_CMD, 0, (const uint8_t*)data.constData(), data.length());
Pdu_t p = {(uint8_t*)data.data(), (uint16_t)data.length()};
GrIP_Transmit(MSG_SYSTEM_CMD, 0, &p);
Timeout--;
}

m_statusReceived = false;
}

ui->glwVisualizer->setBufferState(QString(tr("Buffer: %1 / %2 / %3")).arg(BufferLength()).arg(mCommandsSent.size()).arg(mCommandsWait.size()));
Expand Down Expand Up @@ -2248,3 +2261,27 @@ void frmMain::on_btnSaveCoord_clicked()

sendCommand(cmd, -1, m_settings->showUICommands());
}

void frmMain::on_btnClearCoord_clicked()
{
sendCommand("$RST=C", -1, m_settings->showUICommands());
}


void frmMain::on_btnCoolantFlood_clicked()
{
sendCommand("M8", -1, m_settings->showUICommands());
}


void frmMain::on_btnCoolantMist_clicked()
{
sendCommand("M7", -1, m_settings->showUICommands());
}


void frmMain::on_btnCoolantDisable_clicked()
{
sendCommand("M9", -1, m_settings->showUICommands());
}

8 changes: 8 additions & 0 deletions src/frmmain.h
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,14 @@ private slots:

void on_btnSaveCoord_clicked();

void on_btnClearCoord_clicked();

void on_btnCoolantFlood_clicked();

void on_btnCoolantMist_clicked();

void on_btnCoolantDisable_clicked();

protected:
void showEvent(QShowEvent *se);
void hideEvent(QHideEvent *he);
Expand Down
148 changes: 140 additions & 8 deletions src/frmmain.ui
Original file line number Diff line number Diff line change
Expand Up @@ -662,7 +662,7 @@ padding-right: 8;</string>
<number>5</number>
</property>
<property name="maxCount">
<number>10</number>
<number>16</number>
</property>
<property name="insertPolicy">
<enum>QComboBox::InsertAtTop</enum>
Expand Down Expand Up @@ -757,7 +757,7 @@ padding-right: 8;</string>
</property>
<property name="minimumSize">
<size>
<width>50</width>
<width>60</width>
<height>0</height>
</size>
</property>
Expand Down Expand Up @@ -901,7 +901,7 @@ padding-right: 8;</string>
</property>
<property name="minimumSize">
<size>
<width>50</width>
<width>60</width>
<height>0</height>
</size>
</property>
Expand Down Expand Up @@ -984,7 +984,7 @@ padding-right: 8;</string>
</property>
<property name="maximumSize">
<size>
<width>50</width>
<width>56</width>
<height>16777215</height>
</size>
</property>
Expand Down Expand Up @@ -1034,7 +1034,7 @@ padding-right: 8;</string>
</property>
<property name="maximumSize">
<size>
<width>50</width>
<width>56</width>
<height>16777215</height>
</size>
</property>
Expand Down Expand Up @@ -1075,7 +1075,7 @@ padding-right: 8;</string>
</property>
<property name="maximumSize">
<size>
<width>50</width>
<width>56</width>
<height>16777215</height>
</size>
</property>
Expand Down Expand Up @@ -1124,6 +1124,58 @@ padding-right: 8;</string>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer_4">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_36">
<property name="leftMargin">
<number>10</number>
</property>
<property name="rightMargin">
<number>10</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QPushButton" name="btnClearCoord">
<property name="toolTip">
<string>Reset all coord systems</string>
</property>
<property name="text">
<string>Reset</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_9">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer_3">
<property name="orientation">
Expand Down Expand Up @@ -1438,6 +1490,86 @@ padding-right: 8;</string>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_4">
<attribute name="title">
<string>Misc</string>
</attribute>
<widget class="QWidget" name="verticalLayoutWidget">
<property name="geometry">
<rect>
<x>10</x>
<y>10</y>
<width>581</width>
<height>181</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_10">
<property name="topMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_37">
<property name="leftMargin">
<number>10</number>
</property>
<property name="rightMargin">
<number>10</number>
</property>
<item>
<widget class="QLabel" name="label">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Coolant:</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btnCoolantFlood">
<property name="text">
<string>Flood</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btnCoolantMist">
<property name="text">
<string>Mist</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btnCoolantDisable">
<property name="text">
<string>Disable</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer_5">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</widget>
</widget>
</item>
</layout>
Expand Down Expand Up @@ -3055,7 +3187,7 @@ padding-right: 8;</string>
<x>0</x>
<y>0</y>
<width>385</width>
<height>546</height>
<height>570</height>
</rect>
</property>
<property name="sizePolicy">
Expand Down Expand Up @@ -3869,7 +4001,7 @@ padding-right: 8;</string>
<x>0</x>
<y>0</y>
<width>1646</width>
<height>21</height>
<height>24</height>
</rect>
</property>
<widget class="QMenu" name="mnuFile">
Expand Down
12 changes: 11 additions & 1 deletion src/frmmain_processresponse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ void frmMain::ProcessGRBL1_1()
{
QString data = SerialIf_ReadLine().trimmed();

//qDebug() << "<" << data << ">";
qDebug() << "<" << data << ">";

// Filter prereset responses
if(m_reseting)
Expand All @@ -49,6 +49,11 @@ void frmMain::ProcessGRBL1_1()
}
}

if(data.length() == 0)
{
continue;
}

// Status response
if(data[0] == '<')
{
Expand Down Expand Up @@ -870,6 +875,11 @@ void frmMain::ProcessGRBL_ETH(QString data)
}
}

if(data.length() == 0)
{
return;
}

// Status response
if(data[0] == '<')
{
Expand Down

0 comments on commit 638a290

Please sign in to comment.