@@ -214,6 +214,9 @@ def init_pins(self):
214214 pin = QHAL .newpin ("spindle-modbus-errors" , QHAL .HAL_U32 , QHAL .HAL_IN )
215215 pin .value_changed .connect (self .mb_errors_changed )
216216 QHAL .newpin ("spindle-inhibit" , QHAL .HAL_BIT , QHAL .HAL_OUT )
217+ pin = QHAL .newpin ("spindle-modbus-connection" , QHAL .HAL_U32 , QHAL .HAL_IN )
218+ pin .value_changed .connect (self .mb_connection_changed )
219+
217220 # external offset control pins
218221 QHAL .newpin ("eoffset-enable" , QHAL .HAL_BIT , QHAL .HAL_OUT )
219222 QHAL .newpin ("eoffset-clear" , QHAL .HAL_BIT , QHAL .HAL_OUT )
@@ -501,6 +504,12 @@ def mb_errors_changed(self, data):
501504 errors = self .h ['spindle-modbus-errors' ]
502505 self .w .lbl_mb_errors .setText (str (errors ))
503506
507+ def mb_connection_changed (self , data ):
508+ if data :
509+ self .w .lbl_mb_errors .setStyleSheet ('' )
510+ else :
511+ self .w .lbl_mb_errors .setStyleSheet ('''background-color:rgb(202, 0, 0);''' )
512+
504513 def eoffset_changed (self , data ):
505514 self .w .z_comp_eoffset_value .setText (format (data * .001 , '.3f' ))
506515
0 commit comments