Ver Fonte

Merge remote-tracking branch 'origin/main' into kiosk_mode_eglfs

tuanchris há 3 meses atrás
pai
commit
461ec94c4e
1 ficheiros alterados com 11 adições e 2 exclusões
  1. 11 2
      modules/connection/connection_manager.py

+ 11 - 2
modules/connection/connection_manager.py

@@ -445,8 +445,17 @@ def home(timeout=15):
                 finally:
                 finally:
                     loop.close()
                     loop.close()
 
 
-            state.current_theta = state.current_rho = 0
-            homing_success = True
+            # Wait for device to reach idle state after homing
+            logger.info("Waiting for device to reach idle state after homing...")
+            idle_reached = check_idle()
+
+            if idle_reached:
+                state.current_theta = state.current_rho = 0
+                homing_success = True
+                logger.info("Homing completed and device is idle")
+            else:
+                logger.error("Device did not reach idle state after homing")
+
             homing_complete.set()
             homing_complete.set()
         except Exception as e:
         except Exception as e:
             logger.error(f"Error during homing: {e}")
             logger.error(f"Error during homing: {e}")