瀏覽代碼

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 周之前
父節點
當前提交
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