Просмотр исходного кода

Fix get_machine_position to also accept WPos format

Missed this function in the previous fix - it was still checking
only for MPos, causing position query timeouts after homing.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
tuanchris 1 неделя назад
Родитель
Сommit
9c31bbffb8
1 измененных файлов с 3 добавлено и 1 удалено
  1. 3 1
      modules/connection/connection_manager.py

+ 3 - 1
modules/connection/connection_manager.py

@@ -1221,6 +1221,7 @@ def is_machine_idle() -> bool:
 def get_machine_position(timeout=5):
     """
     Query the device for its position.
+    Supports both MPos and WPos formats (depends on GRBL $10 setting).
     """
     start_time = time.time()
     while time.time() - start_time < timeout:
@@ -1228,7 +1229,8 @@ def get_machine_position(timeout=5):
             state.conn.send('?')
             response = state.conn.readline()
             logger.debug(f"Raw status response: {response}")
-            if "MPos" in response:
+            # Accept either MPos or WPos format
+            if "MPos" in response or "WPos" in response:
                 pos = parse_machine_position(response)
                 if pos:
                     machine_x, machine_y = pos