急停 发送ws 遥感控制 避免 raf循环闭包
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
import React, { useState } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { useSelector } from 'react-redux';
|
||||
import { RootState } from '@/store';
|
||||
import { sendEmergencyStop } from './emergencyStopControl';
|
||||
import {
|
||||
ShieldAlert,
|
||||
Zap,
|
||||
@@ -48,6 +51,7 @@ const RobotFeatureButtons: React.FC<RobotFeatureButtonsProps> = ({
|
||||
className = '',
|
||||
}) => {
|
||||
const { t } = useTranslation();
|
||||
const { userInfo } = useSelector((state: RootState) => state.user);
|
||||
const [active, setActive] = useState<Set<RobotFeature>>(new Set(activeFeatures));
|
||||
|
||||
const handleClick = (feature: RobotFeature) => {
|
||||
@@ -56,6 +60,8 @@ const RobotFeatureButtons: React.FC<RobotFeatureButtonsProps> = ({
|
||||
if (next) nextSet.add(feature);
|
||||
else nextSet.delete(feature);
|
||||
setActive(nextSet);
|
||||
// 急停:点击时直接下发 button7(绕过控制权限校验)
|
||||
if (feature === 'emergencyStop') sendEmergencyStop(userInfo);
|
||||
onToggle?.(feature, next);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user