| | |
| | | export function useManualControl(mqttState,deviceTopicInfo, isCurrentFlightController,paramsRef) { |
| | | let activeCodeKey = null |
| | | let genPortOne = true //是一代机场 |
| | | const mqttHooks = useMqtt(mqttState,deviceTopicInfo) |
| | | let mqttHooks = useMqtt(mqttState,deviceTopicInfo) |
| | | let seq = 0 |
| | | const keysPressed = [ |
| | | {key: 'KeyQ', value: false}, |
| | |
| | | case 'ArrowUp': |
| | | if (activeCodeKey === keyCode) return |
| | | clearInterval(myInterval) |
| | | ptzControl('up') |
| | | myInterval = setInterval(()=>ptzControl('up'), 200) |
| | | activeCodeKey = keyCode |
| | | break |
| | | case 'ArrowDown': |
| | | if (activeCodeKey === keyCode) return |
| | | clearInterval(myInterval) |
| | | ptzControl('down') |
| | | myInterval = setInterval(()=>ptzControl('down'), 200) |
| | | activeCodeKey = keyCode |
| | | break |
| | | case 'ArrowLeft': |
| | | if (activeCodeKey === keyCode) return |
| | | clearInterval(myInterval) |
| | | ptzControl('left') |
| | | myInterval = setInterval(()=>ptzControl('left'), 200) |
| | | activeCodeKey = keyCode |
| | | break |
| | | case 'ArrowRight': |
| | | if (activeCodeKey === keyCode) return |
| | | clearInterval(myInterval) |
| | | ptzControl('right') |
| | | myInterval = setInterval(()=>ptzControl('right'), 200) |
| | | activeCodeKey = keyCode |
| | | break |
| | |
| | | { immediate: true } |
| | | ) |
| | | |
| | | onBeforeUnmount(()=>{ |
| | | mqttHooks?.d |
| | | }) |
| | | |
| | | onUnmounted(() => { |
| | | deviceTopicInfo.subTopic = '' |
| | | deviceTopicInfo.pubTopic = '' |
| | | mqttHooks = null |
| | | closeKeyboardManualControl() |
| | | }) |
| | | |