修正朝上判断、接触高度与过期姿态目标

朝上判断误用平台轴、接触高度报旋转前数值、多点对准复用缓存姿态,且多点会话被复核入口拒绝;
现按修正计划改正并接通 autocal-multipoint-1.0 只读复核,缺失帧源如实报告而不补零。

离线验证:新回归在 dc5a6f8 上失败、此处通过,panel_check 通过,两截图点接触高度复现
19.0510 / 21.5781 mm;实机项未做,详见 .scratch/autocal-motion-fix/verification.md。
This commit is contained in:
ykcheungab
2026-10-15 06:52:28 +08:00
parent 5339624ffa
commit bcc55a3b97
29 changed files with 2179 additions and 209 deletions
+65 -4
View File
@@ -180,20 +180,21 @@ def test_the_axis_mapping_page_holds_the_mapping_and_refuses_duplicates(make_win
window = make_window()
try:
dialog = window.device_setup
assert dialog.tabs.count() == 3
assert dialog.tabs.count() == 4
page = dialog.roles_page
assert page.roles() == DEFAULT_AXIS_ROLES
assert page.problem() == ""
assert window.poller.service.axis_roles == DEFAULT_AXIS_ROLES
# Two roles on one drive: reported on the page *and* by the guard.
page.combos["pitch"].setCurrentIndex(page.combos["pitch"].findData(3))
# Two roles on one drive: reported on the page *and* by the guard. Yaw is
# moved onto pitch's drive, which is the duplicate this page exists to refuse.
page.combos["yaw"].setCurrentIndex(page.combos["yaw"].findData(3))
assert page.problem() != ""
assert window.poller.service.roles_problem() != ""
assert window.poller.service.check_axes_move({"yaw": 1.0}) is not None
# Correcting it clears both.
page.combos["pitch"].setCurrentIndex(page.combos["pitch"].findData(2))
page.combos["yaw"].setCurrentIndex(page.combos["yaw"].findData(2))
assert page.problem() == ""
assert window.poller.service.roles_problem() == ""
finally:
@@ -222,3 +223,63 @@ def test_opening_the_setup_does_not_touch_the_connection(make_window):
assert window.connection_panel.open_button.isEnabled() is True
finally:
window.close()
def test_the_press_page_starts_uncalibrated_and_says_so(make_window):
"""Until the zero is measured the press axis is not a coordinate anyone knows."""
window = make_window()
try:
page = window.device_setup.press_page
assert page.press()["calibrated"] is False
assert page.state_label.text() == t("setup.press_unset")
assert window.finger_panel.solved_pose # bound; the pose itself needs a bundle
finally:
window.close()
def test_a_press_axis_edit_reaches_the_panel_that_plans_the_move(make_window):
"""The page is a measurement, and the move has to obey it immediately.
A zero typed here but not handed to the solver's consumer would leave the
confirmation box showing a height the press axis was never told about.
"""
window = make_window()
try:
page = window.device_setup.press_page
page.zero_spin.setValue(12.5)
page.calibrated_check.setChecked(True)
assert window.prefs["press_axis"] == {
"zero_mm": 12.5,
"rising": True,
"calibrated": True,
}
assert window.finger_panel._press.calibrated is True # noqa: SLF001
assert window._press_axis.zero_mm == 12.5 # noqa: SLF001
assert page.state_label.text() == t("setup.press_set")
page.rising_check.setChecked(False)
assert window.prefs["press_axis"]["rising"] is False
assert window._press_axis.rising is False # noqa: SLF001
finally:
window.close()
def test_a_stored_press_axis_is_restored_into_the_page(make_window):
window = make_window(
press_axis={"zero_mm": -3.25, "rising": False, "calibrated": True}
)
try:
page = window.device_setup.press_page
assert page.press() == {"zero_mm": -3.25, "rising": False, "calibrated": True}
assert window.finger_panel._press.zero_mm == -3.25 # noqa: SLF001
finally:
window.close()
@pytest.mark.parametrize("settings", [
{"zero_mm": 12.5, "rising": True, "calibrated": "false"},
{"zero_mm": float("nan"), "rising": True, "calibrated": True},
{"zero_mm": 12.5, "rising": "false", "calibrated": True},
])
def test_invalid_stored_press_relation_does_not_enable_motion(make_window, settings):
window = make_window()
window.prefs["press_axis"] = settings
assert window._press_axis.target_for(19.051) is None