From 92a7ed19ed09d055f7c918518acb6059db7cc6a3 Mon Sep 17 00:00:00 2001 From: jkpete <1031139173@qq.com> Date: Thu, 25 Dec 2025 15:18:18 +0800 Subject: [PATCH] fixed Reset Position --- Script/Model/ModelTrackControl.cs | 1 + Script/Protocol/RequestTargetEngine.cs | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/Script/Model/ModelTrackControl.cs b/Script/Model/ModelTrackControl.cs index 63f3b1c..c17e7e8 100644 --- a/Script/Model/ModelTrackControl.cs +++ b/Script/Model/ModelTrackControl.cs @@ -44,6 +44,7 @@ public class ModelTrackControl : EGModule, IEGFramework if (CurrentRotation != 0) { this.EGSendMessage(new RequestTargetControl(2000, 500, true), this.GetModule().EngineSerialPort, ProtocolType.SerialPort); + this.EGSendMessage(new RequestTargetResetPosition(), this.GetModule().EngineSerialPort, ProtocolType.SerialPort); CurrentRotation = 0; this.GetModule().SetRotation(CurrentRotation); } diff --git a/Script/Protocol/RequestTargetEngine.cs b/Script/Protocol/RequestTargetEngine.cs index 499599f..97fe0a2 100644 --- a/Script/Protocol/RequestTargetEngine.cs +++ b/Script/Protocol/RequestTargetEngine.cs @@ -29,3 +29,15 @@ public class RequestTargetControl : ModbusRTU_WriteMultiHoldingRegister, IEGFram return resultValues; } } + + +public class RequestTargetResetPosition : ModbusRTU_WriteSingleHoldingRegister, IEGFramework +{ + public RequestTargetResetPosition() + { + this.DeviceAddress = 0x01; + this.RegisterAddress = 0x700A; + this.Value = 0x01; + EG.Print("[TargetSend]" + this.ToProtocolByteData().ToStringByHex()); + } +} \ No newline at end of file