From ecb005c68df7058b3c09135f8e4c7f86d07ab7c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=99=E5=B0=8F=E4=BA=91?= Date: Fri, 20 Mar 2026 09:52:18 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=B3=E6=9C=BA=EF=BC=8C=E4=B8=94=E6=9C=BA?= =?UTF-8?q?=E5=9C=BA=E5=9C=A8=E7=BA=BF=E7=9A=84=E6=83=85=E5=86=B5=E4=B8=8B?= =?UTF-8?q?=E6=89=8D=E5=8F=AF=E4=BB=A5=E9=A3=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../vendor/tuoheng/TuohengVendorConfig.java | 54 +++++++++---------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/src/main/java/com/ruoyi/device/domain/impl/machine/vendor/tuoheng/TuohengVendorConfig.java b/src/main/java/com/ruoyi/device/domain/impl/machine/vendor/tuoheng/TuohengVendorConfig.java index 4e9ce2a..525ef8f 100644 --- a/src/main/java/com/ruoyi/device/domain/impl/machine/vendor/tuoheng/TuohengVendorConfig.java +++ b/src/main/java/com/ruoyi/device/domain/impl/machine/vendor/tuoheng/TuohengVendorConfig.java @@ -42,34 +42,34 @@ public class TuohengVendorConfig implements VendorConfig { @Override public boolean canExecuteCommand(MachineStates currentStates, CommandType commandType) { - return true; -// DroneState droneState = currentStates.getDroneState(); -// AirportState airportState = currentStates.getAirportState(); -// DebugModeState debugModeState = currentStates.getDebugModeState(); +// return true; + DroneState droneState = currentStates.getDroneState(); + AirportState airportState = currentStates.getAirportState(); + DebugModeState debugModeState = currentStates.getDebugModeState(); -// switch (commandType) { -// case POWER_ON: -// // 开机前置条件:机场在线、无人机关机 -// // 注:拓恒无人机没有调试模式概念 -// return airportState == AirportState.ONLINE -// && droneState == DroneState.POWER_OFF; -// -// case POWER_OFF: -// // 关机前置条件:机场在线、无人机在线(未飞行) -// return airportState == AirportState.ONLINE -// && droneState == DroneState.ONLINE; -// -// case TAKE_OFF: -// // 起飞前置条件:机场在线 -// return airportState == AirportState.ONLINE; -// -// case RETURN_HOME: -// // 返航前置条件:无人机飞行中 -// return true; -// -// default: -// return true; -// } + switch (commandType) { + case POWER_ON: + // 开机前置条件:机场在线、无人机关机 + // 注:拓恒无人机没有调试模式概念 + return airportState == AirportState.ONLINE + && droneState == DroneState.POWER_OFF; + + case POWER_OFF: + // 关机前置条件:机场在线、无人机在线(未飞行) + return airportState == AirportState.ONLINE + && droneState == DroneState.ONLINE; + + case TAKE_OFF: + // DroneState.POWER_OFF 需要关机; AirportState.ONLINE 判断来自于 /topic/v1/heartbeat/{sn}/message + return droneState == DroneState.POWER_OFF && airportState == AirportState.ONLINE; + + case RETURN_HOME: + // 返航前置条件:无人机飞行中 + return true; + + default: + return true; + } } @Override