Skip to content

Commit 0a82059

Browse files
committed
Add new grbl-Mega-5X digital input/output functionalities
1 parent 6348503 commit 0a82059

27 files changed

+92587
-89747
lines changed

cn5X.py

+24-49
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
import serial, serial.tools.list_ports
3131
from PyQt5 import QtCore, QtGui, QtWidgets
3232
from PyQt5.QtCore import Qt, QCoreApplication, QObject, QThread, pyqtSignal, pyqtSlot, QModelIndex, QItemSelectionModel, QFileInfo, QTranslator, QLocale, QSettings
33-
from PyQt5.QtGui import QKeySequence, QStandardItemModel, QStandardItem, QValidator, QPalette
33+
from PyQt5.QtGui import QKeySequence, QStandardItemModel, QStandardItem, QValidator, QPalette, QFontDatabase
3434
from PyQt5.QtWidgets import QDialog, QAbstractItemView, QMessageBox
3535
from cn5X_config import *
3636
from msgbox import *
@@ -882,33 +882,18 @@ def on_gotoG28(self):
882882
Make a rapid move from current location to the position defined by the last G28.1
883883
If no positions are stored with G28.1 then all axes will go to the machine origin.
884884
'''
885-
'''
886-
if not self.__settings.value("dontConfirmG28", False, type=bool):
887-
# Confirmation :
888-
m = msgBox(
889-
title = self.tr("Go to G28 location?"),
890-
text = self.tr("Make a rapid move from current location to the position defined by the last G28.1?"),
891-
info = self.tr("If no positions are stored with G28.1 then all axes will go to the machine origin."),
892-
icon = msgIconList.Question,
893-
stdButton = msgButtonList.Yes | msgButtonList.Cancel,
894-
defButton = msgButtonList.Cancel,
895-
escButton = msgButtonList.Cancel,
896-
dontShowAgain = True,
897-
dontShowChecked = self.__settings.value("dontConfirmG28", False, type=bool)
898-
)
899-
if m.afficheMsg() == msgButtonList.Yes:
900-
# traitement si confirmé
901-
self.__grblCom.gcodePush("G28")
902-
# Mémorise le choix d'affichage de la boite de confirmation
903-
self.__settings.setValue("dontConfirmG28", m.chkDontShow.isChecked())
904-
else:
905-
# Envoi sans confirmation
906-
self.__grblCom.gcodePush("G28")
907-
'''
885+
self.ui.btnG28.setButtonStatus(True)
908886
''' Appel de la boite de dialogue G28 '''
909887
dlg = dlgG28_30_1("G28", self.__grblCom, self.__decode, self.__nbAxis, self.__axisNames)
910888
dlg.setParent(self)
911889
dlg.showDialog()
890+
# On laisse le temps à Grbl de commencer
891+
jusqua = time.time() + 0.25
892+
while time.time() < jusqua:
893+
QCoreApplication.processEvents()
894+
if self.__decode.get_etatMachine() == GRBL_STATUS_IDLE:
895+
# La boite de dialogue à ete annulée ou le trajet est déja fini
896+
self.ui.btnG28.setButtonStatus(False)
912897

913898

914899
@pyqtSlot()
@@ -917,33 +902,18 @@ def on_gotoG30(self):
917902
Make a rapid move from current location to the position defined by the last G30.1
918903
If no positions are stored with G30.1 then all axes will go to the machine origin.
919904
'''
920-
'''
921-
if not self.__settings.value("dontConfirmG30", False, type=bool):
922-
# Confirmation :
923-
m = msgBox(
924-
title = self.tr("Go to G30 location?"),
925-
text = self.tr("Make a rapid move from current location to the position defined by the last G30.1?"),
926-
info = self.tr("If no positions are stored with G30.1 then all axes will go to the machine origin."),
927-
icon = msgIconList.Question,
928-
stdButton = msgButtonList.Yes | msgButtonList.Cancel,
929-
defButton = msgButtonList.Cancel,
930-
escButton = msgButtonList.Cancel,
931-
dontShowAgain = True,
932-
dontShowChecked = self.__settings.value("dontConfirmG30", False, type=bool)
933-
)
934-
if m.afficheMsg() == msgButtonList.Yes:
935-
# traitement si confirmé
936-
self.__grblCom.gcodePush("G30")
937-
# Mémorise le choix d'affichage de la boite de confirmation
938-
self.__settings.setValue("dontConfirmG30", m.chkDontShow.isChecked())
939-
else:
940-
# Envoi sans confirmation
941-
self.__grblCom.gcodePush("G30")
942-
'''
905+
self.ui.btnG30.setButtonStatus(True)
943906
''' Appel de la boite de dialogue G30 '''
944907
dlg = dlgG28_30_1("G30", self.__grblCom, self.__decode, self.__nbAxis, self.__axisNames)
945908
dlg.setParent(self)
946909
dlg.showDialog()
910+
# On laisse le temps à Grbl de commencer
911+
jusqua = time.time() + 0.25
912+
while time.time() < jusqua:
913+
QCoreApplication.processEvents()
914+
if self.__decode.get_etatMachine() == GRBL_STATUS_IDLE:
915+
# La boite de dialogue à ete annulée ou le trajet est déja fini
916+
self.ui.btnG30.setButtonStatus(False)
947917

