From 6ed6a63c8bdbdbf224b01776705edf2cd7e77716 Mon Sep 17 00:00:00 2001 From: IDKHTS <2811212491@qq.com> Date: Thu, 6 Jun 2024 20:43:32 +0800 Subject: [PATCH] Fix: Update 10w and 1.6w can not use ab position --- .../model-operation-overlay/ABPositionOverlay.tsx | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/app/ui/views/model-operation-overlay/ABPositionOverlay.tsx b/src/app/ui/views/model-operation-overlay/ABPositionOverlay.tsx index 3c7cd8026..0936c5faf 100644 --- a/src/app/ui/views/model-operation-overlay/ABPositionOverlay.tsx +++ b/src/app/ui/views/model-operation-overlay/ABPositionOverlay.tsx @@ -19,6 +19,7 @@ import { actions as editorActions } from '../../../flux/editor'; import { HEAD_LASER, MotorPowerMode, SetupCoordinateMethod } from '../../../constants'; import HomeTipModal from '../../widgets/RaySetOriginWidget/modals/HomeTipModal'; import SvgIcon from '../../components/SvgIcon'; +import { L20WLaserToolModule, L2WLaserToolModule, L40WLaserToolModule } from '../../../machines/snapmaker-2-toolheads'; interface ABPositionOverlayProps { onClose: () => void; @@ -36,17 +37,22 @@ const ABPositionOverlay: React.FC = (props) => { machineIdentifier, workflowStatus, isRotate, - isRayNewVersion + isRayNewVersion, + worksapceToolHead } = useSelector((state: RootState) => state.workspace); const server: MachineAgent = useSelector((state: RootState) => state.workspace.server); const dispatch = useDispatch(); const [isConnectedRay, setIsConnectedRay] = useState(false); const [isShowTip, setIsShowTip] = useState(true); const canABPosition = useCallback(() => { + const isSupportedHead = includes([L2WLaserToolModule.identifier, L20WLaserToolModule.identifier, L40WLaserToolModule], worksapceToolHead); // if old ray firmware version, can't operate ab position if (isConnectedRay && !isRayNewVersion) return false; - return isConnected && machineIdentifier === activeMachine.identifier && headType === HEAD_LASER && WorkflowStatus.Idle === workflowStatus; - }, [isConnected, machineIdentifier, activeMachine, headType, workflowStatus, isConnectedRay, isRayNewVersion]); + return (isConnected + && machineIdentifier === activeMachine.identifier + && headType === HEAD_LASER + && isSupportedHead && WorkflowStatus.Idle === workflowStatus); + }, [isConnected, machineIdentifier, activeMachine, headType, workflowStatus, isConnectedRay, isRayNewVersion, worksapceToolHead]); // Home Tip Modal state const [showHomeTip, setShowHomeTip] = useState(false);