@@ -81,6 +81,7 @@ def __init__(self, ui, log, grbl: grblCom):
81
81
self .__offsetG5x = [0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 ]
82
82
self .__etatArrosage = None
83
83
self .__etatMachine = None
84
+ self .__digitalStatus = [False , False , False , False ]
84
85
self .__getNextStatusOutput = False
85
86
self .__getNextGCodeParams = False
86
87
self .__getNextGCodeState = False
@@ -134,6 +135,8 @@ def decodeGrblStatus(self, grblOutput):
134
135
self .ui .statusBar .showMessage ("{} + {}" .format (self .__grblCom .grblVersion (), grblOutput ))
135
136
136
137
flagPn = False
138
+ flagOv = False
139
+ flagDigital = False
137
140
tblDecode = grblOutput [1 :- 1 ].split ("|" )
138
141
for D in tblDecode :
139
142
if D in self .__validMachineState :
@@ -261,6 +264,7 @@ def decodeGrblStatus(self, grblOutput):
261
264
self .ui .progressBufferState .setToolTip ("Buffer stat : " + tblValue [0 ] + "/" + tblValue [1 ])
262
265
263
266
elif D [:3 ] == "Ov:" : # Override Values for feed, rapids, and spindle
267
+ flagOv = True
264
268
values = D .split (':' )[1 ].split (',' )
265
269
# Avance de travail
266
270
if int (self .ui .lblAvancePourcent .text ()[:- 1 ]) != int (values [0 ]):
@@ -285,6 +289,37 @@ def decodeGrblStatus(self, grblOutput):
285
289
else :
286
290
exec ("self.ui.cnLed" + L + ".setLedStatus(False)" )
287
291
292
+ elif D [:2 ] == "A:" : # OverrideAccessory State
293
+ accessoryState = D [2 :]
294
+ digitalFind = accessoryState .find ("D" )
295
+ if digitalFind >= 0 :
296
+ flagDigital = True
297
+ digitalState = accessoryState [digitalFind + 1 :]
298
+ if digitalState [3 ] == "1" :
299
+ self .ui .btnM64P0 .setButtonStatus (True )
300
+ self .__digitalStatus [0 ] = True
301
+ else :
302
+ self .ui .btnM64P0 .setButtonStatus (False )
303
+ self .__digitalStatus [0 ] = False
304
+ if digitalState [2 ] == "1" :
305
+ self .ui .btnM64P1 .setButtonStatus (True )
306
+ self .__digitalStatus [1 ] = True
307
+ else :
308
+ self .ui .btnM64P1 .setButtonStatus (False )
309
+ self .__digitalStatus [1 ] = False
310
+ if digitalState [1 ] == "1" :
311
+ self .ui .btnM64P2 .setButtonStatus (True )
312
+ self .__digitalStatus [2 ] = True
313
+ else :
314
+ self .ui .btnM64P2 .setButtonStatus (False )
315
+ self .__digitalStatus [2 ] = False
316
+ if digitalState [0 ] == "1" :
317
+ self .ui .btnM64P3 .setButtonStatus (True )
318
+ self .__digitalStatus [3 ] = True
319
+ else :
320
+ self .ui .btnM64P3 .setButtonStatus (False )
321
+ self .__digitalStatus [3 ] = False
322
+
288
323
'''
289
324
elif D[:3] == "Ln:": # Line Number
290
325
return D
@@ -295,10 +330,21 @@ def decodeGrblStatus(self, grblOutput):
295
330
elif D[3:] == "FS:": # Current Feed and Speed
296
331
return D
297
332
'''
298
- '''
299
- elif D[2:] == "A:": # OverrideAccessory State
300
- return D
301
- '''
333
+
334
+ if flagOv and not flagDigital :
335
+ if self .__digitalStatus [0 ]:
336
+ self .ui .btnM64P0 .setButtonStatus (False )
337
+ self .__digitalStatus [0 ] = False
338
+ if self .__digitalStatus [1 ]:
339
+ self .ui .btnM64P1 .setButtonStatus (False )
340
+ self .__digitalStatus [1 ] = False
341
+ if self .__digitalStatus [2 ]:
342
+ self .ui .btnM64P2 .setButtonStatus (False )
343
+ self .__digitalStatus [2 ] = False
344
+ if self .__digitalStatus [3 ]:
345
+ self .ui .btnM64P3 .setButtonStatus (False )
346
+ self .__digitalStatus [3 ] = False
347
+
302
348
if not flagPn :
303
349
# Eteint toute les leds. Si on a pas trouve la chaine Pn:, c'est que toute les leds sont eteintes.
304
350
for L in ['X' , 'Y' , 'Z' , 'A' , 'B' , 'C' , 'P' , 'D' , 'H' , 'R' , 'S' ]:
@@ -581,6 +627,11 @@ def get_etatMachine(self):
581
627
return self .__etatMachine
582
628
583
629
630
+ def getDigitalStatus (self , digitNum ):
631
+ if digitNum >= 0 and digitNum <= 3 :
632
+ return self .__digitalStatus [digitNum ]
633
+
634
+
584
635
def getWco (self , axis = None ):
585
636
if axis is not None :
586
637
if axis in self .__axisNames :
0 commit comments