948918

949919
@pyqtSlot()
@@ -2727,8 +2697,10 @@ def setTranslator(self, langue: QLocale):
27272697

27282698

27292699
if __name__ == '__main__':
2730-
import sys
2731-
2700+
2701+
# Suppress qt.qpa.xcb: QXcbConnection: XCB error: 3 (BadWindow)
2702+
os.environ["QT_LOGGING_RULES"] = '*.debug=false;qt.qpa.*=false'
2703+
27322704
app = QtWidgets.QApplication(sys.argv)
27332705

27342706
# Retrouve le répertoire de l'exécutable
@@ -2756,6 +2728,9 @@ def setTranslator(self, langue: QLocale):
27562728
translator.load(langue, "{}/i18n/cn5X".format(app_path), ".")
27572729
app.installTranslator(translator)
27582730

2731+
# Chargement police LED Calculator depuis le fichier de ressources
2732+
QFontDatabase.addApplicationFont(":/cn5X/fonts/LEDCalculator.ttf")
2733+
27592734
# Définition de la locale pour affichage des dates dans la langue du systeme
27602735
try:
27612736
locale.setlocale(locale.LC_TIME, '')

cn5X.qrc

+12-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,15 @@
11
<RCC>
22
<qresource prefix="cn5X">
3+
<file>images/ledVerteAlumee.svg</file>
4+
<file>images/ledVerteEteinte.svg</file>
5+
<file>images/btnG30.svg</file>
6+
<file>images/btnG30_down.svg</file>
7+
<file>images/btnG30_light.svg</file>
38
<file>images/btnM64P0.svg</file>
49
<file>images/btnM64P1.svg</file>
10+
<file>images/btnG28.svg</file>
11+
<file>images/btnG28_down.svg</file>
12+
<file>images/btnG28_light.svg</file>
513
<file>images/btnM64P2.svg</file>
614
<file>images/btnM64P3.svg</file>
715
<file>images/btnJogNone.svg</file>
@@ -71,13 +79,13 @@
7179
<file>images/btnJogPlusY.svg</file>
7280
<file>images/btnJogPlusZ.svg</file>
7381
<file>images/btnJogStop.svg</file>
74-
<file>images/btnFloodM7_down.svg</file>
7582
<file>images/btnFloodM7_light.svg</file>
76-
<file>images/btnFloodM7.svg</file>
77-
<file>images/btnFloodM8_down.svg</file>
7883
<file>images/btnFloodM8_light.svg</file>
79-
<file>images/btnFloodM8.svg</file>
8084
<file>images/btnFloodM9_down.svg</file>
85+
<file>images/btnFloodM7.svg</file>
86+
<file>images/btnFloodM7_down.svg</file>
87+
<file>images/btnFloodM8.svg</file>
88+
<file>images/btnFloodM8_down.svg</file>
8189
<file>images/btnFloodM9_light.svg</file>
8290
<file>images/btnFloodM9.svg</file>
8391
<file>images/btnRefresh.svg</file>

cn5X_config.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626

2727
ORG_NAME = "fra589"
2828
APP_NAME = "cn5X++"
29-
APP_VERSION_STRING = "0.8.8"
30-
APP_VERSION_DATE = "20220216"
29+
APP_VERSION_STRING = "0.8.9"
30+
APP_VERSION_DATE = "20220509"
3131

3232
DEFAULT_NB_AXIS = 3 # Laisser 3 permet de gerer un Grbl original a 3 axes
3333
DEFAULT_AXIS_NAMES = ['X', 'Y', 'Z']

0 commit comments

Comments
 (0)