dev
This commit is contained in:
parent
f3386630c3
commit
2b70218fd4
|
|
@ -544,13 +544,13 @@ class HikrobotSmartCamera(Component):
|
|||
self.log.error(f"Error getting current scheme: {e}")
|
||||
return None
|
||||
|
||||
def switch_scheme_sync(self, solution_name, timeout=30):
|
||||
def switch_scheme_sync(self, solution_name, timeout=None):
|
||||
"""
|
||||
Synchronously switch to a different scheme/solution and wait for completion.
|
||||
|
||||
Args:
|
||||
solution_name: The name of the solution to switch to
|
||||
timeout: Maximum time to wait for the switch to complete (in seconds)
|
||||
timeout: Not used, kept for backward compatibility
|
||||
|
||||
Returns:
|
||||
bool: True if successful, False otherwise
|
||||
|
|
@ -571,18 +571,10 @@ class HikrobotSmartCamera(Component):
|
|||
self.log.error(f"Failed to initiate scheme switch to: {solution_name}")
|
||||
return False
|
||||
|
||||
# Wait for the scheme switching to complete
|
||||
self.log.info(f"Waiting for scheme switch to complete (timeout: {timeout}s)")
|
||||
# Wait for the scheme switching to complete (no timeout)
|
||||
self.log.info(f"Waiting for scheme switch to complete (no timeout)")
|
||||
|
||||
start_time = time.time()
|
||||
while self.current_operation == "switch_scheme":
|
||||
# Check if we've exceeded the timeout
|
||||
if time.time() - start_time > timeout:
|
||||
self.log.error(f"Scheme switching timed out after {timeout} seconds")
|
||||
self.progress_timer.stop()
|
||||
self.current_operation = None
|
||||
return False
|
||||
|
||||
# Sleep a bit to avoid busy waiting
|
||||
time.sleep(0.5)
|
||||
|
||||
|
|
|
|||
|
|
@ -34,11 +34,7 @@ class SchemeProgressDialog(QDialog):
|
|||
self.status_label = QLabel("Status: Initializing...")
|
||||
layout.addWidget(self.status_label)
|
||||
|
||||
# Set a timeout in case the progress signal doesn't complete
|
||||
self.timer = QTimer(self)
|
||||
self.timer.setSingleShot(True)
|
||||
self.timer.timeout.connect(self.handle_timeout)
|
||||
self.timer.start(30000) # 30 second timeout
|
||||
# No timeout - wait indefinitely for the scheme switching to complete
|
||||
|
||||
def update_progress(self, progress, status):
|
||||
"""
|
||||
|
|
@ -52,12 +48,6 @@ class SchemeProgressDialog(QDialog):
|
|||
elif status == "Failed":
|
||||
self.reject()
|
||||
|
||||
def handle_timeout(self):
|
||||
"""
|
||||
Handle the case where the progress signal doesn't complete within the timeout.
|
||||
"""
|
||||
self.status_label.setText("Status: Timeout - Continuing anyway")
|
||||
self.accept() # Continue with the cycle even if timeout occurs
|
||||
|
||||
|
||||
class Test_Vision(Test_Test):
|
||||
|
|
@ -350,8 +340,8 @@ class Test_Vision(Test_Test):
|
|||
|
||||
self.log.info(f"Testing scheme switch to: {test_recipe}")
|
||||
|
||||
# Use the synchronous scheme switching method directly
|
||||
success = self.components["hikrobot_sc"].switch_scheme_sync(test_recipe, timeout=30)
|
||||
# Use the synchronous scheme switching method directly (no timeout)
|
||||
success = self.components["hikrobot_sc"].switch_scheme_sync(test_recipe)
|
||||
|
||||
if success:
|
||||
self.log.info(f"Successfully switched to scheme: {test_recipe}")
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user