@@ -70,6 +70,7 @@ def __init__(self, halcomp, widgets, paths):
7070 KEYBIND .add_call ('Key_Less' ,'on_keycall_angular_jograte' ,0 )
7171
7272 # some global variables
73+ self ._spindle_wait = False
7374 self .probe = None
7475 self .default_setup = os .path .join (PATH .CONFIGPATH , "default_setup.html" )
7576 self .docs = os .path .join (PATH .SCREENDIR , PATH .BASEPATH ,'docs/getting_started.html' )
@@ -117,7 +118,7 @@ def __init__(self, halcomp, widgets, paths):
117118 STATUS .connect ('file-loaded' , self .file_loaded )
118119 STATUS .connect ('all-homed' , self .all_homed )
119120 STATUS .connect ('not-all-homed' , self .not_all_homed )
120- STATUS .connect ('periodic' , lambda w : self .update_runtimer ())
121+ STATUS .connect ('periodic' , lambda w : self .periodic_update ())
121122 STATUS .connect ('command-stopped' , lambda w : self .stop_timer ())
122123 STATUS .connect ('progress' , lambda w ,p ,t : self .updateProgress (p ,t ))
123124 STATUS .connect ('override-limits-changed' , lambda w , state , data : self ._check_override_limits (state , data ))
@@ -692,10 +693,16 @@ def disable_pause_buttons(self, state):
692693 else :
693694 self .h ['spindle-inhibit' ] = False
694695 self .add_status ('Spindle re-started' )
695- # instantiate warning box
696- info = "Wait for spindle at speed signal before resuming"
697- mess = {'NAME' :'MESSAGE' , 'ICON' :'WARNING' , 'ID' :'_wait_resume_' , 'MESSAGE' :'CAUTION' , 'MORE' :info , 'TYPE' :'OK' }
698- ACTION .CALL_DIALOG (mess )
696+ # If spindle at speed is connected use it lower spindle
697+ if self .h .hal .pin_has_writer ('spindle.0.at-speed' ):
698+ self ._spindle_wait = True
699+ return
700+ else :
701+ # or wait for dialog to close before lowering spindle
702+ # instantiate warning box
703+ info = "Wait for spindle at speed signal before resuming"
704+ mess = {'NAME' :'MESSAGE' , 'ICON' :'WARNING' , 'ID' :'_wait_resume_' , 'MESSAGE' :'CAUTION' , 'MORE' :info , 'TYPE' :'OK' }
705+ ACTION .CALL_DIALOG (mess )
699706
700707 # override frame
701708 def slow_button_clicked (self , state ):
@@ -1142,6 +1149,18 @@ def update_rpm(self, speed):
11421149 self .w .lbl_spindle_set .style ().unpolish (self .w .lbl_spindle_set )
11431150 self .w .lbl_spindle_set .style ().polish (self .w .lbl_spindle_set )
11441151
1152+ def periodic_update (self ):
1153+ # if waiting and up to speed, lower spindle
1154+ if self ._spindle_wait :
1155+ if bool (self .h .hal .get_value ('spindle.0.at-speed' )):
1156+ self .h ['eoffset-spindle-count' ] = 0
1157+ self .h ['eoffset-clear' ] = True
1158+ self .add_status ('Spindle lowered' )
1159+ self .h ['eoffset-clear' ] = False
1160+ self ._spindle_wait = False
1161+
1162+ self .update_runtimer ()
1163+
11451164 def update_runtimer (self ):
11461165 if not self .timer_on or STATUS .is_auto_paused ():
11471166 return
@@ -1155,6 +1174,7 @@ def update_runtimer(self):
11551174 minutes , seconds = divmod (remainder , 60 )
11561175 self .w .lbl_runtime .setText ("{:02d}:{:02d}:{:02d}" .format (hours , minutes , seconds ))
11571176
1177+
11581178 def start_timer (self ):
11591179 self .run_time = 0
11601180 self .timer_on = True
0 commit comments