接收 全局推送告警 处理告警 优化控制逻辑
This commit is contained in:
@@ -734,6 +734,7 @@ export default function DeviceStatusPage() {
|
||||
const handleGamepadUpdate = useCallback((state) => {
|
||||
// 无控制权限时:不发送消息,且只发起一次权限申请(避免手柄/方向盘高频更新刷屏)
|
||||
if (!isControlled) {
|
||||
messageApi.warning("请获取控制权限");
|
||||
//if (!hasRequestedControlRef.current && !connecting) {
|
||||
// hasRequestedControlRef.current = true;
|
||||
// handleControlModal();
|
||||
@@ -741,9 +742,12 @@ export default function DeviceStatusPage() {
|
||||
//return;
|
||||
}
|
||||
console.log(realtimePosition?.controlMode, "现在的控制controlmode")
|
||||
if (realtimePosition?.controlMode && (realtimePosition?.controlMode != 3 || realtimePosition?.controlMode != 0)) {
|
||||
if (
|
||||
realtimePosition?.controlMode != 3 &&
|
||||
realtimePosition?.controlMode != 0 &&
|
||||
realtimePosition?.controlMode != null
|
||||
) {
|
||||
messageApi.warning(t('devices.noRemoteControl'));
|
||||
//return;
|
||||
}
|
||||
console.log('Gamepad state updated:', state);
|
||||
// 记录方向盘 xy 坐标,用于倒车影像叠加层
|
||||
@@ -756,7 +760,11 @@ export default function DeviceStatusPage() {
|
||||
const gamepadWarnRef = useRef(0);
|
||||
const blockIfGamepadConnected = useCallback(() => {
|
||||
// 没连接手柄 或 还没获取控制权限 → 不拦截(没控制权限本来就发不出消息)
|
||||
if (!isGamepadConnected || !isControlled) return false;
|
||||
if (!isGamepadConnected) return false;
|
||||
if (!isControlled) {
|
||||
messageApi.warning("请获取控制权限");
|
||||
return false;
|
||||
}
|
||||
const now = Date.now();
|
||||
if (now - gamepadWarnRef.current > 2000) {
|
||||
gamepadWarnRef.current = now;
|
||||
|
||||
Reference in New Issue
Block a user