Z轴可利用代码控制移动

This commit is contained in:
2026-10-10 14:10:59 +08:00
parent b827c5ffee
commit 264275b1e6
9 changed files with 406 additions and 40 deletions
+39 -1
View File
@@ -19,7 +19,7 @@ from __future__ import annotations
from orisys_app_shared.i18n import t
from orisys_autocal.motion import BusStatus
from orisys_autocal.motion import AxisState, BusStatus, Snapshot
from orisys_autocal.motion.pose_move import plan_pose_move
@@ -37,6 +37,44 @@ def _connected(make_window, *, confirm: bool = False):
return window
def test_axis_4_controls_stay_available_when_the_bus_count_is_short(make_window):
"""A mapped axis 4 uses the same buttons as axes 0-3.
The bus-count global can still say 4 after the drive is working again.
Type 0 stays disabled, so an axis the controller has not mapped is not
given a button.
"""
window = make_window()
try:
mapped = tuple(AxisState(axis=index, atype=65, read_ok=True) for index in range(5))
window.axis_panel.update_snapshot(
Snapshot(
connected=True,
bus=BusStatus(bus_type="ecat", init_status=1, total_axes=4),
axes=mapped,
)
)
row = window.axis_panel._rows[4] # noqa: SLF001
assert row["enable_button"].isEnabled()
assert row["fwd_button"].isEnabled()
assert row["rev_button"].isEnabled()
assert row["stop_button"].isEnabled()
unmapped = mapped[:-1] + (AxisState(axis=4, atype=0, read_ok=True),)
window.axis_panel.update_snapshot(
Snapshot(
connected=True,
bus=BusStatus(bus_type="ecat", init_status=1, total_axes=4),
axes=unmapped,
)
)
row = window.axis_panel._rows[4] # noqa: SLF001
assert not row["fwd_button"].isEnabled()
assert row["stop_button"].isEnabled() is False
finally:
window.close()
def test_execute_lives_with_the_point_it_executes(make_window):
window = make_window()
try: